Use billable AI model for session memory
This commit is contained in:
parent
196c6f48ed
commit
1a1c1a02ce
@ -154,7 +154,7 @@ async function awaitResponse(aiRequestId, options = {}) {
|
|||||||
const interval = Math.max(Number(options.interval ?? 5), 1);
|
const interval = Math.max(Number(options.interval ?? 5), 1);
|
||||||
const deadline = Date.now() + Math.max(timeout, interval) * 1000;
|
const deadline = Date.now() + Math.max(timeout, interval) * 1000;
|
||||||
|
|
||||||
while (true) {
|
while (Date.now() < deadline) {
|
||||||
const statusResp = await fetchStatus(aiRequestId, {
|
const statusResp = await fetchStatus(aiRequestId, {
|
||||||
headers: options.headers,
|
headers: options.headers,
|
||||||
timeout: options.timeout_per_call,
|
timeout: options.timeout_per_call,
|
||||||
@ -184,16 +184,14 @@ async function awaitResponse(aiRequestId, options = {}) {
|
|||||||
return statusResp;
|
return statusResp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Date.now() >= deadline) {
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: "timeout",
|
|
||||||
message: "Timed out waiting for AI response.",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
await sleep(interval * 1000);
|
await sleep(interval * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: "timeout",
|
||||||
|
message: "Timed out waiting for AI response.",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractText(response) {
|
function extractText(response) {
|
||||||
@ -283,7 +281,7 @@ function config() {
|
|||||||
projectId,
|
projectId,
|
||||||
projectUuid: process.env.PROJECT_UUID || null,
|
projectUuid: process.env.PROJECT_UUID || null,
|
||||||
projectHeader: process.env.AI_PROJECT_HEADER || "project-uuid",
|
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,
|
timeout,
|
||||||
verifyTls,
|
verifyTls,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user