From d2fee8358acb58b10315ee55665fd0bb22da1a78 Mon Sep 17 00:00:00 2001 From: ddCat <2695092045@qq.com> Date: Mon, 14 Sep 2026 19:59:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(agent):=20=E6=8A=98=E5=8F=A0=E5=A4=A7?= =?UTF-8?q?=E9=87=8F=E7=94=BB=E5=B8=83=E8=8A=82=E7=82=B9=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/canvas-cloud-agent-chat-ui.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/src/components/canvas/canvas-cloud-agent-chat-ui.tsx b/web/src/components/canvas/canvas-cloud-agent-chat-ui.tsx index 35a57e31b..508ec3905 100644 --- a/web/src/components/canvas/canvas-cloud-agent-chat-ui.tsx +++ b/web/src/components/canvas/canvas-cloud-agent-chat-ui.tsx @@ -273,13 +273,17 @@ export function AgentToolCard({ title, text, detail, theme, references = [], onF const toolName = agentToolName(title, detail); const summary = friendlyAgentToolSummary(toolName, text, detail); const actions = agentCanvasActions(toolName, detail, references); + const visibleActions = actions.slice(0, 8); + const readNodeCount = toolName === "canvas_get_state" && !state.isError ? readCanvasNodeCount(detail) : 0; + const hiddenReadNodeCount = Math.max(0, readNodeCount - visibleActions.length); const conciseError = text.length > 180 ? `${text.slice(0, 180)}…` : text; return (
{actions.length ?
- {actions.map((action) => )} + {visibleActions.map((action) => )} + {hiddenReadNodeCount > 0 ? 已读取 {readNodeCount} 个节点,已折叠其余 {hiddenReadNodeCount} 个 : null}
: summary} {state.isError && actions.length ? {summary} : null} {state.isError && text && text !== summary ? {conciseError} : null} @@ -744,3 +748,9 @@ function agentToolName(title: string, detail?: unknown) { function objectField(value: unknown, key: string) { return value && typeof value === "object" ? (value as Record)[key] : undefined; } + +function readCanvasNodeCount(detail: unknown) { + const result = objectField(detail, "result"); + const nodes = objectField(result, "nodes"); + return Array.isArray(nodes) ? nodes.length : 0; +}