Tool Calling: Don't try to parse if tool calling is not supported

3fd7ca90ed2ce5d8c65ebbbc3477e5ad4a198e18

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -0Showing whitespace changes
public/scripts/tool-calling.js+3 -0
@@ -365,6 +365,9 @@ export class ToolManager {
365 * @returns {void}365 * @returns {void}
366 */366 */
367 static parseToolCalls(toolCalls, parsed) {367 static parseToolCalls(toolCalls, parsed) {
368 if (!this.isToolCallingSupported()) {
369 return;
370 }
368 if (Array.isArray(parsed?.choices)) {371 if (Array.isArray(parsed?.choices)) {
369 for (const choice of parsed.choices) {372 for (const choice of parsed.choices) {
370 const choiceIndex = (typeof choice.index === 'number') ? choice.index : null;373 const choiceIndex = (typeof choice.index === 'number') ? choice.index : null;