From 82ac6c160f77c338c5581d4b21f0b73df61f7e99 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 15 Sep 2026 19:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E8=A1=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=8A=A8=E8=AF=8D=E5=89=8D=E7=BC=80=EF=BC=8C?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=97=E6=94=B9=E4=B8=BA=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=B8=AD/=E5=B7=B2=E6=89=A7=E8=A1=8C/=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - toolCallGroupPresentation:行文案不再拼 已运行/已编辑/已调用 前缀,只留工具摘要(状态由行尾状态列表达,避免重复) - toolCallGroupPresentation:汇总文案在回合进行中只说数量(如 2 个命令),落定后才加 已执行 - ToolCallGroup:行尾状态固定显示 执行中(仅正在跑的回合)/ 已执行 / 失败,不再出现空状态 --- .../project-workspace/ToolCallGroup.tsx | 15 +++++------- .../toolCallGroupPresentation.ts | 23 ++++++++++++------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/ToolCallGroup.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/ToolCallGroup.tsx index 11379892a..e11e4b5b1 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/ToolCallGroup.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/ToolCallGroup.tsx @@ -69,7 +69,7 @@ export function ToolCallGroup({ const orderedCalls = [...calls].sort( (left, right) => left.startedAt - right.startedAt, ); - const summary = toolCallGroupSummary(orderedCalls); + const summary = toolCallGroupSummary(orderedCalls, running); const startedAt = orderedCalls.find((call) => call.startedAt > 0)?.startedAt ?? 0; // 进行中:用"现在 - 最早开始时间"(会随 tick 每秒变);已结束:用快照里的 @@ -174,15 +174,12 @@ function ToolCallRow({ const durationText = formatToolCallDuration(durationMs); // "执行中"只在**正在跑的回合**里显示;已结束的回合里残留的 running 快照按已完成处理, // 否则用户会看到一条永远停在"执行中"的记录。 - const statusText = active - ? call.status === 'running' - ? '执行中' - : call.status === 'failed' - ? '失败' - : '' - : call.status === 'failed' + const statusText = + call.status === 'failed' ? '失败' - : ''; + : active && call.status === 'running' + ? '执行中' + : '已执行'; const rowLabel = [ text, statusText, diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/toolCallGroupPresentation.ts b/apps/ai-game-creator-shell/src/features/project-workspace/toolCallGroupPresentation.ts index 9c928252a..a2a96ab88 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/toolCallGroupPresentation.ts +++ b/apps/ai-game-creator-shell/src/features/project-workspace/toolCallGroupPresentation.ts @@ -31,7 +31,7 @@ const TOOL_CALL_KIND_LABELS: Record = { }; /** 行文案动词:`已运行 {summary}` / `已编辑 {summary}` / …,`context_compaction` 不带 summary。 */ -const TOOL_CALL_ROW_VERBS: Partial< +export const TOOL_CALL_ROW_VERBS: Partial< Record > = { command: '已运行', @@ -42,7 +42,10 @@ const TOOL_CALL_ROW_VERBS: Partial< }; /** 汇总文案:按 kind 计数、固定顺序拼成 `已执行 5 个命令、2 个文件变更`;空集合返回空串。 */ -export function toolCallGroupSummary(calls: GameCreatorDirectToolCall[]) { +export function toolCallGroupSummary( + calls: GameCreatorDirectToolCall[], + running = false, +) { const counts = new Map(); for (const call of calls) { counts.set(call.kind, (counts.get(call.kind) ?? 0) + 1); @@ -66,17 +69,21 @@ export function toolCallGroupSummary(calls: GameCreatorDirectToolCall[]) { for (const kind of [...counts.keys()]) { append(kind); } - return parts.length > 0 ? `已执行 ${parts.join('、')}` : ''; + return parts.length > 0 + ? running + ? parts.join('、') + : `已执行 ${parts.join('、')}` + : ''; } -/** 一行工具的文案:`已运行 npm run build` / `已整理上下文`。 */ +/** 一行工具的文案:只用工具本身的摘要(不带"已运行"这类动词前缀),状态由行尾状态列表达。 */ export function toolCallRowText(call: GameCreatorDirectToolCall) { + // 行首不再写"已运行/已编辑"这类动词前缀:命令状态由行尾的状态列表达 + // (执行中 / 已执行 / 失败),前缀会和它重复。 if (call.kind === 'context_compaction') { - return '已整理上下文'; + return '整理上下文'; } - const summary = toolCallRowSummary(call); - const verb = TOOL_CALL_ROW_VERBS[call.kind] ?? '已执行'; - return summary ? `${verb} ${summary}` : verb; + return toolCallRowSummary(call); } function toolCallRowSummary(call: GameCreatorDirectToolCall) {