From 07e4e0dc9f3c6fc47b54e07c0e315c7e498b9e0e Mon Sep 17 00:00:00 2001 From: centdix Date: Thu, 28 Aug 2025 15:22:42 +0000 Subject: [PATCH] nit --- frontend/src/lib/components/copilot/chat/anthropic.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/components/copilot/chat/anthropic.ts b/frontend/src/lib/components/copilot/chat/anthropic.ts index c7f9d8f6d3..2370601ca3 100644 --- a/frontend/src/lib/components/copilot/chat/anthropic.ts +++ b/frontend/src/lib/components/copilot/chat/anthropic.ts @@ -113,11 +113,17 @@ export function convertOpenAIToAnthropicMessages(messages: ChatCompletionMessage if (message.tool_calls) { for (const toolCall of message.tool_calls) { + let input = {} + try { + input = JSON.parse(toolCall.function.arguments || '{}') + } catch (e) { + console.error('Failed to parse tool call arguments', e) + } content.push({ type: 'tool_use', id: toolCall.id, name: toolCall.function.name, - input: JSON.parse(toolCall.function.arguments || '{}') + input }) } } @@ -135,7 +141,7 @@ export function convertOpenAIToAnthropicMessages(messages: ChatCompletionMessage content: [ { type: 'tool_result', - tool_use_id: message.tool_call_id || '', + tool_use_id: message.tool_call_id, content: typeof message.content === 'string' ? message.content