fix(agent): 修复工具也变成在流式输出的问题

This commit is contained in:
肖泽涛 2026-02-25 19:09:04 +08:00
parent 85480dbdc0
commit b0f21309f7

View File

@ -825,7 +825,10 @@ const enqueueLoadingChunkForTyping = (threadId, chunk) => {
} }
const msg = chunk.msg || {} const msg = chunk.msg || {}
const contentChars = splitChars(msg.content) const msgType = String(msg.type || '').toLowerCase()
const isToolMessage = msgType === 'tool' || msgType.includes('tool')
const streamText = typeof chunk.response === 'string' ? chunk.response : ''
const contentChars = !isToolMessage ? splitChars(streamText) : []
if (contentChars.length === 0) { if (contentChars.length === 0) {
typingChunkQueue.push({ threadId, chunk, isChar: false }) typingChunkQueue.push({ threadId, chunk, isChar: false })
scheduleTypingRender() scheduleTypingRender()
@ -838,6 +841,7 @@ const enqueueLoadingChunkForTyping = (threadId, chunk) => {
isChar: true, isChar: true,
chunk: { chunk: {
...chunk, ...chunk,
response: char,
msg: { msg: {
...msg, ...msg,
content: char content: char