MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / hasToolErrors

Function hasToolErrors

frontend/components/chat-panel.tsx:72–88  ·  view source on GitHub ↗

* Check if auto-resubmit should happen based on tool errors. * Does NOT handle retry count or quota - those are handled by the caller.

(messages: ChatMessage[])

Source from the content-addressed store, hash-verified

70 * Does NOT handle retry count or quota - those are handled by the caller.
71 */
72function hasToolErrors(messages: ChatMessage[]): boolean {
73 const lastMessage = messages[messages.length - 1]
74 if (!lastMessage || lastMessage.role !== "assistant") {
75 return false
76 }
77
78 const toolParts =
79 (lastMessage.parts as MessagePart[] | undefined)?.filter((part) =>
80 part.type?.startsWith("tool-"),
81 ) || []
82
83 if (toolParts.length === 0) {
84 return false
85 }
86
87 return toolParts.some((part) => part.state === TOOL_ERROR_STATE)
88}
89
90export default function ChatPanel({
91 isVisible,

Callers 1

ChatPanelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected