mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
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:
@@ -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" ||
|
||||
|
||||
Reference in New Issue
Block a user