Commit d4ece25c authored by Joel's avatar Joel

fix: new conversation not steaming and thinking can not be stopped

parent b2160c71
...@@ -49,7 +49,6 @@ export type IChatProps = { ...@@ -49,7 +49,6 @@ export type IChatProps = {
isShowSpeechToText?: boolean isShowSpeechToText?: boolean
answerIconClassName?: string answerIconClassName?: string
isShowConfigElem?: boolean isShowConfigElem?: boolean
isThoughting?: boolean
dataSets?: DataSet[] dataSets?: DataSet[]
} }
...@@ -183,7 +182,8 @@ const Chat: FC<IChatProps> = ({ ...@@ -183,7 +182,8 @@ const Chat: FC<IChatProps> = ({
{ {
!isHideSendInput && ( !isHideSendInput && (
<div className={cn(!feedbackDisabled && '!left-3.5 !right-3.5', 'absolute z-10 bottom-0 left-0 right-0')}> <div className={cn(!feedbackDisabled && '!left-3.5 !right-3.5', 'absolute z-10 bottom-0 left-0 right-0')}>
{(isResponsing && canStopResponsing) && ( {/* Thinking is sync and can not be stopped */}
{(isResponsing && canStopResponsing && !!chatList[chatList.length - 1]?.content) && (
<div className='flex justify-center mb-4'> <div className='flex justify-center mb-4'>
<Button className='flex items-center space-x-1 bg-white' onClick={() => abortResponsing?.()}> <Button className='flex items-center space-x-1 bg-white' onClick={() => abortResponsing?.()}>
{stopIcon} {stopIcon}
......
...@@ -466,7 +466,8 @@ const Main: FC<IMainProps> = () => { ...@@ -466,7 +466,8 @@ const Main: FC<IMainProps> = () => {
isAnswer: true, isAnswer: true,
} }
let tempNewConversationId = '' const prevTempNewConversationId = getCurrConversationId() || '-1'
let tempNewConversationId = prevTempNewConversationId
setHasStopResponded(false) setHasStopResponded(false)
setResponsingTrue() setResponsingTrue()
...@@ -485,9 +486,8 @@ const Main: FC<IMainProps> = () => { ...@@ -485,9 +486,8 @@ const Main: FC<IMainProps> = () => {
tempNewConversationId = newConversationId tempNewConversationId = newConversationId
setMessageTaskId(taskId) setMessageTaskId(taskId)
// has switched to other conversation // has switched to other conversation
if (tempNewConversationId !== getCurrConversationId()) { if (prevTempNewConversationId !== getCurrConversationId()) {
setIsResponsingConCurrCon(false) setIsResponsingConCurrCon(false)
return return
} }
...@@ -530,7 +530,8 @@ const Main: FC<IMainProps> = () => { ...@@ -530,7 +530,8 @@ const Main: FC<IMainProps> = () => {
responseItem.id = thought.message_id; 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)
// has switched to other conversation // has switched to other conversation
if (tempNewConversationId !== getCurrConversationId()) {
if (prevTempNewConversationId !== getCurrConversationId()) {
setIsResponsingConCurrCon(false) setIsResponsingConCurrCon(false)
return return
} }
......
...@@ -461,8 +461,8 @@ const Main: FC<IMainProps> = ({ ...@@ -461,8 +461,8 @@ const Main: FC<IMainProps> = ({
content: '', content: '',
isAnswer: true, isAnswer: true,
} }
const prevTempNewConversationId = getCurrConversationId() || '-1'
let tempNewConversationId = '' let tempNewConversationId = prevTempNewConversationId
setHasStopResponded(false) setHasStopResponded(false)
setResponsingTrue() setResponsingTrue()
...@@ -480,7 +480,7 @@ const Main: FC<IMainProps> = ({ ...@@ -480,7 +480,7 @@ const Main: FC<IMainProps> = ({
setMessageTaskId(taskId) setMessageTaskId(taskId)
// has switched to other conversation // has switched to other conversation
if (tempNewConversationId !== getCurrConversationId()) { if (prevTempNewConversationId !== getCurrConversationId()) {
setIsResponsingConCurrCon(false) setIsResponsingConCurrCon(false)
return return
} }
......
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