From ab9e2a04201972a581c6619f599e5e3d4d837e76 Mon Sep 17 00:00:00 2001 From: Huarch Date: Wed, 10 Jun 2026 17:05:37 +0800 Subject: [PATCH] fix(chat): show only chart artifacts --- src/components/chat/AgentTurn.tsx | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/chat/AgentTurn.tsx b/src/components/chat/AgentTurn.tsx index 92c1150..2d69838 100644 --- a/src/components/chat/AgentTurn.tsx +++ b/src/components/chat/AgentTurn.tsx @@ -25,7 +25,6 @@ import { import type { Message, SpeechState } from "./GlobalChatbox.types"; import { stripMarkdown } from "./GlobalChatbox.utils"; import { AgentProgressTimeline } from "./AgentProgressTimeline"; -import { AgentArtifactPanel } from "./AgentArtifactPanel"; import { ChatInlineChart } from "./ChatInlineChart"; import { ChatToolCallBlock } from "./ChatToolCallBlock"; import { MarkdownBlock, normalizeClipboardText } from "./AgentMarkdownBlock"; @@ -99,11 +98,11 @@ export const AgentTurn = React.memo( (segment.toolCall.tool === "chart" || segment.toolCall.tool === "show_chart"), ); - const visibleArtifacts = useMemo( + const visibleChartArtifacts = useMemo( () => hasInlineChart - ? message.artifacts?.filter((artifact) => artifact.kind !== "chart") - : message.artifacts, + ? [] + : (message.artifacts?.filter((artifact) => artifact.kind === "chart") ?? []), [hasInlineChart, message.artifacts], ); @@ -290,9 +289,25 @@ export const AgentTurn = React.memo( - {visibleArtifacts?.length ? ( - - ) : null} + {visibleChartArtifacts.map((artifact) => ( + + ))}