diff --git a/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx b/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx index 710bf88dda..3d1cd1bde3 100644 --- a/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx +++ b/studio/frontend/src/components/assistant-ui/tool-ui-render-html.tsx @@ -21,6 +21,7 @@ type RenderHtmlArgs = Record & { const RenderHtmlToolUIImpl: ToolCallMessagePartComponent = ({ args, + result, status, toolCallId, }) => { @@ -46,6 +47,16 @@ const RenderHtmlToolUIImpl: ToolCallMessagePartComponent = ({ ); } + // Surface the backend error when the tool call completed with invalid + // args. Backend success results start with "Rendered HTML artifact"; + // error results start with "Error:". + const errorText = + status?.type === "complete" && + typeof result === "string" && + result.startsWith("Error:") + ? result + : null; + return (
@@ -56,15 +67,17 @@ const RenderHtmlToolUIImpl: ToolCallMessagePartComponent = ({ /> - Generating artifact + {errorText ? "Artifact error" : "Generating artifact"} - HTML artifact + {errorText ?? "HTML artifact"} - - Generating - + {errorText ? null : ( + + Generating + + )}
); diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx index 415aac450c..9a0b449fbc 100644 --- a/studio/frontend/src/features/chat/chat-page.tsx +++ b/studio/frontend/src/features/chat/chat-page.tsx @@ -970,8 +970,12 @@ export function ChatPage(): ReactElement { useEffect(() => { if (view.mode !== "single") return; if (view.threadId || view.newThreadNonce || !selectedArtifact) return; + // view intentionally excludes __LOCALID_ threads (they fall through to + // { mode: "single" } with no threadId/nonce). Don't close an artifact + // whose thread is the currently active local thread. + if (selectedArtifact.threadId && selectedArtifact.threadId === activeThreadId) return; closeArtifactSurface(); - }, [closeArtifactSurface, selectedArtifact, view]); + }, [activeThreadId, closeArtifactSurface, selectedArtifact, view]); const hasActiveModel = Boolean(inferenceParams.checkpoint); const loadNativeModelIntent = useCallback( @@ -1645,8 +1649,8 @@ export function ChatPage(): ReactElement { {view.mode === "single" ? (