diff --git a/src/components/chat/AgentTurn.tsx b/src/components/chat/AgentTurn.tsx index 7ed8f89..92c1150 100644 --- a/src/components/chat/AgentTurn.tsx +++ b/src/components/chat/AgentTurn.tsx @@ -25,6 +25,7 @@ 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"; @@ -92,6 +93,19 @@ export const AgentTurn = React.memo( : [{ type: "text", content: answerContent }], [answerContent, isErrorMessage, isUser], ); + const hasInlineChart = contentSegments.some( + (segment) => + segment.type === "tool_call" && + (segment.toolCall.tool === "chart" || + segment.toolCall.tool === "show_chart"), + ); + const visibleArtifacts = useMemo( + () => + hasInlineChart + ? message.artifacts?.filter((artifact) => artifact.kind !== "chart") + : message.artifacts, + [hasInlineChart, message.artifacts], + ); if (isUser) { return ( @@ -275,6 +289,10 @@ export const AgentTurn = React.memo( })} + + {visibleArtifacts?.length ? ( + + ) : null}