From 697766a02f9b817563f8d440cb976b66f9c544df Mon Sep 17 00:00:00 2001 From: Sahil Silare Date: Fri, 4 Oct 2024 02:50:10 +0530 Subject: [PATCH] fix: fixed a bug for the error which was shown when waiting for response --- .../src/components/pages/home/prompt/Result.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wren-ui/src/components/pages/home/prompt/Result.tsx b/wren-ui/src/components/pages/home/prompt/Result.tsx index 55455c7d7..e2625e7db 100644 --- a/wren-ui/src/components/pages/home/prompt/Result.tsx +++ b/wren-ui/src/components/pages/home/prompt/Result.tsx @@ -226,7 +226,13 @@ const Finished = (props: Props) => { ); }; -const getProcessStateComponent = (state: PROCESS_STATE) => { +const getProcessStateComponent = ( + state: PROCESS_STATE, + data: AskingTask['candidates'], +) => { + if (state === PROCESS_STATE.FINISHED && data.length === 0) { + return NoResult; + } return ( { [PROCESS_STATE.UNDERSTANDING]: Understanding, @@ -240,9 +246,12 @@ const getProcessStateComponent = (state: PROCESS_STATE) => { }; export default function PromptResult(props: Props) { - const { processState } = props; + const { processState, data } = props; - const StateComponent = getProcessStateComponent(processState.currentState); + const StateComponent = getProcessStateComponent( + processState.currentState, + data, + ); if (StateComponent === null) return null;