From 7180ed9a60e312d8500f3e264cffb0961377ed32 Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Tue, 3 Sep 2024 19:56:22 +0800 Subject: [PATCH] hotfix --- app/client/platforms/anthropic.ts | 4 +++- app/utils/chat.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/client/platforms/anthropic.ts b/app/client/platforms/anthropic.ts index d6958dfc53c..e30b53ed212 100644 --- a/app/client/platforms/anthropic.ts +++ b/app/client/platforms/anthropic.ts @@ -285,7 +285,9 @@ export class ClaudeApi implements LLMApi { type: "tool_use", id: tool.id, name: tool?.function?.name, - input: JSON.parse(tool?.function?.arguments as string), + input: tool?.function?.arguments + ? JSON.parse(tool?.function?.arguments) + : {}, }), ), }, diff --git a/app/utils/chat.ts b/app/utils/chat.ts index 49e5060d432..df266e59ddb 100644 --- a/app/utils/chat.ts +++ b/app/utils/chat.ts @@ -215,7 +215,9 @@ export function stream( // @ts-ignore funcs[tool.function.name]( // @ts-ignore - JSON.parse(tool.function.arguments), + tool?.function?.arguments + ? JSON.parse(tool?.function?.arguments) + : {}, ), ) .then((res) => {