From 3d271fae90a3d8c216b9225e0deb774553279085 Mon Sep 17 00:00:00 2001 From: KmBase <1462011227@qq.com> Date: Fri, 7 Apr 2023 19:45:02 +0800 Subject: [PATCH] fixbug --- app/requests.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/requests.ts b/app/requests.ts index df0a9ebf1..f1c8a5cec 100644 --- a/app/requests.ts +++ b/app/requests.ts @@ -9,7 +9,7 @@ const makeRequestParam = ( options?: { filterBot?: boolean; stream?: boolean; - } + }, ): ChatRequest => { let sendMessages = messages.map((v) => ({ role: v.role, @@ -39,9 +39,10 @@ function getHeaders() { if (accessStore.token && accessStore.token.length > 0) { headers["token"] = accessStore.token; + } + if (accessStore.host && accessStore.host.length > 0) { headers["userhost"] = accessStore.host; } - return headers; } @@ -85,7 +86,7 @@ export async function requestUsage() { const [used, subs] = await Promise.all([ requestOpenaiClient( - `dashboard/billing/usage?start_date=${startDate}&end_date=${endDate}` + `dashboard/billing/usage?start_date=${startDate}&end_date=${endDate}`, )(null, "GET"), requestOpenaiClient("dashboard/billing/subscription")(null, "GET"), ]); @@ -125,7 +126,7 @@ export async function requestChatStream( onMessage: (message: string, done: boolean) => void; onError: (error: Error, statusCode?: number) => void; onController?: (controller: AbortController) => void; - } + }, ) { const req = makeRequestParam(messages, { stream: true, @@ -214,7 +215,7 @@ export const ControllerPool = { addController( sessionIndex: number, messageId: number, - controller: AbortController + controller: AbortController, ) { const key = this.key(sessionIndex, messageId); this.controllers[key] = controller;