From 14bd1b5404f85f9cfff27843b311a35cf0079b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=90=83=E8=BE=A3=E4=B8=8D=E5=96=9D=E9=85=92?= <11326806+wxlzmt@users.noreply.github.com> Date: Tue, 27 Aug 2024 17:41:59 +0800 Subject: [PATCH] fix: toolCall.function.arguments maybe undefined (#2545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当arg===undefined时,会导致 currentTool.function.arguments += arg; 字符串拼接出问题。 --- .../service/core/workflow/dispatch/agent/runTool/toolChoice.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/service/core/workflow/dispatch/agent/runTool/toolChoice.ts b/packages/service/core/workflow/dispatch/agent/runTool/toolChoice.ts index d0ddd4cae..1fc5fd8df 100644 --- a/packages/service/core/workflow/dispatch/agent/runTool/toolChoice.ts +++ b/packages/service/core/workflow/dispatch/agent/runTool/toolChoice.ts @@ -432,7 +432,7 @@ async function streamResponse({ } /* arg 插入最后一个工具的参数里 */ - const arg: string = toolCall?.function?.arguments; + const arg: string = toolCall?.function?.arguments ?? ''; const currentTool = toolCalls[toolCalls.length - 1]; if (currentTool) {