From b2b3424b05c0f0c45fcaac32a370f022ef61bf11 Mon Sep 17 00:00:00 2001 From: Mark Henderson Date: Fri, 27 Feb 2026 18:15:50 -0800 Subject: [PATCH] fix: clean up orchestrator chat UX - Tool call names now show human-readable labels ("Dispatched agent" instead of "spawn_agent"), deduped if called multiple times - Model label only shown when a real value is returned; "unknown" and null are suppressed; model names shortened (GLM-5, Gemini) Made-with: Cursor --- .../projects/[projectId]/agent-chat/route.ts | 2 +- components/OrchestratorChat.tsx | 38 ++++++++++++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/api/projects/[projectId]/agent-chat/route.ts b/app/api/projects/[projectId]/agent-chat/route.ts index c449ae5..1171c02 100644 --- a/app/api/projects/[projectId]/agent-chat/route.ts +++ b/app/api/projects/[projectId]/agent-chat/route.ts @@ -74,7 +74,7 @@ export async function POST( reasoning: data.reasoning ?? null, toolCalls: data.toolCalls ?? [], turns: data.turns ?? 0, - model: data.model ?? "unknown", + model: data.model || null, sessionId, }); } catch (err) { diff --git a/components/OrchestratorChat.tsx b/components/OrchestratorChat.tsx index 46cb9d3..c098af8 100644 --- a/components/OrchestratorChat.tsx +++ b/components/OrchestratorChat.tsx @@ -37,6 +37,29 @@ interface OrchestratorChatProps { placeholder?: string; } +// --------------------------------------------------------------------------- +// Friendly labels for tool call names +// --------------------------------------------------------------------------- + +const TOOL_LABELS: Record = { + spawn_agent: "Dispatched agent", + get_job_status: "Checked job", + list_repos: "Listed repos", + list_all_issues: "Checked issues", + list_all_apps: "Checked deployments", + get_app_status: "Checked app status", + read_repo_file: "Read file", + deploy_app: "Triggered deploy", + gitea_create_issue: "Created issue", + gitea_list_issues: "Listed issues", + gitea_close_issue: "Closed issue", + gitea_comment_issue: "Added comment", +}; + +function friendlyToolName(raw: string): string { + return TOOL_LABELS[raw] ?? raw.replace(/_/g, " "); +} + // --------------------------------------------------------------------------- // Suggestion chips shown before the first message // --------------------------------------------------------------------------- @@ -88,13 +111,14 @@ function MessageBubble({ msg }: { msg: Message }) {
{msg.toolCalls && msg.toolCalls.length > 0 && (
- {msg.toolCalls.map((t, i) => ( + {/* Deduplicate tool calls before rendering */} + {[...new Set(msg.toolCalls)].map((t, i) => ( - - {t} + + {friendlyToolName(t)} ))}
@@ -109,8 +133,10 @@ function MessageBubble({ msg }: { msg: Message }) { {showReasoning ? : } )} - {msg.model && ( - {msg.model} + {msg.model && msg.model !== "unknown" && ( + + {msg.model.includes("glm") ? "GLM-5" : msg.model.includes("gemini") ? "Gemini" : msg.model} + )}
)}