mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 02:20:10 +08:00
fix: timer stop (#5914)
This commit is contained in:
parent
6a48b76c5e
commit
044420dd7e
@ -89,7 +89,8 @@ const ThinkingBlock: React.FC<Props> = ({ block }) => {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (intervalId.current) {
|
if (intervalId.current) {
|
||||||
window.clearInterval(intervalId.current)
|
clearInterval(intervalId.current)
|
||||||
|
intervalId.current = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [isThinking])
|
}, [isThinking])
|
||||||
|
|||||||
@ -348,6 +348,7 @@ const fetchAndProcessAssistantResponseImpl = async (
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTextComplete: async (finalText) => {
|
onTextComplete: async (finalText) => {
|
||||||
|
cancelThrottledBlockUpdate()
|
||||||
if (lastBlockType === MessageBlockType.MAIN_TEXT && lastBlockId) {
|
if (lastBlockType === MessageBlockType.MAIN_TEXT && lastBlockId) {
|
||||||
const changes = {
|
const changes = {
|
||||||
content: finalText,
|
content: finalText,
|
||||||
@ -405,6 +406,8 @@ const fetchAndProcessAssistantResponseImpl = async (
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onThinkingComplete: (finalText, final_thinking_millsec) => {
|
onThinkingComplete: (finalText, final_thinking_millsec) => {
|
||||||
|
cancelThrottledBlockUpdate()
|
||||||
|
|
||||||
if (lastBlockType === MessageBlockType.THINKING && lastBlockId) {
|
if (lastBlockType === MessageBlockType.THINKING && lastBlockId) {
|
||||||
const changes = {
|
const changes = {
|
||||||
type: MessageBlockType.THINKING,
|
type: MessageBlockType.THINKING,
|
||||||
@ -446,6 +449,7 @@ const fetchAndProcessAssistantResponseImpl = async (
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onToolCallComplete: (toolResponse: MCPToolResponse) => {
|
onToolCallComplete: (toolResponse: MCPToolResponse) => {
|
||||||
|
cancelThrottledBlockUpdate()
|
||||||
const existingBlockId = toolCallIdToBlockIdMap.get(toolResponse.id)
|
const existingBlockId = toolCallIdToBlockIdMap.get(toolResponse.id)
|
||||||
if (toolResponse.status === 'done' || toolResponse.status === 'error') {
|
if (toolResponse.status === 'done' || toolResponse.status === 'error') {
|
||||||
if (!existingBlockId) {
|
if (!existingBlockId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user