From ef7617d545417fe10b3094530a62c59694063d6b Mon Sep 17 00:00:00 2001 From: butterfly Date: Mon, 8 Apr 2024 13:41:02 +0800 Subject: [PATCH 1/2] feat: configs about app client --- app/client/platforms/anthropic.ts | 2 +- next.config.mjs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/client/platforms/anthropic.ts b/app/client/platforms/anthropic.ts index 25318d311..673f32b11 100644 --- a/app/client/platforms/anthropic.ts +++ b/app/client/platforms/anthropic.ts @@ -356,7 +356,7 @@ export class ClaudeApi implements LLMApi { const isApp = !!getClientConfig()?.isApp; baseUrl = isApp - ? DEFAULT_API_HOST + "/api/proxy" + ApiPath.Anthropic + ? DEFAULT_API_HOST + "/api/proxy/anthropic" : ApiPath.Anthropic; } diff --git a/next.config.mjs b/next.config.mjs index c8e7adb83..daaeba468 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -77,6 +77,10 @@ if (mode !== "export") { source: "/api/proxy/openai/:path*", destination: "https://api.openai.com/:path*", }, + { + source: "/api/proxy/anthropic/:path*", + destination: "https://api.anthropic.com/:path*", + }, { source: "/google-fonts/:path*", destination: "https://fonts.googleapis.com/:path*", From 5446d8d4a2a71c7e983af1538b25ed4ca7192483 Mon Sep 17 00:00:00 2001 From: butterfly Date: Mon, 8 Apr 2024 13:59:55 +0800 Subject: [PATCH 2/2] feat: fix illegal exports in app/api/anthropic/[...path]/route.ts --- app/api/anthropic/[...path]/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/anthropic/[...path]/route.ts b/app/api/anthropic/[...path]/route.ts index cf7f7a223..4264893d9 100644 --- a/app/api/anthropic/[...path]/route.ts +++ b/app/api/anthropic/[...path]/route.ts @@ -80,7 +80,7 @@ export const preferredRegion = [ const serverConfig = getServerSideConfig(); -export async function request(req: NextRequest) { +async function request(req: NextRequest) { const controller = new AbortController(); let authHeaderName = "x-api-key";