From 85445c4ef223fcdb3f1ba4d76c668cc9d67acfc3 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 18 May 2023 02:09:05 +0800 Subject: [PATCH 1/2] chore: wont parse finished result --- app/client/platforms/openai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index 9e360514..2a28debd 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -123,7 +123,7 @@ export class ChatGPTApi implements LLMApi { } }, onmessage(msg) { - if (msg.data === "[DONE]") { + if (msg.data === "[DONE]" || finished) { return finish(); } const text = msg.data; From 3fe521421f3ac1aadeb1013b474dc7fd95079704 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 18 May 2023 02:15:30 +0800 Subject: [PATCH 2/2] chore: dynamic server config --- app/api/auth.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/api/auth.ts b/app/api/auth.ts index 62fcd226..86a8b1ad 100644 --- a/app/api/auth.ts +++ b/app/api/auth.ts @@ -3,8 +3,6 @@ import { getServerSideConfig } from "../config/server"; import md5 from "spark-md5"; import { ACCESS_CODE_PREFIX } from "../constant"; -const serverConfig = getServerSideConfig(); - function getIP(req: NextRequest) { let ip = req.ip ?? req.headers.get("x-real-ip"); const forwardedFor = req.headers.get("x-forwarded-for"); @@ -34,6 +32,7 @@ export function auth(req: NextRequest) { const hashedCode = md5.hash(accessCode ?? "").trim(); + const serverConfig = getServerSideConfig(); console.log("[Auth] allowed hashed codes: ", [...serverConfig.codes]); console.log("[Auth] got access code:", accessCode); console.log("[Auth] hashed access code:", hashedCode);