mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
feat(preset): add icon configuration to provider presets
- Add icon/iconColor fields to CodexProviderPreset and GeminiProviderPreset interfaces - Configure icons for Claude presets (DeepSeek, Zhipu, Qwen, Kimi, MiniMax, DouBao, etc.) - Configure icons for Codex presets (OpenAI, Azure, PackyCode) - Configure icons for Gemini presets (Google, PackyCode) - Fix handlePresetChange to pass icon fields when resetting form This ensures preset icons are displayed in the icon picker when selecting a provider preset.
This commit is contained in:
@@ -698,6 +698,8 @@ export function ProviderForm({
|
||||
name: preset.name,
|
||||
websiteUrl: preset.websiteUrl ?? "",
|
||||
settingsConfig: JSON.stringify({ auth, config }, null, 2),
|
||||
icon: preset.icon ?? "",
|
||||
iconColor: preset.iconColor ?? "",
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -715,6 +717,8 @@ export function ProviderForm({
|
||||
name: preset.name,
|
||||
websiteUrl: preset.websiteUrl ?? "",
|
||||
settingsConfig: JSON.stringify(preset.settingsConfig, null, 2),
|
||||
icon: preset.icon ?? "",
|
||||
iconColor: preset.iconColor ?? "",
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -729,6 +733,8 @@ export function ProviderForm({
|
||||
name: preset.name,
|
||||
websiteUrl: preset.websiteUrl ?? "",
|
||||
settingsConfig: JSON.stringify(config, null, 2),
|
||||
icon: preset.icon ?? "",
|
||||
iconColor: preset.iconColor ?? "",
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "deepseek",
|
||||
iconColor: "#1E88E5",
|
||||
},
|
||||
{
|
||||
name: "Zhipu GLM",
|
||||
@@ -94,6 +96,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
category: "cn_official",
|
||||
isPartner: true, // 合作伙伴
|
||||
partnerPromotionKey: "zhipu", // 促销信息 i18n key
|
||||
icon: "zhipu",
|
||||
iconColor: "#0F62FE",
|
||||
},
|
||||
{
|
||||
name: "Z.ai GLM",
|
||||
@@ -112,6 +116,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
category: "cn_official",
|
||||
isPartner: true, // 合作伙伴
|
||||
partnerPromotionKey: "zhipu", // 促销信息 i18n key
|
||||
icon: "zhipu",
|
||||
iconColor: "#0F62FE",
|
||||
},
|
||||
{
|
||||
name: "Qwen Coder",
|
||||
@@ -128,6 +134,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "qwen",
|
||||
iconColor: "#FF6A00",
|
||||
},
|
||||
{
|
||||
name: "Kimi k2",
|
||||
@@ -143,6 +151,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "kimi",
|
||||
iconColor: "#6366F1",
|
||||
},
|
||||
{
|
||||
name: "Kimi For Coding",
|
||||
@@ -158,6 +168,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "kimi",
|
||||
iconColor: "#6366F1",
|
||||
},
|
||||
{
|
||||
name: "ModelScope",
|
||||
@@ -173,6 +185,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "aggregator",
|
||||
icon: "alibaba",
|
||||
iconColor: "#FF6A00",
|
||||
},
|
||||
{
|
||||
name: "KAT-Coder",
|
||||
@@ -240,6 +254,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
backgroundColor: "#f64551",
|
||||
textColor: "#FFFFFF",
|
||||
},
|
||||
icon: "minimax",
|
||||
iconColor: "#FF6B6B",
|
||||
},
|
||||
{
|
||||
name: "DouBaoSeed",
|
||||
@@ -257,6 +273,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "doubao",
|
||||
iconColor: "#3370FF",
|
||||
},
|
||||
{
|
||||
name: "BaiLing",
|
||||
@@ -272,6 +290,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
icon: "alibaba",
|
||||
iconColor: "#FF6A00",
|
||||
},
|
||||
{
|
||||
name: "AiHubMix",
|
||||
@@ -321,5 +341,6 @@ export const providerPresets: ProviderPreset[] = [
|
||||
category: "third_party",
|
||||
isPartner: true, // 合作伙伴
|
||||
partnerPromotionKey: "packycode", // 促销信息 i18n key
|
||||
icon: "packycode",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -20,6 +20,9 @@ export interface CodexProviderPreset {
|
||||
endpointCandidates?: string[];
|
||||
// 新增:视觉主题配置
|
||||
theme?: PresetTheme;
|
||||
// 图标配置
|
||||
icon?: string; // 图标名称
|
||||
iconColor?: string; // 图标颜色
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +74,8 @@ export const codexProviderPresets: CodexProviderPreset[] = [
|
||||
backgroundColor: "#1F2937", // gray-800
|
||||
textColor: "#FFFFFF",
|
||||
},
|
||||
icon: "openai",
|
||||
iconColor: "#00A67E",
|
||||
},
|
||||
{
|
||||
name: "Azure OpenAI",
|
||||
@@ -97,6 +102,8 @@ requires_openai_auth = true`,
|
||||
backgroundColor: "#0078D4",
|
||||
textColor: "#FFFFFF",
|
||||
},
|
||||
icon: "azure",
|
||||
iconColor: "#0078D4",
|
||||
},
|
||||
{
|
||||
name: "AiHubMix",
|
||||
@@ -142,5 +149,6 @@ requires_openai_auth = true`,
|
||||
],
|
||||
isPartner: true, // 合作伙伴
|
||||
partnerPromotionKey: "packycode", // 促销信息 i18n key
|
||||
icon: "packycode",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -25,6 +25,9 @@ export interface GeminiProviderPreset {
|
||||
partnerPromotionKey?: string;
|
||||
endpointCandidates?: string[];
|
||||
theme?: GeminiPresetTheme;
|
||||
// 图标配置
|
||||
icon?: string; // 图标名称
|
||||
iconColor?: string; // 图标颜色
|
||||
}
|
||||
|
||||
export const geminiProviderPresets: GeminiProviderPreset[] = [
|
||||
@@ -43,6 +46,8 @@ export const geminiProviderPresets: GeminiProviderPreset[] = [
|
||||
backgroundColor: "#4285F4",
|
||||
textColor: "#FFFFFF",
|
||||
},
|
||||
icon: "gemini",
|
||||
iconColor: "#4285F4",
|
||||
},
|
||||
{
|
||||
name: "PackyCode",
|
||||
@@ -64,6 +69,7 @@ export const geminiProviderPresets: GeminiProviderPreset[] = [
|
||||
"https://api-slb.packyapi.com",
|
||||
"https://www.packyapi.com",
|
||||
],
|
||||
icon: "packycode",
|
||||
},
|
||||
{
|
||||
name: "自定义",
|
||||
|
||||
Reference in New Issue
Block a user