fix: toolCall.function.arguments maybe undefined (#2545)

当arg===undefined时,会导致 currentTool.function.arguments += arg; 字符串拼接出问题。
This commit is contained in:
不吃辣不喝酒
2024-08-27 17:41:59 +08:00
committed by GitHub
parent 450167c951
commit 14bd1b5404

View File

@@ -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) {