From 6a304e888426439f63d76d8b34505f4317e65834 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 5 Oct 2024 00:20:06 +0300 Subject: [PATCH] Fix generation looping --- public/scripts/tool-calling.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/tool-calling.js b/public/scripts/tool-calling.js index bbd3d7d34..a8c026242 100644 --- a/public/scripts/tool-calling.js +++ b/public/scripts/tool-calling.js @@ -459,7 +459,8 @@ export class ToolManager { * @returns {boolean} Whether the response data contains tool calls */ static hasToolCalls(data) { - return Array.isArray(ToolManager.#getToolCallsFromData(data)); + const toolCalls = ToolManager.#getToolCallsFromData(data); + return Array.isArray(toolCalls) && toolCalls.length > 0; } /**