lloydzhou 1 年之前
父节点
当前提交
7180ed9a60
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 3 1
      app/client/platforms/anthropic.ts
  2. 3 1
      app/utils/chat.ts

+ 3 - 1
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)
+                    : {},
                 }),
               ),
             },

+ 3 - 1
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) => {