diff --git a/src/components/providers/forms/ClaudeDesktopProviderForm.tsx b/src/components/providers/forms/ClaudeDesktopProviderForm.tsx index ec1d0f227..1f16b9018 100644 --- a/src/components/providers/forms/ClaudeDesktopProviderForm.tsx +++ b/src/components/providers/forms/ClaudeDesktopProviderForm.tsx @@ -395,25 +395,6 @@ export function ClaudeDesktopProviderForm({ [], ); - const groupedPresets = useMemo( - () => - presetEntries.reduce>((acc, entry) => { - const cat = entry.preset.category ?? "others"; - if (!acc[cat]) acc[cat] = []; - acc[cat].push(entry); - return acc; - }, {}), - [presetEntries], - ); - - const categoryKeys = useMemo( - () => - Object.keys(groupedPresets).filter( - (key) => key !== "custom" && groupedPresets[key]?.length, - ), - [groupedPresets], - ); - const presetCategoryLabels: Record = useMemo( () => ({ official: t("providerForm.categoryOfficial", { defaultValue: "官方" }), @@ -777,8 +758,7 @@ export function ClaudeDesktopProviderForm({ {!initialData && ( { - return presetEntries.reduce>((acc, entry) => { - const category = entry.preset.category ?? "others"; - if (!acc[category]) { - acc[category] = []; - } - acc[category].push(entry); - return acc; - }, {}); - }, [presetEntries]); - - const categoryKeys = useMemo(() => { - return Object.keys(groupedPresets).filter( - (key) => key !== "custom" && groupedPresets[key]?.length, - ); - }, [groupedPresets]); - const shouldShowSpeedTest = category !== "official" && category !== "cloud_provider"; @@ -1553,8 +1536,7 @@ function ProviderFormFull({ {!initialData && ( ; - categoryKeys: string[]; + presetEntries: PresetEntry[]; presetCategoryLabels: Record; onPresetChange: (value: string) => void; onUniversalPresetSelect?: (preset: UniversalProviderPreset) => void; @@ -37,8 +42,7 @@ interface ProviderPresetSelectorProps { export function ProviderPresetSelector({ selectedPresetId, - groupedPresets, - categoryKeys, + presetEntries, presetCategoryLabels, onPresetChange, onUniversalPresetSelect, @@ -140,35 +144,33 @@ export function ProviderPresetSelector({ {t("providerPreset.custom")} - {categoryKeys.map((category) => { - const entries = groupedPresets[category]; - if (!entries || entries.length === 0) return null; - return entries.map((entry) => { - const isSelected = selectedPresetId === entry.id; - const isPartner = entry.preset.isPartner; - return ( - - ); - }); + {presetEntries.map((entry) => { + const isSelected = selectedPresetId === entry.id; + const isPartner = entry.preset.isPartner; + const presetCategory = entry.preset.category ?? "others"; + return ( + + ); })} diff --git a/src/config/claudeDesktopProviderPresets.ts b/src/config/claudeDesktopProviderPresets.ts index e525dbdfb..3edbc319d 100644 --- a/src/config/claudeDesktopProviderPresets.ts +++ b/src/config/claudeDesktopProviderPresets.ts @@ -148,6 +148,79 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [ partnerPromotionKey: "shengsuanyun", icon: "shengsuanyun", }, + { + name: "PatewayAI", + websiteUrl: "https://pateway.ai", + apiKeyUrl: "https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/", + category: "third_party", + baseUrl: "https://api.pateway.ai", + mode: "direct", + apiFormat: "anthropic", + modelRoutes: passthroughRoutes(), + isPartner: true, + partnerPromotionKey: "patewayai", + icon: "pateway", + }, + { + name: "火山Agentplan", + websiteUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + category: "cn_official", + baseUrl: "https://ark.cn-beijing.volces.com/api/coding", + mode: "proxy", + apiFormat: "anthropic", + modelRoutes: brandedRoutes( + "ark-code-latest", + "ark-code-latest", + "ark-code-latest", + ), + icon: "huoshan", + iconColor: "#3370FF", + isPartner: true, + partnerPromotionKey: "volcengine_agentplan", + }, + { + name: "BytePlus", + websiteUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + category: "cn_official", + baseUrl: "https://ark.ap-southeast.bytepluses.com/api/coding", + mode: "proxy", + apiFormat: "anthropic", + modelRoutes: brandedRoutes( + "ark-code-latest", + "ark-code-latest", + "ark-code-latest", + ), + icon: "byteplus", + iconColor: "#3370FF", + isPartner: true, + partnerPromotionKey: "byteplus", + }, + { + name: "DouBaoSeed", + websiteUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + category: "cn_official", + baseUrl: "https://ark.cn-beijing.volces.com/api/compatible", + mode: "proxy", + apiFormat: "anthropic", + modelRoutes: brandedRoutes( + "doubao-seed-2-0-code-preview-latest", + "doubao-seed-2-0-code-preview-latest", + "doubao-seed-2-0-code-preview-latest", + ), + isPartner: true, + partnerPromotionKey: "doubaoseed", + icon: "doubao", + iconColor: "#3370FF", + }, { name: "Gemini Native", websiteUrl: "https://ai.google.dev/gemini-api", @@ -398,66 +471,6 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [ icon: "minimax", iconColor: "#FF6B6B", }, - { - name: "DouBaoSeed", - websiteUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - category: "cn_official", - baseUrl: "https://ark.cn-beijing.volces.com/api/compatible", - mode: "proxy", - apiFormat: "anthropic", - modelRoutes: brandedRoutes( - "doubao-seed-2-0-code-preview-latest", - "doubao-seed-2-0-code-preview-latest", - "doubao-seed-2-0-code-preview-latest", - ), - isPartner: true, - partnerPromotionKey: "doubaoseed", - icon: "doubao", - iconColor: "#3370FF", - }, - { - name: "火山Agentplan", - websiteUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - category: "cn_official", - baseUrl: "https://ark.cn-beijing.volces.com/api/coding", - mode: "proxy", - apiFormat: "anthropic", - modelRoutes: brandedRoutes( - "ark-code-latest", - "ark-code-latest", - "ark-code-latest", - ), - icon: "huoshan", - iconColor: "#3370FF", - isPartner: true, - partnerPromotionKey: "volcengine_agentplan", - }, - { - name: "BytePlus", - websiteUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - category: "cn_official", - baseUrl: "https://ark.ap-southeast.bytepluses.com/api/coding", - mode: "proxy", - apiFormat: "anthropic", - modelRoutes: brandedRoutes( - "ark-code-latest", - "ark-code-latest", - "ark-code-latest", - ), - icon: "byteplus", - iconColor: "#3370FF", - isPartner: true, - partnerPromotionKey: "byteplus", - }, { name: "BaiLing", websiteUrl: "https://alipaytbox.yuque.com/sxs0ba/ling/get_started", @@ -547,19 +560,6 @@ export const claudeDesktopProviderPresets: ClaudeDesktopProviderPreset[] = [ partnerPromotionKey: "packycode", icon: "packycode", }, - { - name: "PatewayAI", - websiteUrl: "https://pateway.ai", - apiKeyUrl: "https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/", - category: "third_party", - baseUrl: "https://api.pateway.ai", - mode: "direct", - apiFormat: "anthropic", - modelRoutes: passthroughRoutes(), - isPartner: true, - partnerPromotionKey: "patewayai", - icon: "pateway", - }, { name: "ClaudeAPI", websiteUrl: "https://claudeapi.com", diff --git a/src/config/claudeProviderPresets.ts b/src/config/claudeProviderPresets.ts index 47c35b506..c764b9b01 100644 --- a/src/config/claudeProviderPresets.ts +++ b/src/config/claudeProviderPresets.ts @@ -105,6 +105,90 @@ export const providerPresets: ProviderPreset[] = [ partnerPromotionKey: "shengsuanyun", icon: "shengsuanyun", }, + { + name: "PatewayAI", + websiteUrl: "https://pateway.ai", + apiKeyUrl: "https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/", + apiKeyField: "ANTHROPIC_API_KEY", + settingsConfig: { + env: { + ANTHROPIC_BASE_URL: "https://api.pateway.ai", + ANTHROPIC_API_KEY: "", + }, + }, + category: "third_party", + isPartner: true, + partnerPromotionKey: "patewayai", + icon: "pateway", + }, + { + name: "火山Agentplan", + websiteUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + env: { + ANTHROPIC_BASE_URL: "https://ark.cn-beijing.volces.com/api/coding", + ANTHROPIC_AUTH_TOKEN: "", + ANTHROPIC_MODEL: "ark-code-latest", + ANTHROPIC_DEFAULT_HAIKU_MODEL: "ark-code-latest", + ANTHROPIC_DEFAULT_SONNET_MODEL: "ark-code-latest", + ANTHROPIC_DEFAULT_OPUS_MODEL: "ark-code-latest", + }, + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "volcengine_agentplan", + icon: "huoshan", + iconColor: "#3370FF", + }, + { + name: "BytePlus", + websiteUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + env: { + ANTHROPIC_BASE_URL: + "https://ark.ap-southeast.bytepluses.com/api/coding", + ANTHROPIC_AUTH_TOKEN: "", + ANTHROPIC_MODEL: "ark-code-latest", + ANTHROPIC_DEFAULT_HAIKU_MODEL: "ark-code-latest", + ANTHROPIC_DEFAULT_SONNET_MODEL: "ark-code-latest", + ANTHROPIC_DEFAULT_OPUS_MODEL: "ark-code-latest", + }, + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "byteplus", + icon: "byteplus", + iconColor: "#3370FF", + }, + { + name: "DouBaoSeed", + websiteUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + env: { + ANTHROPIC_BASE_URL: "https://ark.cn-beijing.volces.com/api/compatible", + ANTHROPIC_AUTH_TOKEN: "", + API_TIMEOUT_MS: "3000000", + ANTHROPIC_MODEL: "doubao-seed-2-0-code-preview-latest", + ANTHROPIC_DEFAULT_SONNET_MODEL: "doubao-seed-2-0-code-preview-latest", + ANTHROPIC_DEFAULT_OPUS_MODEL: "doubao-seed-2-0-code-preview-latest", + ANTHROPIC_DEFAULT_HAIKU_MODEL: "doubao-seed-2-0-code-preview-latest", + }, + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "doubaoseed", + icon: "doubao", + iconColor: "#3370FF", + }, { name: "Gemini Native", websiteUrl: "https://ai.google.dev/gemini-api", @@ -411,73 +495,6 @@ export const providerPresets: ProviderPreset[] = [ icon: "minimax", iconColor: "#FF6B6B", }, - { - name: "DouBaoSeed", - websiteUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - env: { - ANTHROPIC_BASE_URL: "https://ark.cn-beijing.volces.com/api/compatible", - ANTHROPIC_AUTH_TOKEN: "", - API_TIMEOUT_MS: "3000000", - ANTHROPIC_MODEL: "doubao-seed-2-0-code-preview-latest", - ANTHROPIC_DEFAULT_SONNET_MODEL: "doubao-seed-2-0-code-preview-latest", - ANTHROPIC_DEFAULT_OPUS_MODEL: "doubao-seed-2-0-code-preview-latest", - ANTHROPIC_DEFAULT_HAIKU_MODEL: "doubao-seed-2-0-code-preview-latest", - }, - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "doubaoseed", - icon: "doubao", - iconColor: "#3370FF", - }, - { - name: "火山Agentplan", - websiteUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - env: { - ANTHROPIC_BASE_URL: "https://ark.cn-beijing.volces.com/api/coding", - ANTHROPIC_AUTH_TOKEN: "", - ANTHROPIC_MODEL: "ark-code-latest", - ANTHROPIC_DEFAULT_HAIKU_MODEL: "ark-code-latest", - ANTHROPIC_DEFAULT_SONNET_MODEL: "ark-code-latest", - ANTHROPIC_DEFAULT_OPUS_MODEL: "ark-code-latest", - }, - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "volcengine_agentplan", - icon: "huoshan", - iconColor: "#3370FF", - }, - { - name: "BytePlus", - websiteUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - env: { - ANTHROPIC_BASE_URL: "https://ark.ap-southeast.bytepluses.com/api/coding", - ANTHROPIC_AUTH_TOKEN: "", - ANTHROPIC_MODEL: "ark-code-latest", - ANTHROPIC_DEFAULT_HAIKU_MODEL: "ark-code-latest", - ANTHROPIC_DEFAULT_SONNET_MODEL: "ark-code-latest", - ANTHROPIC_DEFAULT_OPUS_MODEL: "ark-code-latest", - }, - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "byteplus", - icon: "byteplus", - iconColor: "#3370FF", - }, { name: "BaiLing", websiteUrl: "https://alipaytbox.yuque.com/sxs0ba/ling/get_started", @@ -587,22 +604,6 @@ export const providerPresets: ProviderPreset[] = [ partnerPromotionKey: "packycode", // 促销信息 i18n key icon: "packycode", }, - { - name: "PatewayAI", - websiteUrl: "https://pateway.ai", - apiKeyUrl: "https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/", - apiKeyField: "ANTHROPIC_API_KEY", - settingsConfig: { - env: { - ANTHROPIC_BASE_URL: "https://api.pateway.ai", - ANTHROPIC_API_KEY: "", - }, - }, - category: "third_party", - isPartner: true, - partnerPromotionKey: "patewayai", - icon: "pateway", - }, { name: "ClaudeAPI", websiteUrl: "https://claudeapi.com", diff --git a/src/config/codexProviderPresets.ts b/src/config/codexProviderPresets.ts index e9ee9ce63..2e42952cb 100644 --- a/src/config/codexProviderPresets.ts +++ b/src/config/codexProviderPresets.ts @@ -94,6 +94,22 @@ export const codexProviderPresets: CodexProviderPreset[] = [ partnerPromotionKey: "shengsuanyun", icon: "shengsuanyun", }, + { + name: "PatewayAI", + websiteUrl: "https://pateway.ai", + apiKeyUrl: "https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/", + category: "third_party", + auth: generateThirdPartyAuth(""), + config: generateThirdPartyConfig( + "patewayai", + "https://api.pateway.ai/v1", + "gpt-5.5", + ), + endpointCandidates: ["https://api.pateway.ai/v1"], + isPartner: true, + partnerPromotionKey: "patewayai", + icon: "pateway", + }, { name: "Azure OpenAI", websiteUrl: @@ -170,22 +186,6 @@ requires_openai_auth = true`, partnerPromotionKey: "packycode", // 促销信息 i18n key icon: "packycode", }, - { - name: "PatewayAI", - websiteUrl: "https://pateway.ai", - apiKeyUrl: "https://pateway.ai/?ch=etzpm8&aff=WB6M6F67#/", - category: "third_party", - auth: generateThirdPartyAuth(""), - config: generateThirdPartyConfig( - "patewayai", - "https://api.pateway.ai/v1", - "gpt-5.5", - ), - endpointCandidates: ["https://api.pateway.ai/v1"], - isPartner: true, - partnerPromotionKey: "patewayai", - icon: "pateway", - }, { name: "ClaudeCN", websiteUrl: "https://claudecn.top", diff --git a/src/config/hermesProviderPresets.ts b/src/config/hermesProviderPresets.ts index 1cc0cdb27..8a89fc99f 100644 --- a/src/config/hermesProviderPresets.ts +++ b/src/config/hermesProviderPresets.ts @@ -148,6 +148,96 @@ export const hermesProviderPresets: HermesProviderPreset[] = [ model: { default: "openai/gpt-5.4", provider: "shengsuanyun" }, }, }, + { + name: "火山Agentplan", + websiteUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + name: "ark_agentplan", + base_url: "https://ark.cn-beijing.volces.com/api/coding", + api_key: "", + api_mode: "anthropic_messages", + models: [ + { + id: "ark-code-latest", + name: "Ark Code Latest", + }, + ], + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "volcengine_agentplan", + icon: "huoshan", + iconColor: "#3370FF", + suggestedDefaults: { + model: { + default: "ark-code-latest", + provider: "ark_agentplan", + }, + }, + }, + { + name: "BytePlus", + websiteUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + name: "byteplus", + base_url: "https://ark.ap-southeast.bytepluses.com/api/coding", + api_key: "", + api_mode: "anthropic_messages", + models: [ + { + id: "ark-code-latest", + name: "Ark Code Latest", + }, + ], + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "byteplus", + icon: "byteplus", + iconColor: "#3370FF", + suggestedDefaults: { + model: { + default: "ark-code-latest", + provider: "byteplus", + }, + }, + }, + { + name: "DouBaoSeed", + websiteUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + name: "doubao_seed", + base_url: "https://ark.cn-beijing.volces.com/api/compatible", + api_key: "", + api_mode: "anthropic_messages", + models: [ + { + id: "doubao-seed-2-0-code-preview-latest", + name: "Doubao Seed 2.0 Code Preview", + }, + ], + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "doubaoseed", + icon: "doubao", + iconColor: "#3370FF", + suggestedDefaults: { + model: { + default: "doubao-seed-2-0-code-preview-latest", + provider: "doubao_seed", + }, + }, + }, { name: "OpenRouter", nameKey: "providerForm.presets.openrouter", @@ -531,96 +621,6 @@ export const hermesProviderPresets: HermesProviderPreset[] = [ model: { default: "MiniMax-M2.7", provider: "minimax_en" }, }, }, - { - name: "DouBaoSeed", - websiteUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - name: "doubao_seed", - base_url: "https://ark.cn-beijing.volces.com/api/compatible", - api_key: "", - api_mode: "anthropic_messages", - models: [ - { - id: "doubao-seed-2-0-code-preview-latest", - name: "Doubao Seed 2.0 Code Preview", - }, - ], - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "doubaoseed", - icon: "doubao", - iconColor: "#3370FF", - suggestedDefaults: { - model: { - default: "doubao-seed-2-0-code-preview-latest", - provider: "doubao_seed", - }, - }, - }, - { - name: "火山Agentplan", - websiteUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - name: "ark_agentplan", - base_url: "https://ark.cn-beijing.volces.com/api/coding", - api_key: "", - api_mode: "anthropic_messages", - models: [ - { - id: "ark-code-latest", - name: "Ark Code Latest", - }, - ], - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "volcengine_agentplan", - icon: "huoshan", - iconColor: "#3370FF", - suggestedDefaults: { - model: { - default: "ark-code-latest", - provider: "ark_agentplan", - }, - }, - }, - { - name: "BytePlus", - websiteUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - name: "byteplus", - base_url: "https://ark.ap-southeast.bytepluses.com/api/coding", - api_key: "", - api_mode: "anthropic_messages", - models: [ - { - id: "ark-code-latest", - name: "Ark Code Latest", - }, - ], - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "byteplus", - icon: "byteplus", - iconColor: "#3370FF", - suggestedDefaults: { - model: { - default: "ark-code-latest", - provider: "byteplus", - }, - }, - }, { name: "BaiLing", websiteUrl: "https://alipaytbox.yuque.com/sxs0ba/ling/get_started", diff --git a/src/config/openclawProviderPresets.ts b/src/config/openclawProviderPresets.ts index 9db0af18a..0efe70a0e 100644 --- a/src/config/openclawProviderPresets.ts +++ b/src/config/openclawProviderPresets.ts @@ -104,6 +104,118 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [ }, }, }, + { + name: "火山Agentplan", + websiteUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3", + apiKey: "", + api: "openai-completions", + models: [ + { + id: "ark-code-latest", + name: "Ark Code Latest", + contextWindow: 256000, + }, + ], + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "volcengine_agentplan", + icon: "huoshan", + iconColor: "#3370FF", + templateValues: { + apiKey: { + label: "API Key", + placeholder: "", + editorValue: "", + }, + }, + suggestedDefaults: { + model: { primary: "ark_agentplan/ark-code-latest" }, + modelCatalog: { + "ark_agentplan/ark-code-latest": { alias: "Ark Code" }, + }, + }, + }, + { + name: "BytePlus", + websiteUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + baseUrl: "https://ark.ap-southeast.bytepluses.com/api/coding/v3", + apiKey: "", + api: "openai-completions", + models: [ + { + id: "ark-code-latest", + name: "Ark Code Latest", + contextWindow: 256000, + }, + ], + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "byteplus", + icon: "byteplus", + iconColor: "#3370FF", + templateValues: { + apiKey: { + label: "API Key", + placeholder: "", + editorValue: "", + }, + }, + suggestedDefaults: { + model: { primary: "byteplus/ark-code-latest" }, + modelCatalog: { + "byteplus/ark-code-latest": { alias: "Ark Code" }, + }, + }, + }, + { + name: "DouBaoSeed", + websiteUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + baseUrl: "https://ark.cn-beijing.volces.com/api/v3", + apiKey: "", + api: "openai-completions", + models: [ + { + id: "doubao-seed-2-0-code-preview-latest", + name: "DouBao Seed Code Preview", + contextWindow: 128000, + cost: { input: 0.002, output: 0.006 }, + }, + ], + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "doubaoseed", + icon: "doubao", + iconColor: "#3370FF", + templateValues: { + apiKey: { + label: "API Key", + placeholder: "", + editorValue: "", + }, + }, + suggestedDefaults: { + model: { primary: "doubaoseed/doubao-seed-2-0-code-preview-latest" }, + modelCatalog: { + "doubaoseed/doubao-seed-2-0-code-preview-latest": { alias: "DouBao" }, + }, + }, + }, // ========== Chinese Officials ========== { name: "DeepSeek", @@ -589,118 +701,6 @@ export const openclawProviderPresets: OpenClawProviderPreset[] = [ modelCatalog: { "longcat/LongCat-Flash-Chat": { alias: "LongCat" } }, }, }, - { - name: "DouBaoSeed", - websiteUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - baseUrl: "https://ark.cn-beijing.volces.com/api/v3", - apiKey: "", - api: "openai-completions", - models: [ - { - id: "doubao-seed-2-0-code-preview-latest", - name: "DouBao Seed Code Preview", - contextWindow: 128000, - cost: { input: 0.002, output: 0.006 }, - }, - ], - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "doubaoseed", - icon: "doubao", - iconColor: "#3370FF", - templateValues: { - apiKey: { - label: "API Key", - placeholder: "", - editorValue: "", - }, - }, - suggestedDefaults: { - model: { primary: "doubaoseed/doubao-seed-2-0-code-preview-latest" }, - modelCatalog: { - "doubaoseed/doubao-seed-2-0-code-preview-latest": { alias: "DouBao" }, - }, - }, - }, - { - name: "火山Agentplan", - websiteUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3", - apiKey: "", - api: "openai-completions", - models: [ - { - id: "ark-code-latest", - name: "Ark Code Latest", - contextWindow: 256000, - }, - ], - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "volcengine_agentplan", - icon: "huoshan", - iconColor: "#3370FF", - templateValues: { - apiKey: { - label: "API Key", - placeholder: "", - editorValue: "", - }, - }, - suggestedDefaults: { - model: { primary: "ark_agentplan/ark-code-latest" }, - modelCatalog: { - "ark_agentplan/ark-code-latest": { alias: "Ark Code" }, - }, - }, - }, - { - name: "BytePlus", - websiteUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - baseUrl: "https://ark.ap-southeast.bytepluses.com/api/coding/v3", - apiKey: "", - api: "openai-completions", - models: [ - { - id: "ark-code-latest", - name: "Ark Code Latest", - contextWindow: 256000, - }, - ], - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "byteplus", - icon: "byteplus", - iconColor: "#3370FF", - templateValues: { - apiKey: { - label: "API Key", - placeholder: "", - editorValue: "", - }, - }, - suggestedDefaults: { - model: { primary: "byteplus/ark-code-latest" }, - modelCatalog: { - "byteplus/ark-code-latest": { alias: "Ark Code" }, - }, - }, - }, { name: "BaiLing", websiteUrl: "https://alipaytbox.yuque.com/sxs0ba/ling/get_started", diff --git a/src/config/opencodeProviderPresets.ts b/src/config/opencodeProviderPresets.ts index 569e8b947..c51a20d79 100644 --- a/src/config/opencodeProviderPresets.ts +++ b/src/config/opencodeProviderPresets.ts @@ -326,6 +326,105 @@ export const opencodeProviderPresets: OpenCodeProviderPreset[] = [ }, }, }, + { + name: "火山Agentplan", + websiteUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + npm: "@ai-sdk/openai-compatible", + name: "火山Agentplan", + options: { + baseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", + apiKey: "", + setCacheKey: true, + }, + models: { + "ark-code-latest": { + name: "Ark Code Latest", + }, + }, + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "volcengine_agentplan", + icon: "huoshan", + iconColor: "#3370FF", + templateValues: { + apiKey: { + label: "API Key", + placeholder: "", + editorValue: "", + }, + }, + }, + { + name: "BytePlus", + websiteUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + npm: "@ai-sdk/openai-compatible", + name: "BytePlus", + options: { + baseURL: "https://ark.ap-southeast.bytepluses.com/api/coding/v3", + apiKey: "", + setCacheKey: true, + }, + models: { + "ark-code-latest": { + name: "Ark Code Latest", + }, + }, + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "byteplus", + icon: "byteplus", + iconColor: "#3370FF", + templateValues: { + apiKey: { + label: "API Key", + placeholder: "", + editorValue: "", + }, + }, + }, + { + name: "DouBaoSeed", + websiteUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + apiKeyUrl: + "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", + settingsConfig: { + npm: "@ai-sdk/openai-compatible", + name: "DouBaoSeed", + options: { + baseURL: "https://ark.cn-beijing.volces.com/api/v3", + apiKey: "", + setCacheKey: true, + }, + models: { + "doubao-seed-2-0-code-preview-latest": { + name: "Doubao Seed Code Preview", + }, + }, + }, + category: "cn_official", + isPartner: true, + partnerPromotionKey: "doubaoseed", + icon: "doubao", + iconColor: "#3370FF", + templateValues: { + apiKey: { + label: "API Key", + placeholder: "", + editorValue: "", + }, + }, + }, { name: "DeepSeek", websiteUrl: "https://platform.deepseek.com", @@ -783,105 +882,6 @@ export const opencodeProviderPresets: OpenCodeProviderPreset[] = [ }, }, }, - { - name: "DouBaoSeed", - websiteUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey?apikey=%7B%7D&utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - npm: "@ai-sdk/openai-compatible", - name: "DouBaoSeed", - options: { - baseURL: "https://ark.cn-beijing.volces.com/api/v3", - apiKey: "", - setCacheKey: true, - }, - models: { - "doubao-seed-2-0-code-preview-latest": { - name: "Doubao Seed Code Preview", - }, - }, - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "doubaoseed", - icon: "doubao", - iconColor: "#3370FF", - templateValues: { - apiKey: { - label: "API Key", - placeholder: "", - editorValue: "", - }, - }, - }, - { - name: "火山Agentplan", - websiteUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.volcengine.com/activity/agentplan?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - npm: "@ai-sdk/openai-compatible", - name: "火山Agentplan", - options: { - baseURL: "https://ark.cn-beijing.volces.com/api/coding/v3", - apiKey: "", - setCacheKey: true, - }, - models: { - "ark-code-latest": { - name: "Ark Code Latest", - }, - }, - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "volcengine_agentplan", - icon: "huoshan", - iconColor: "#3370FF", - templateValues: { - apiKey: { - label: "API Key", - placeholder: "", - editorValue: "", - }, - }, - }, - { - name: "BytePlus", - websiteUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - apiKeyUrl: - "https://www.byteplus.com/en/product/modelark?utm_campaign=hw&utm_content=ccswitch&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=ccswitch", - settingsConfig: { - npm: "@ai-sdk/openai-compatible", - name: "BytePlus", - options: { - baseURL: "https://ark.ap-southeast.bytepluses.com/api/coding/v3", - apiKey: "", - setCacheKey: true, - }, - models: { - "ark-code-latest": { - name: "Ark Code Latest", - }, - }, - }, - category: "cn_official", - isPartner: true, - partnerPromotionKey: "byteplus", - icon: "byteplus", - iconColor: "#3370FF", - templateValues: { - apiKey: { - label: "API Key", - placeholder: "", - editorValue: "", - }, - }, - }, { name: "BaiLing", websiteUrl: "https://alipaytbox.yuque.com/sxs0ba/ling/get_started", diff --git a/tests/components/ProviderPresetSelector.test.tsx b/tests/components/ProviderPresetSelector.test.tsx new file mode 100644 index 000000000..9d0a874d6 --- /dev/null +++ b/tests/components/ProviderPresetSelector.test.tsx @@ -0,0 +1,71 @@ +import { render, screen } from "@testing-library/react"; +import { describe, expect, it, vi } from "vitest"; +import { useForm } from "react-hook-form"; +import { Form } from "@/components/ui/form"; +import { ProviderPresetSelector } from "@/components/providers/forms/ProviderPresetSelector"; + +describe("ProviderPresetSelector", () => { + it("按传入的预设数组顺序渲染,不按分类重新排序", () => { + const Wrapper = () => { + const form = useForm(); + + return ( +
+ + + ); + }; + + render(); + + expect( + screen.getAllByRole("button").map((button) => button.textContent), + ).toEqual(["providerPreset.custom", "First", "Second", "Third", "Fourth"]); + }); +}); diff --git a/tests/config/providerPresetOrder.test.ts b/tests/config/providerPresetOrder.test.ts new file mode 100644 index 000000000..4de21e906 --- /dev/null +++ b/tests/config/providerPresetOrder.test.ts @@ -0,0 +1,70 @@ +import { describe, expect, it } from "vitest"; +import { providerPresets } from "@/config/claudeProviderPresets"; +import { claudeDesktopProviderPresets } from "@/config/claudeDesktopProviderPresets"; +import { codexProviderPresets } from "@/config/codexProviderPresets"; +import { opencodeProviderPresets } from "@/config/opencodeProviderPresets"; +import { openclawProviderPresets } from "@/config/openclawProviderPresets"; +import { hermesProviderPresets } from "@/config/hermesProviderPresets"; + +const namesOf = (presets: Array<{ name: string }>) => + presets.map((preset) => preset.name); + +const expectInOrder = (names: string[], expected: string[]) => { + const indexes = expected.map((name) => names.indexOf(name)); + + expect(indexes).not.toContain(-1); + expect(indexes).toEqual(expected.map((_, index) => indexes[0] + index)); +}; + +describe("provider preset order", () => { + it("Claude 预设按合作伙伴优先顺序排列", () => { + expectInOrder(namesOf(providerPresets), [ + "Shengsuanyun", + "PatewayAI", + "火山Agentplan", + "BytePlus", + "DouBaoSeed", + ]); + }); + + it("Claude Desktop 预设按合作伙伴优先顺序排列", () => { + expectInOrder(namesOf(claudeDesktopProviderPresets), [ + "Shengsuanyun", + "PatewayAI", + "火山Agentplan", + "BytePlus", + "DouBaoSeed", + ]); + }); + + it("Codex 预设把 PatewayAI 放在胜算云后面", () => { + expectInOrder(namesOf(codexProviderPresets), ["Shengsuanyun", "PatewayAI"]); + }); + + it("OpenCode 预设把火山、BytePlus、DouBaoSeed 放在胜算云后面", () => { + expectInOrder(namesOf(opencodeProviderPresets), [ + "Shengsuanyun", + "火山Agentplan", + "BytePlus", + "DouBaoSeed", + ]); + }); + + it("OpenClaw 预设把火山、BytePlus、DouBaoSeed 放在胜算云后面", () => { + expectInOrder(namesOf(openclawProviderPresets), [ + "Shengsuanyun", + "火山Agentplan", + "BytePlus", + "DouBaoSeed", + ]); + }); + + it("Hermes 预设把火山、BytePlus、DouBaoSeed 放在胜算云后面", () => { + expectInOrder(namesOf(hermesProviderPresets), [ + "Shengsuanyun", + "火山Agentplan", + "BytePlus", + "DouBaoSeed", + ]); + }); +});