From 02669cfbac755f820316de6e96652787314e8009 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 8 Mar 2026 23:01:35 +0800 Subject: [PATCH] feat: add Ucloud partner provider preset for Claude, Codex and OpenClaw - Add Ucloud provider presets with modelverse.cn API endpoint - Register ucloud icon SVG in icon index with namespaced gradient IDs - Add partnerPromotion.ucloud i18n keys for zh, en, ja locales --- .../forms/hooks/useCodexCommonConfig.ts | 6 +---- .../forms/hooks/useCommonConfigSnippet.ts | 6 +---- src/config/claudeProviderPresets.ts | 20 ++++++++++++++ src/config/codexProviderPresets.ts | 17 ++++++++++++ src/config/openclawProviderPresets.ts | 27 +++++++++++++++++++ src/i18n/locales/en.json | 3 ++- src/i18n/locales/ja.json | 3 ++- src/i18n/locales/zh.json | 3 ++- src/icons/extracted/index.ts | 1 + src/icons/extracted/ucloud.svg | 1 + 10 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 src/icons/extracted/ucloud.svg diff --git a/src/components/providers/forms/hooks/useCodexCommonConfig.ts b/src/components/providers/forms/hooks/useCodexCommonConfig.ts index 23b2498c6..926902a8f 100644 --- a/src/components/providers/forms/hooks/useCodexCommonConfig.ts +++ b/src/components/providers/forms/hooks/useCodexCommonConfig.ts @@ -119,11 +119,7 @@ export function useCodexCommonConfig({ const hasCommon = initialEnabled ?? inferredHasCommon; setUseCommonConfig(hasCommon); - if ( - hasCommon && - !inferredHasCommon && - !hasInitializedEditMode.current - ) { + if (hasCommon && !inferredHasCommon && !hasInitializedEditMode.current) { hasInitializedEditMode.current = true; const { updatedConfig, error } = updateTomlCommonConfigSnippet( codexConfig, diff --git a/src/components/providers/forms/hooks/useCommonConfigSnippet.ts b/src/components/providers/forms/hooks/useCommonConfigSnippet.ts index d8fa04564..4b8fbed7b 100644 --- a/src/components/providers/forms/hooks/useCommonConfigSnippet.ts +++ b/src/components/providers/forms/hooks/useCommonConfigSnippet.ts @@ -127,11 +127,7 @@ export function useCommonConfigSnippet({ const hasCommon = initialEnabled ?? inferredHasCommon; setUseCommonConfig(hasCommon); - if ( - hasCommon && - !inferredHasCommon && - !hasInitializedEditMode.current - ) { + if (hasCommon && !inferredHasCommon && !hasInitializedEditMode.current) { hasInitializedEditMode.current = true; const { updatedConfig, error } = updateCommonConfigSnippet( settingsConfig, diff --git a/src/config/claudeProviderPresets.ts b/src/config/claudeProviderPresets.ts index d385f0681..2f57c56be 100644 --- a/src/config/claudeProviderPresets.ts +++ b/src/config/claudeProviderPresets.ts @@ -552,6 +552,26 @@ export const providerPresets: ProviderPreset[] = [ icon: "sssaicode", iconColor: "#000000", }, + { + name: "Ucloud", + websiteUrl: "https://www.compshare.cn", + apiKeyUrl: "https://api.modelverse.cn", + settingsConfig: { + env: { + ANTHROPIC_BASE_URL: "https://api.modelverse.cn", + ANTHROPIC_AUTH_TOKEN: "", + ANTHROPIC_MODEL: "zai-org/glm-5", + ANTHROPIC_DEFAULT_HAIKU_MODEL: "zai-org/glm-5", + ANTHROPIC_DEFAULT_SONNET_MODEL: "zai-org/glm-5", + ANTHROPIC_DEFAULT_OPUS_MODEL: "zai-org/glm-5", + }, + }, + category: "aggregator", + isPartner: true, // 合作伙伴 + partnerPromotionKey: "ucloud", // 促销信息 i18n key + icon: "ucloud", + iconColor: "#000000", + }, { name: "OpenRouter", websiteUrl: "https://openrouter.ai", diff --git a/src/config/codexProviderPresets.ts b/src/config/codexProviderPresets.ts index 141f9827a..0c2d103a7 100644 --- a/src/config/codexProviderPresets.ts +++ b/src/config/codexProviderPresets.ts @@ -280,6 +280,23 @@ requires_openai_auth = true`, icon: "sssaicode", iconColor: "#000000", }, + { + name: "Ucloud", + websiteUrl: "https://www.compshare.cn", + apiKeyUrl: "https://api.modelverse.cn/v1", + auth: generateThirdPartyAuth(""), + config: generateThirdPartyConfig( + "ucloud", + "https://api.modelverse.cn/v1", + "zai-org/glm-5", + ), + endpointCandidates: ["https://api.modelverse.cn/v1"], + category: "aggregator", + isPartner: true, // 合作伙伴 + partnerPromotionKey: "ucloud", // 促销信息 i18n key + icon: "ucloud", + iconColor: "#000000", + }, { name: "OpenRouter", websiteUrl: "https://openrouter.ai", diff --git a/src/config/openclawProviderPresets.ts b/src/config/openclawProviderPresets.ts index a13b264c2..3807d0b8e 100644 --- a/src/config/openclawProviderPresets.ts +++ b/src/config/openclawProviderPresets.ts @@ -1225,6 +1225,33 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [ }, }, }, + { + name: "Ucloud", + websiteUrl: "https://www.compshare.cn", + apiKeyUrl: "https://api.modelverse.cn/v1", + settingsConfig: { + baseUrl: "https://api.modelverse.cn/v1", + apiKey: "", + api: "anthropic-messages", + models: [ + { + id: "zai-org/glm-5", + name: "GLM-5", + contextWindow: 200000, + }, + { + id: "MiniMax-M2.5", + name: "MiniMax-M2.5", + contextWindow: 200000, + }, + ], + }, + category: "aggregator", + isPartner: true, // 合作伙伴 + partnerPromotionKey: "ucloud", // 促销信息 i18n key + icon: "ucloud", + iconColor: "#000000", + }, // ========== Cloud Providers ========== { name: "AWS Bedrock", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 37b3a972c..7e591daab 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -705,7 +705,8 @@ "aicoding": "AI Coding offers an exclusive discount for CC Switch users — 10% off your first top-up!", "crazyrouter": "CrazyRouter offers an exclusive bonus for CC Switch users — 30% extra credit on your first top-up!", "sssaicode": "SSAI Code offers an exclusive bonus for CC Switch users — $10 extra credit on every top-up!", - "siliconflow": "SiliconFlow is an official partner of CC Switch" + "siliconflow": "SiliconFlow is an official partner of CC Switch", + "ucloud": "UCloud offers an exclusive bonus for CC Switch users — register via this link to get ¥5 platform trial credit!" }, "parameterConfig": "Parameter Config - {{name}} *", "mainModel": "Main Model (optional)", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 536c6614c..0f372b82e 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -705,7 +705,8 @@ "aicoding": "AI Coding は CC Switch ユーザー向けに特別割引を提供しています。初回チャージが 10% オフ!", "crazyrouter": "CrazyRouter は CC Switch ユーザー向けに特別ボーナスを提供しています。初回チャージで 30% の追加クレジットがもらえます!", "sssaicode": "SSAI Code は CC Switch ユーザー向けに特別ボーナスを提供しています。チャージごとに $10 の追加クレジットがもらえます!", - "siliconflow": "SiliconFlow は CC Switch の公式パートナーです" + "siliconflow": "SiliconFlow は CC Switch の公式パートナーです", + "ucloud": "UCloud は CC Switch ユーザー向けに特別ボーナスを提供しています。このリンクから登録すると、5元のプラットフォーム体験クレジットがもらえます!" }, "parameterConfig": "パラメーター設定 - {{name}} *", "mainModel": "メインモデル(任意)", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 215e05f07..46ab7550d 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -705,7 +705,8 @@ "aicoding": "AI Coding 为 CC Switch 的用户提供了特殊优惠,首次充值可以享受 9 折优惠!", "crazyrouter": "CrazyRouter 为 CC Switch 的用户提供了特殊优惠,首次充值赠予 30% 额外额度!", "sssaicode": "SSAI Code 为 CC Switch 的用户提供了特殊优惠,每次充值赠予额外 $10 额度!", - "siliconflow": "硅基流动是 CC Switch 的官方合作伙伴" + "siliconflow": "硅基流动是 CC Switch 的官方合作伙伴", + "ucloud": "优云智算为CC Switch 的用户提供了特殊优惠,通过此链接注册,可以获得五元平台体验金!" }, "parameterConfig": "参数配置 - {{name}} *", "mainModel": "主模型 (可选)", diff --git a/src/icons/extracted/index.ts b/src/icons/extracted/index.ts index 1e2fba31b..f6a92a234 100644 --- a/src/icons/extracted/index.ts +++ b/src/icons/extracted/index.ts @@ -60,6 +60,7 @@ export const icons: Record = { aihubmix: `AiHubMix`, opencode: `OpenCode`, siliconflow: `SiliconCloud`, + ucloud: `UCloud`, sssaicode: `SSAI Code1001 11010110 101110 110SSSSAiCode`, catcoder: `KwaiKAT`, mcp: `ModelContextProtocol`, diff --git a/src/icons/extracted/ucloud.svg b/src/icons/extracted/ucloud.svg new file mode 100644 index 000000000..9a4b8d476 --- /dev/null +++ b/src/icons/extracted/ucloud.svg @@ -0,0 +1 @@ +资源 13 \ No newline at end of file