diff --git a/packages/core/src/aici.ts b/packages/core/src/aici.ts index 20875d72df..b8528a4a11 100644 --- a/packages/core/src/aici.ts +++ b/packages/core/src/aici.ts @@ -4,7 +4,7 @@ import { LanguageModel, } from "./chat" import { PromptNode, visitNode } from "./promptdom" -import { fromHex, logError, utf8Decode } from "./util" +import { fromHex, logError, normalizeInt, utf8Decode } from "./util" import { AICI_CONTROLLER, TOOL_ID } from "./constants" import { host } from "./host" import { NotSupportedError, RequestError } from "./error" @@ -248,7 +248,7 @@ const AICIChatCompletion: ChatCompletionHandler = async ( r.statusText, bodyJSON?.error, body, - parseInt(r.headers.get("retry-after")) + normalizeInt(r.headers.get("retry-after")) ) } diff --git a/packages/core/src/openai.ts b/packages/core/src/openai.ts index 370e399142..482fc217e2 100644 --- a/packages/core/src/openai.ts +++ b/packages/core/src/openai.ts @@ -1,4 +1,4 @@ -import { logError, logVerbose } from "./util" +import { logError, logVerbose, normalizeInt } from "./util" import { host } from "./host" import { AZURE_OPENAI_API_VERSION, @@ -150,7 +150,7 @@ export const OpenAIChatCompletion: ChatCompletionHandler = async ( r.statusText, bodyJSON?.error, body, - parseInt(r.headers.get("retry-after")) + normalizeInt(r.headers.get("retry-after")) ) }