[Bug] SSE 流式降级导致重复空消息 #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题描述
在 AgentChat.vue 的 sendMessage 函数中,当 SSE 流式请求成功后 (HTTP 200),会先 push 一个占位消息到 messages 数组 (第 432 行),然后逐步通过流事件更新内容。但当流读取中途失败 (如超时、网络错误) 时,catch 块 (第 506 行) 将 usedStreaming 设为 false,接着 fallback POST (第 518 行) 会额外 push 一条完整消息。
结果是消息列表中出现两条 assistant 消息:一条空占位消息 + 一条正常回复。
复现步骤
涉及文件
frontend/src/views/AgentChat.vue:424-527
预期行为
流式失败降级到 POST 时,应移除已 push 的占位消息,用 fallback POST 的结果替代。
严重程度
高 - 用户可见的数据错误