From 0b7de6f7b2fc0043631607dd880e810605b312a9 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 10 Aug 2023 10:47:06 +0800 Subject: [PATCH] fix: #2594 trim the / --- app/api/common.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/api/common.ts b/app/api/common.ts index e5afb4d89f4..cd2936ee39f 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -20,6 +20,10 @@ export async function requestOpenai(req: NextRequest) { baseUrl = `${PROTOCOL}://${baseUrl}`; } + if (baseUrl.endsWith('/')) { + baseUrl = baseUrl.slice(0, -1); + } + console.log("[Proxy] ", openaiPath); console.log("[Base Url]", baseUrl);