diff --git a/src/renderer/src/config/providers.ts b/src/renderer/src/config/providers.ts index 9e2831ee6e..f49794aaa7 100644 --- a/src/renderer/src/config/providers.ts +++ b/src/renderer/src/config/providers.ts @@ -212,6 +212,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record = type: 'openai', apiKey: '', apiHost: 'https://api.302.ai', + anthropicApiHost: 'https://api.302.ai', models: SYSTEM_MODELS['302ai'], isSystem: true, enabled: false diff --git a/src/renderer/src/pages/code/index.ts b/src/renderer/src/pages/code/index.ts index 78347cd2c7..81f5ddddc3 100644 --- a/src/renderer/src/pages/code/index.ts +++ b/src/renderer/src/pages/code/index.ts @@ -43,6 +43,7 @@ export const CLAUDE_SUPPORTED_PROVIDERS = [ 'dmxapi', 'new-api', 'cherryin', + '302ai', ...CLAUDE_OFFICIAL_SUPPORTED_PROVIDERS ] export const OPENAI_CODEX_SUPPORTED_PROVIDERS = ['openai', 'openrouter', 'aihubmix', 'new-api', 'cherryin'] @@ -96,6 +97,11 @@ export const getCodeToolsApiBaseUrl = (model: Model, type: EndpointType) => { anthropic: { api_base_url: 'https://api.minimaxi.com/anthropic' } + }, + '302ai': { + anthropic: { + api_base_url: 'https://api.302.ai' + } } } diff --git a/src/renderer/src/store/index.ts b/src/renderer/src/store/index.ts index 3d21d12cc7..4727bdc1e7 100644 --- a/src/renderer/src/store/index.ts +++ b/src/renderer/src/store/index.ts @@ -83,7 +83,7 @@ const persistedReducer = persistReducer( { key: 'cherry-studio', storage, - version: 191, + version: 192, blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs', 'toolPermissions'], migrate }, diff --git a/src/renderer/src/store/migrate.ts b/src/renderer/src/store/migrate.ts index 9375dc3b75..272d9fbaa4 100644 --- a/src/renderer/src/store/migrate.ts +++ b/src/renderer/src/store/migrate.ts @@ -3144,6 +3144,20 @@ const migrateConfig = { logger.error('migrate 191 error', error as Error) return state } + }, + '192': (state: RootState) => { + try { + state.llm.providers.forEach((provider) => { + if (provider.id === '302ai') { + provider.anthropicApiHost = 'https://api.302.ai' + } + }) + logger.info('migrate 192 success') + return state + } catch (error) { + logger.error('migrate 192 error', error as Error) + return state + } } }