Fix generation looping

This commit is contained in:
Cohee 2024-10-05 00:20:06 +03:00
parent c3078a67e1
commit 6a304e8884
1 changed files with 2 additions and 1 deletions

View File

@ -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;
}
/**