Files
cc-switch/src/config/geminiProviderPresets.ts
farion1231 bb0951552d feat: update Gemini default model and remove Google Official preset model
Updated default model from gemini-2.5-pro to gemini-3-pro-preview across:
- Provider presets (PackyCode, Custom)
- Form field placeholders
- Default configurations
- Test cases

Google Official preset now has empty env config, allowing users to choose
their own model or use application defaults, which is more appropriate for
OAuth-based authentication.

Changes:
- geminiProviderPresets.ts: updated model to gemini-3-pro-preview, removed model from Google Official
- GeminiFormFields.tsx: updated placeholder to gemini-3-pro-preview
- GeminiConfigSections.tsx: updated placeholder to gemini-3-pro-preview
- ProviderForm.tsx: updated default config to gemini-3-pro-preview
- gemini_config.rs: updated test examples to gemini-3-pro-preview
2025-11-19 10:53:33 +08:00

99 lines
2.5 KiB
TypeScript

import type { ProviderCategory } from "@/types";
/**
* Gemini 预设供应商的视觉主题配置
*/
export interface GeminiPresetTheme {
/** 图标类型:'gemini' | 'generic' */
icon?: "gemini" | "generic";
/** 背景色(选中状态),支持 hex 颜色 */
backgroundColor?: string;
/** 文字色(选中状态),支持 hex 颜色 */
textColor?: string;
}
export interface GeminiProviderPreset {
name: string;
websiteUrl: string;
apiKeyUrl?: string;
settingsConfig: object;
baseURL?: string;
model?: string;
description?: string;
category?: ProviderCategory;
isPartner?: boolean;
partnerPromotionKey?: string;
endpointCandidates?: string[];
theme?: GeminiPresetTheme;
}
export const geminiProviderPresets: GeminiProviderPreset[] = [
{
name: "Google Official",
websiteUrl: "https://ai.google.dev/",
apiKeyUrl: "https://aistudio.google.com/apikey",
settingsConfig: {
env: {},
},
description: "Google 官方 Gemini API (OAuth)",
category: "official",
partnerPromotionKey: "google-official",
theme: {
icon: "gemini",
backgroundColor: "#4285F4",
textColor: "#FFFFFF",
},
},
{
name: "PackyCode",
websiteUrl: "https://www.packyapi.com",
apiKeyUrl: "https://www.packyapi.com/register?aff=cc-switch",
settingsConfig: {
env: {
GOOGLE_GEMINI_BASE_URL: "https://www.packyapi.com",
GEMINI_MODEL: "gemini-3-pro-preview",
},
},
baseURL: "https://www.packyapi.com",
model: "gemini-3-pro-preview",
description: "PackyCode",
category: "third_party",
isPartner: true,
partnerPromotionKey: "packycode",
endpointCandidates: [
"https://api-slb.packyapi.com",
"https://www.packyapi.com",
],
},
{
name: "自定义",
websiteUrl: "",
settingsConfig: {
env: {
GOOGLE_GEMINI_BASE_URL: "",
GEMINI_MODEL: "gemini-3-pro-preview",
},
},
model: "gemini-3-pro-preview",
description: "自定义 Gemini API 端点",
category: "custom",
},
];
export function getGeminiPresetByName(
name: string,
): GeminiProviderPreset | undefined {
return geminiProviderPresets.find((preset) => preset.name === name);
}
export function getGeminiPresetByUrl(
url: string,
): GeminiProviderPreset | undefined {
if (!url) return undefined;
return geminiProviderPresets.find(
(preset) =>
preset.baseURL &&
url.toLowerCase().includes(preset.baseURL.toLowerCase()),
);
}