fix(frontend): preserve streamed message prefix on reconnect#3318
Open
LittleChenLiya wants to merge 1 commit into
Open
fix(frontend): preserve streamed message prefix on reconnect#3318LittleChenLiya wants to merge 1 commit into
LittleChenLiya wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题原因
流式回答过程中切换到其他对话再返回时,前端会同时合并已持久化的历史消息和重连后的 live stream 消息。对于同一个 AI 消息 ID,现有合并逻辑总是让 live stream 消息覆盖历史消息;如果重连后的流只包含后续增量文本,已显示并持久化的前缀就会在流式过程中从页面上消失。
修改内容
关联 issue
Closes #3279
Problem Cause
When users leave a chat during streaming and then return, the frontend merges persisted history messages with the reconnected live stream messages. For the same AI message ID, the previous merge logic always let the live stream message replace the history message. If the reconnected stream only contains later delta text, the already rendered and persisted prefix disappears from the page while streaming continues.
Changes
Related Issue
Closes #3279