From 42bd03d6e99628dedba530fd7ac8e7f1a8986b2b Mon Sep 17 00:00:00 2001 From: Amery2010 Date: Tue, 15 Oct 2024 19:34:31 +0800 Subject: [PATCH] fix: Fix models api base url --- app/api/models/route.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/models/route.ts b/app/api/models/route.ts index 05a1b4b..13fd3c7 100644 --- a/app/api/models/route.ts +++ b/app/api/models/route.ts @@ -23,7 +23,8 @@ export async function GET(req: NextRequest) { } try { - const response = await fetch(`${geminiApiBaseUrl}/v1beta/models?key=${geminiApiKey}`) + const apiBaseUrl = geminiApiBaseUrl || 'https://generativelanguage.googleapis.com' + const response = await fetch(`${apiBaseUrl}/v1beta/models?key=${geminiApiKey}`) return new NextResponse(response.body) } catch (error) { if (error instanceof Error) {