Repository navigation
fix: 追问时不再先闪出上一轮的推荐问题 [skip eval] - #434
Merged
Merged
Conversation
推荐区挂在最后一条 assistant 上(ChatMessageList.lastAssistantIndex), 但数据源 getLastAssistantMessage 只取有正文的 assistant。流式期间本轮正文 在 streamSlice、消息 content 为空,于是退回上一轮,把上一轮推荐挂到本轮 下面;封口写入正文后再换成本轮推荐,表现为闪一下换一批。两处改为同源。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
现象
多轮对话中,回答结束时推荐区会先显示一组问题,闪一下后换成另一组。
根因
ChatMessageList.lastAssistantIndex决定:取最后一条 assistant,不看是否有正文。useSuggestedQuestions.getLastAssistantMessage:只取content.length > 0的 assistant。content为[],要等done时由doCompleteStream写入。因此数据源退回到上一轮回答。suggested_questions_pending到达后,推荐区([skip eval] fix: 推荐问题在流结束前收到 ready 时不再隐藏 #389 起流结束前即显示)先展示上一轮的推荐;封口写入正文后,数据源切回本轮,换成本轮推荐,表现为闪一下。改动
getLastAssistantMessage与lastAssistantIndex改为同源:最后一条消息是 assistant 时取它,不再按正文过滤。本轮推荐未到时显示占位,到达后直接展示。验证
vitest related:2 个文件 126 个用例通过;eslint 通过;tsc 与基线相比无新增错误。🤖 Generated with Claude Code