From 52b383041973d075e2f7fa2007a5f1163badec29 Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 6 Feb 2026 18:29:03 +0800 Subject: [PATCH 1/2] feat: add baseURL configuration for Google AI provider --- src/app/i18n/locales/en.json | 7 ++++++- src/app/i18n/locales/zh.json | 7 ++++++- src/app/routes/settings/provider/$providerId.tsx | 2 +- src/server/ai/provider/google.ts | 14 ++++++++++++-- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/app/i18n/locales/en.json b/src/app/i18n/locales/en.json index e124ba4..479d48b 100644 --- a/src/app/i18n/locales/en.json +++ b/src/app/i18n/locales/en.json @@ -324,6 +324,11 @@ "title": "API Key", "description": "Your Google AI API key for authentication", "placeholder": "Enter your Google AI API key" + }, + "baseURL": { + "title": "Base URL", + "description": "The base URL for Google AI API endpoint", + "placeholder": "Enter your Google AI API base URL" } }, "models": { @@ -351,4 +356,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/app/i18n/locales/zh.json b/src/app/i18n/locales/zh.json index b3cc002..09f20d9 100644 --- a/src/app/i18n/locales/zh.json +++ b/src/app/i18n/locales/zh.json @@ -324,6 +324,11 @@ "title": "API密钥", "description": "用于身份验证的Google AI API密钥", "placeholder": "输入您的Google AI API密钥" + }, + "baseURL": { + "title": "基础URL", + "description": "Google AI API端点的基础URL", + "placeholder": "请输入您的Google AI API基础URL" } }, "models": { @@ -351,4 +356,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/app/routes/settings/provider/$providerId.tsx b/src/app/routes/settings/provider/$providerId.tsx index 89ad6d9..b72a0fc 100644 --- a/src/app/routes/settings/provider/$providerId.tsx +++ b/src/app/routes/settings/provider/$providerId.tsx @@ -47,7 +47,7 @@ function ProviderDetailPage() { return (
- +
diff --git a/src/server/ai/provider/google.ts b/src/server/ai/provider/google.ts index bcceb73..42cffa7 100644 --- a/src/server/ai/provider/google.ts +++ b/src/server/ai/provider/google.ts @@ -9,6 +9,11 @@ const googleSettingsSchema = [ type: "password", required: true, }, + { + key: "baseURL", + type: "url", + required: false, + }, ] as const satisfies ApiProviderSettingsItem[]; // Automatically generate type from schema @@ -16,9 +21,14 @@ export type GoogleSettings = ProviderSettingsType; // Single image generation helper function const generateSingle = async (request: TypixGenerateRequest, settings: ApiProviderSettings): Promise => { - const { apiKey } = Google.parseSettings(settings); + const { apiKey, baseURL } = Google.parseSettings(settings); - const ai = new GoogleGenAI({ apiKey }); + const ai = new GoogleGenAI({ + apiKey, + httpOptions: { + baseUrl: baseURL, + }, + }); const ability = chooseAblility(request, findModel(Google, request.modelId).ability); From b9db03d7e23ff7e4f7eefbebe1a52a74df98efc3 Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 6 Feb 2026 18:30:25 +0800 Subject: [PATCH 2/2] fmt --- src/app/i18n/locales/en.json | 2 +- src/app/i18n/locales/zh.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/i18n/locales/en.json b/src/app/i18n/locales/en.json index 479d48b..f1cef5f 100644 --- a/src/app/i18n/locales/en.json +++ b/src/app/i18n/locales/en.json @@ -356,4 +356,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/app/i18n/locales/zh.json b/src/app/i18n/locales/zh.json index 09f20d9..57e1b0b 100644 --- a/src/app/i18n/locales/zh.json +++ b/src/app/i18n/locales/zh.json @@ -356,4 +356,4 @@ } } } -} \ No newline at end of file +}