fix(frontend/copilot): use correct ToolUIPart state for thinking indicator

Change ToolUIPart.state check from "result" (invalid) to "output-available"
(the actual AI SDK state for a completed tool call). This fixes the build
and makes the thinking-between-tool-calls feature functional.

Also simplifies the IIFE into a plain local variable for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lluis Agusti
2026-02-25 21:52:38 +08:00
parent 675218c1c0
commit 592e967600

View File

@@ -140,17 +140,16 @@ export const ChatMessagesContainer = ({
);
// Detect when the LLM is thinking after a completed tool call
const lastPart =
lastMessage?.role === "assistant" && lastMessage.parts.length > 0
? lastMessage.parts[lastMessage.parts.length - 1]
: undefined;
const isThinkingAfterToolCall =
status === "streaming" &&
lastMessage?.role === "assistant" &&
lastMessage.parts.length > 0 &&
(() => {
const lastPart = lastMessage.parts[lastMessage.parts.length - 1];
return (
lastPart.type.startsWith("tool-") &&
(lastPart as ToolUIPart).state === "result"
);
})();
lastPart !== undefined &&
lastPart.type.startsWith("tool-") &&
(lastPart as ToolUIPart).state === "output-available";
const showThinking =
status === "submitted" ||