fix(cowork): 切换 Agent 时自动清空主页输入框内容#1707
Open
gongzhi-netease wants to merge 2 commits into
Open
Conversation
When switching agents, the draft prompt and attachments in the home input box were not cleared, causing residual content from the previous agent to persist. This could lead to semantic mismatch when the user submits to a different agent.
|
This pull request has been inactive for 30 days. It will be automatically closed in 14 days unless there is new activity. If you're still working on this, please leave a comment or push new commits to keep it open. Thank you! |
Author
|
Keep the open state. |
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.
问题描述
在主页输入框输入内容后,切换到另一个 Agent,输入框中的文字和附件没有被自动清空。
复现步骤:
mainAgent 主页输入框输入内容(如 "111")Architect或其他 Agent根因分析:
输入框草稿存储在 Redux
draftPrompts['__home__']中,所有 Agent 的主页共享同一个 key'__home__'。switchAgent方法中只调用了clearCurrentSession()清空会话状态,没有清空草稿内容。此外,CoworkPromptInput组件的本地 state 同步逻辑仅在draftKey变化时触发,而切换 Agent 前后draftKey始终是'__home__',导致即使 Redux 被清空,组件本地的输入值也不会更新。影响: