Fix/remote duplicate message - #2667
Open
kilvyken wants to merge 2 commits into
Open
Conversation
…e final message 在手机客户端问答时,会多输出一次同样的回答
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.
问题
通过 mobile-web(手机扫码登录)控制桌面端 agent 时,每次回复完成后,同一条回复会显示为两个相同内容的气泡。
根因
桌面端
remote\_persisted\_poll\_response在 turn 已结束(status == "completed")且持久化快照(message\_snapshot)即将携带 final assistant 消息时,仍会返回一个 completed 状态的active\_turn快照。mobile-web 端对非 active 的activeTurn无条件渲染,导致它与消息列表中的{turn\_id}\_assistant持久化消息重复显示。修改
src/crates/services/services-integrations/src/remote\_connect.rsremote\_persisted\_poll\_response:当status == "completed"且message\_snapshot.is\_some()时,不再返回 completed active_turn,改为finalize\_completed\_turn()+None(final 消息已由快照送达,快照不再冗余);无快照时保留原有兜底行为。settled\_turn\_with\_already\_synced\_final\_message\_does\_not\_echo\_active\_turn。src/mobile-web/src/pages/ChatPage.tsxisActiveTurnCoveredByMessages:渲染 activeTurn 前检查消息列表是否已包含该 turn 的 final 消息(id 匹配{turn\_id}\_assistant或文本相同),包含则隐藏。判据与鸿蒙端isPersistedAssistantDuplicate对齐;active 流式中不受影响。测试
settled\_turn\_with\_already\_synced\_final\_message\_does\_not\_echo\_active\_turnactive\_turn必须为None,且 snapshot 正常送达。cargo test -p services-integrations