Commit 5f2a40d6 authored by Joel's avatar Joel

fix: not show loading

parent 9be4b804
...@@ -161,7 +161,7 @@ const Chat: FC<IChatProps> = ({ ...@@ -161,7 +161,7 @@ const Chat: FC<IChatProps> = ({
if (item.isAnswer) { if (item.isAnswer) {
const isLast = item.id === chatList[chatList.length - 1].id const isLast = item.id === chatList[chatList.length - 1].id
const thoughts = item.agent_thoughts?.filter(item => item.thought !== '[DONE]') const thoughts = item.agent_thoughts?.filter(item => item.thought !== '[DONE]')
const isThinking = item.agent_thoughts && item.agent_thoughts?.length > 0 && !item.agent_thoughts.find(item => item.thought !== '[DONE]') const isThinking = item.agent_thoughts && item.agent_thoughts?.length > 0 && !item.agent_thoughts.some(item => item.thought === '[DONE]')
return <Answer return <Answer
key={item.id} key={item.id}
item={item} item={item}
......
...@@ -70,7 +70,7 @@ const Thought: FC<IThoughtProps> = ({ ...@@ -70,7 +70,7 @@ const Thought: FC<IThoughtProps> = ({
<div className='flex items-center h-6 space-x-1 cursor-pointer' onClick={() => setIsShowDetail(!isShowDetail)} > <div className='flex items-center h-6 space-x-1 cursor-pointer' onClick={() => setIsShowDetail(!isShowDetail)} >
{!isThinking ? <ThoughtList /> : <div className='animate-spin'><LodingIcon /></div>} {!isThinking ? <ThoughtList /> : <div className='animate-spin'><LodingIcon /></div>}
<div dangerouslySetInnerHTML= {{ <div dangerouslySetInnerHTML= {{
__html: isThinking ? getThoughtText(list[0]) : (t(`explore.universalChat.thought.${isShowDetail ? 'hide' : 'show'}`) + t('explore.universalChat.thought.processOfThought')), __html: isThinking ? getThoughtText(list[list.length - 1]) : (t(`explore.universalChat.thought.${isShowDetail ? 'hide' : 'show'}`) + t('explore.universalChat.thought.processOfThought')),
}} }}
></div> ></div>
<ChevronDown className={isShowDetail ? 'rotate-180' : '' } /> <ChevronDown className={isShowDetail ? 'rotate-180' : '' } />
......
...@@ -510,10 +510,8 @@ const Main: FC<IMainProps> = () => { ...@@ -510,10 +510,8 @@ const Main: FC<IMainProps> = () => {
} }
}, },
onThought(thought) { onThought(thought) {
if (thought.thought === '[DONE]')
return
responseItem.id = thought.message_id;
// thought finished then start to return message. Warning: use push agent_thoughts.push would caused problem when the thought is more then 2 // thought finished then start to return message. Warning: use push agent_thoughts.push would caused problem when the thought is more then 2
responseItem.id = thought.message_id;
(responseItem as any).agent_thoughts = [...(responseItem as any).agent_thoughts, thought] // .push(thought) (responseItem as any).agent_thoughts = [...(responseItem as any).agent_thoughts, thought] // .push(thought)
const newListWithAnswer = produce( const newListWithAnswer = produce(
getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId), getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment