From 34adb1cc0a4515a59f44b49a327ace6fdb51cf04 Mon Sep 17 00:00:00 2001 From: coso Date: Sat, 21 Mar 2026 00:14:09 +0800 Subject: [PATCH] fix: refine team selector panel --- RELEASE_NOTES.md | 1 + .../Inputbar/components/TeamSelector.tsx | 2 +- .../Inputbar/components/TeamSelectorPanel.tsx | 800 +++++++++++------- .../chat/hooks/useAsterAgentChat.test.tsx | 70 ++ 4 files changed, 573 insertions(+), 300 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 28fd043d3..015f5db03 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -4,6 +4,7 @@ - **Team Workspace 正式成型**:Agent 聊天页新增 Team Workspace 主工作台、建议栏、Dock 与 Home Shell,围绕多代理协作视图重组交互结构 - **Team 配置与发布稳定性收尾**:补齐 Team Selector 自定义 Team 配置链路、当前 Team 展示与相关测试,并修复通知、Provider Runtime 与前端类型兼容问题,确保 `v0.92.0` 可稳定构建发布 +- **Team Selector 交互继续打磨**:扩展 Team 选择弹窗宽度,重构为模板列表 + 详情检查器布局,并补充执行会话失效后的恢复测试,减少工作台切换与继续执行时的状态错乱 - **运行态与工具可视化增强**:`ToolCallDisplay`、Harness 状态面板、Runtime Strip、执行日志与子代理时间线继续增强,工具调用与运行态反馈更完整 - **Aster Agent 运行时继续收口**:Rust 侧补齐 session store、subagent control、agent tools inventory / execution、runtime queue 及命令桥接,统一现役 Agent Runtime 路径 - **治理与测试基建升级**:本地校验脚本、命令契约检查、workspace smoke 与治理报告继续完善,发布前自检链路更清晰 diff --git a/src/components/agent/chat/components/Inputbar/components/TeamSelector.tsx b/src/components/agent/chat/components/Inputbar/components/TeamSelector.tsx index e0f6d385e..ef4734412 100644 --- a/src/components/agent/chat/components/Inputbar/components/TeamSelector.tsx +++ b/src/components/agent/chat/components/Inputbar/components/TeamSelector.tsx @@ -78,7 +78,7 @@ export const TeamSelector: React.FC = ({ - + {open ? ( = ({ recommendedTeam && selectedTeam?.id === recommendedTeam.id, ); - return ( -
-
-
-
-
- TEAM 配置 -
-
- 只在当前任务适合拆分协作时,为主代理提供团队结构参考。 -
-
- {selectedTeam ? ( - - ) : null} -
- {selectedTeam ? ( -
-
- - 当前已选 Team -
-
- {selectedTeam.label} -
- {currentSelectionSummary ? ( -
- {currentSelectionSummary} -
- ) : null} -
- ) : null} -
+ const inspectorTeam = useMemo(() => { + const teamById = new Map(); -
- setQuery(event.target.value)} - placeholder="搜索 Team、角色或职责" - className="border-slate-200 bg-white" - /> -
- - {selectedTeam ? ( + for (const candidate of [ + selectedTeam, + recommendedTeam, + ...filteredCustomTeams, + ...builtinTeams, + ]) { + if (candidate && !teamById.has(candidate.id)) { + teamById.set(candidate.id, candidate); + } + } + + const preferredId = + expandedTeamId || + selectedTeam?.id || + recommendedTeam?.id || + filteredCustomTeams[0]?.id || + builtinTeams[0]?.id; + + if (!preferredId) { + return null; + } + + return teamById.get(preferredId) || null; + }, [ + builtinTeams, + expandedTeamId, + filteredCustomTeams, + recommendedTeam, + selectedTeam, + ]); + + const renderInspectorPanel = () => { + if (!inspectorTeam) { + return ( +
+ 还没有可预览的 Team。你可以从左侧模板中查看详情,或新建一个自定义 Team。 +
+ ); + } + + const isCurrent = selectedTeam?.id === inspectorTeam.id; + const isCustom = inspectorTeam.source === "custom"; + const badgeLabel = + inspectorTeam.id === recommendedTeam?.id + ? "按任务推荐" + : isCustom + ? "自定义" + : "系统模板"; + + return ( +
+
+
+
+ + {inspectorTeam.label} + + + {badgeLabel} + + {isCurrent ? ( + + + 当前选择 + + ) : null} +
+
+ {inspectorTeam.description || "该 Team 将作为主代理拆分子任务时的协作参考。"} +
+
+
+ {!isCurrent ? ( + + ) : null} - ) : null} + {isCustom ? ( + + ) : null} +
- {recommendedTeam ? ( -
-
- - 推荐 Team +
+
+ TEAM 概览 +
+
+ {buildTeamDefinitionSummary(inspectorTeam)} +
+
+ +
+
+ 角色分工 +
+
+ {inspectorTeam.roles.map((role) => ( +
+
+ + {role.label} + + {role.profileId ? ( + + 画像 ·{" "} + {getBuiltinTeamProfileOption(role.profileId)?.label || + role.profileId} + + ) : null} + {role.roleKey ? ( + + Role · {role.roleKey} + + ) : null} +
+
+ {role.summary} +
+ {role.skillIds?.length ? ( +
+ {role.skillIds.map((skillId) => ( + + 技能 ·{" "} + {getBuiltinTeamSkillOption(skillId)?.label || skillId} + + ))} +
+ ) : null} +
+ ))} +
+
+ + {isCustom ? ( +
+ +
+ ) : null} +
+ ); + }; + + const renderDraftEditor = () => { + if (!draft) { + return renderInspectorPanel(); + } + + return ( +
+
+
+
+ {draft.id ? "编辑自定义 Team" : "新建自定义 Team"}
- handleSelect(recommendedTeam)} - onToggleDetail={() => - setExpandedTeamId((currentId) => - currentId === recommendedTeam.id ? null : recommendedTeam.id, +
+ 在右侧完整配置 Team 角色、画像和技能,左侧列表用于浏览与切换模板。 +
+
+ +
+ +
+
+ + + setDraft((current) => + current + ? { + ...current, + label: event.target.value, + } + : current, ) } - onCopy={() => handleStartCreate(recommendedTeam)} + placeholder="例如:前端联调团队" + className="border-slate-200 bg-white" /> -
- ) : null} +
-
-
-
- 我的 Team -
+
+ +