修复: flushCurrentText 向前找非 isError 占位(UX-260619-06 MED-1)
CR-12 审查 🟡 MED-1:AiStreamRetry→AiError 链路,末条 isError 气泡致 flush 跳过,
占位 assistant(部分回复)未填充,currentText 清空丢。
修:flushCurrentText 从末尾向前找第一个非 isError assistant 写入
(跳 AiStreamRetry 错误气泡,写其前占位)。
vue-tsc EXIT 0
This commit is contained in:
@@ -129,9 +129,16 @@ export function friendlyError(raw: string): string {
|
||||
/** 把流式累积的 currentText 回填到最后一条 assistant 消息(AiAgentRound/AiCompleted/AiError 收尾共用) */
|
||||
export function flushCurrentText() {
|
||||
if (!state.currentText) return
|
||||
const last = state.messages[state.messages.length - 1]
|
||||
// 跳过 isError 气泡(AiStreamRetry 错误气泡):避免部分回复覆盖错误提示
|
||||
if (last && last.role === 'assistant' && !last.isError) last.content = state.currentText
|
||||
// 从末尾向前找最后一个非 isError assistant 气泡写入。跳过 AiStreamRetry 错误气泡
|
||||
// (isError),写入其前的占位 assistant,保留部分回复(UX-260619-06 MED-1)。
|
||||
for (let i = state.messages.length - 1; i >= 0; i--) {
|
||||
const m = state.messages[i]
|
||||
if (m.role !== 'assistant') break // 遇 user/tool 停,占位不在其后
|
||||
if (!m.isError) {
|
||||
m.content = state.currentText
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** token 用量展示开关(读 appSettings,与 Settings.vue 共享 key `df-show-token-usage`) */
|
||||
|
||||
Reference in New Issue
Block a user