From 1a1c1a02ce5cf11d54b835d8d2bc08efdc1e430b Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 9 Jun 2026 16:20:20 +0000 Subject: [PATCH] Use billable AI model for session memory --- backend/src/ai/LocalAIApi.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/backend/src/ai/LocalAIApi.js b/backend/src/ai/LocalAIApi.js index fd571ae..a747de7 100644 --- a/backend/src/ai/LocalAIApi.js +++ b/backend/src/ai/LocalAIApi.js @@ -154,7 +154,7 @@ async function awaitResponse(aiRequestId, options = {}) { const interval = Math.max(Number(options.interval ?? 5), 1); const deadline = Date.now() + Math.max(timeout, interval) * 1000; - while (true) { + while (Date.now() < deadline) { const statusResp = await fetchStatus(aiRequestId, { headers: options.headers, timeout: options.timeout_per_call, @@ -184,16 +184,14 @@ async function awaitResponse(aiRequestId, options = {}) { return statusResp; } - if (Date.now() >= deadline) { - return { - success: false, - error: "timeout", - message: "Timed out waiting for AI response.", - }; - } - await sleep(interval * 1000); } + + return { + success: false, + error: "timeout", + message: "Timed out waiting for AI response.", + }; } function extractText(response) { @@ -283,7 +281,7 @@ function config() { projectId, projectUuid: process.env.PROJECT_UUID || null, projectHeader: process.env.AI_PROJECT_HEADER || "project-uuid", - defaultModel: process.env.AI_DEFAULT_MODEL || "gpt-5-mini", + defaultModel: process.env.AI_DEFAULT_MODEL || "gpt-5.5", timeout, verifyTls, };