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 = {
isShowSpeechToText?: boolean
answerIconClassName?: string
isShowConfigElem?: boolean
isThoughting?: boolean
dataSets?: DataSet[]
}
......@@ -183,7 +182,8 @@ const Chat: FC<IChatProps> = ({
{
!isHideSendInput && (
<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'>
<Button className='flex items-center space-x-1 bg-white' onClick={() => abortResponsing?.()}>
{stopIcon}
......
......@@ -466,7 +466,8 @@ const Main: FC<IMainProps> = () => {
isAnswer: true,
}
let tempNewConversationId = ''
const prevTempNewConversationId = getCurrConversationId() || '-1'
let tempNewConversationId = prevTempNewConversationId
setHasStopResponded(false)
setResponsingTrue()
......@@ -485,9 +486,8 @@ const Main: FC<IMainProps> = () => {
tempNewConversationId = newConversationId
setMessageTaskId(taskId)
// has switched to other conversation
if (tempNewConversationId !== getCurrConversationId()) {
if (prevTempNewConversationId !== getCurrConversationId()) {
setIsResponsingConCurrCon(false)
return
}
......@@ -530,7 +530,8 @@ const Main: FC<IMainProps> = () => {
responseItem.id = thought.message_id;
(responseItem as any).agent_thoughts = [...(responseItem as any).agent_thoughts, thought] // .push(thought)
// has switched to other conversation
if (tempNewConversationId !== getCurrConversationId()) {
if (prevTempNewConversationId !== getCurrConversationId()) {
setIsResponsingConCurrCon(false)
return
}
......
......@@ -461,8 +461,8 @@ const Main: FC<IMainProps> = ({
content: '',
isAnswer: true,
}
let tempNewConversationId = ''
const prevTempNewConversationId = getCurrConversationId() || '-1'
let tempNewConversationId = prevTempNewConversationId
setHasStopResponded(false)
setResponsingTrue()
......@@ -480,7 +480,7 @@ const Main: FC<IMainProps> = ({
setMessageTaskId(taskId)
// has switched to other conversation
if (tempNewConversationId !== getCurrConversationId()) {
if (prevTempNewConversationId !== getCurrConversationId()) {
setIsResponsingConCurrCon(false)
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