From 01f03dbf508a00240e3019c517d8f61166af9eb1 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 4 Oct 2024 01:51:41 +0300 Subject: [PATCH] Support MistralAI streaming tool calls --- public/scripts/tool-calling.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/tool-calling.js b/public/scripts/tool-calling.js index 0eaada477..e0e3c53e0 100644 --- a/public/scripts/tool-calling.js +++ b/public/scripts/tool-calling.js @@ -278,9 +278,9 @@ export class ToolManager { } for (const toolCallDelta of toolCallDeltas) { - const toolCallIndex = (typeof toolCallDelta?.index === 'number') ? toolCallDelta.index : null; + const toolCallIndex = (typeof toolCallDelta?.index === 'number') ? toolCallDelta.index : toolCallDeltas.indexOf(toolCallDelta); - if (toolCallIndex === null) { + if (isNaN(toolCallIndex) || toolCallIndex < 0) { continue; }