feat(chat): 工具组在命令运行期间自动展开,执行结束后自动收起 - #454
Open
pia wants to merge 1 commit into
Open
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.
概述
本 PR 调整助手消息中工具组的默认展示方式:
正在执行哪些操作。
依然保持紧凑。
动机
目前工具组默认始终是折叠的。Agent 在执行命令的过程中,界面上只能
看到一个折叠的汇总 chip,用户无法直接了解当前正在运行什么、已经
运行了多少命令,必须手动展开工具组才能看到内容。
对于较长的任务,Agent 可能会连续运行多个命令,工具组甚至会反复
创建和切换。一直保持折叠会让执行过程变成黑盒,降低用户对 Agent
工作进度的感知。
本次改动的目标是:
行为变化
实现说明
ToolGroupPart增加受控状态机,区分用户手动状态和自动状态:manualOpen记录用户主动展开或收起;autoOpen跟随工具组的运行状态;自动收起。
第二次点击才关闭;
AUTO_CLOSE_DELAY_MS = 1000,由思考块与工具组共用,保持自动收起节奏一致。
边界情况
测试
新增
src/components/message/tool-group-interaction.test.tsx,覆盖以下场景:验证结果:
pnpm testpnpm eslint <changed files>pnpm exec tsc --noEmit文件变更
src/components/message/content-parts-renderer.tsxsrc/components/ai-elements/reasoning.tsxsrc/lib/auto-collapse-timing.ts(新增)src/components/message/tool-group-interaction.test.tsx(新增)影响范围
仅前端消息渲染与交互逻辑,不涉及 Rust 后端、数据库结构、i18n
文案或事件协议。
关联 Issue
无。