修复: 流式正文被轮次折叠吞掉(真根因)
- 根因: renderItems 完成轮分桶把整轮含正文折进轨迹卡且默认收起,thinkPlainText 又 reasoning_content||content 把正文当思考塞单行 pill → 流式期间可见、轮末随卡消失(现象=气泡清空回到等待) - 修复: 过程轮有正文的各成常显气泡(剥 toolCalls,工具卡仍归轨迹卡不重复);思考 pill 只认 reasoning_content - 历次修补(40c4a21/4652112/524120b/BUG-260624-01/flush guard)都在状态清空层,未碰渲染折叠层 → 故无效;看板 911 留痕教训 - 验收: vue-tsc --noEmit EXIT 0
This commit is contained in:
@@ -946,7 +946,9 @@ const { ids: expandedThinkIds, toggle: toggleThink } = useToggleSet()
|
||||
/** 轮次思考纯文本:reasoning_content 优先(DeepSeek/Anthropic thinking 同通道),content 兜底;
|
||||
* 压平 markdown 换行;两者皆空回退「过程记录」占位(纯工具轮也有锚点) */
|
||||
function thinkPlainText(m: AiMessage): string {
|
||||
const src = m.reasoning_content || m.content || ''
|
||||
// 只承载「推理内容」(正文不折叠,2026-10-10):原 `reasoning_content || content` 会把模型正文
|
||||
// 也当思考吞进单行 pill——正文改由常显气泡渲染(见 renderItems),此处只认 reasoning_content。
|
||||
const src = m.reasoning_content || ''
|
||||
return src.replace(/\s+/g, ' ').trim()
|
||||
}
|
||||
/** pill 单行文本:纯文本截断 + 空轮回退文案(title 承载全文,此处只管单行) */
|
||||
@@ -1126,6 +1128,16 @@ const renderItems = computed<RenderItem[]>(() => {
|
||||
} else {
|
||||
pushTimeSepIfNeeded(items, finalMsg.timestamp)
|
||||
}
|
||||
// 正文不折叠(2026-10-10 根因修复):此前整轮(含模型正文)折进轨迹卡默认收起 → 流式期间
|
||||
// 能看到正文、轮末正文随卡收起,用户表象为「气泡被清空/进入等待」,历次在 flush/清空/骨架层
|
||||
// 修补均无效。现把过程消息里**有正文**的各成一个常显气泡(剥掉 toolCalls——工具卡仍归轨迹卡,
|
||||
// 不重复渲染),轨迹卡只折叠工具步骤与思考。
|
||||
for (const m of traceMsgs) {
|
||||
const c = m.content
|
||||
if (m.role === 'assistant' && c && c.trim() && !isToolResultJson(c)) {
|
||||
items.push({ kind: 'msg', key: 'm-' + m.id, msg: { ...m, toolCalls: undefined } })
|
||||
}
|
||||
}
|
||||
items.push({ kind: 'msg', key: 'm-' + finalMsg.id, msg: finalMsg, final: true })
|
||||
lastMsgTs = finalMsg.timestamp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user