feat: add openrouter support and update migration version to 188 (#12059)

* feat: add openrouter support and update migration version to 188
This commit is contained in:
SuYao 2025-12-21 20:15:17 +08:00 committed by GitHub
parent e16413de76
commit 26a3bd0259
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 3 deletions

View File

@ -34,7 +34,9 @@ export const CLAUDE_OFFICIAL_SUPPORTED_PROVIDERS = [
'minimax',
'longcat',
SystemProviderIds.qiniu,
SystemProviderIds.silicon
SystemProviderIds.silicon,
SystemProviderIds.mimo,
SystemProviderIds.openrouter
]
export const CLAUDE_SUPPORTED_PROVIDERS = [
'aihubmix',

View File

@ -81,7 +81,8 @@ const ANTHROPIC_COMPATIBLE_PROVIDER_IDS = [
SystemProviderIds.silicon,
SystemProviderIds.qiniu,
SystemProviderIds.dmxapi,
SystemProviderIds.mimo
SystemProviderIds.mimo,
SystemProviderIds.openrouter
] as const
type AnthropicCompatibleProviderId = (typeof ANTHROPIC_COMPATIBLE_PROVIDER_IDS)[number]

View File

@ -67,7 +67,7 @@ const persistedReducer = persistReducer(
{
key: 'cherry-studio',
storage,
version: 187,
version: 188,
blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs', 'toolPermissions'],
migrate
},

View File

@ -3053,6 +3053,21 @@ const migrateConfig = {
logger.error('migrate 187 error', error as Error)
return state
}
},
// 1.7.7
'188': (state: RootState) => {
try {
state.llm.providers.forEach((provider) => {
if (provider.id === SystemProviderIds.openrouter) {
provider.anthropicApiHost = 'https://openrouter.ai/api'
}
})
logger.info('migrate 188 success')
return state
} catch (error) {
logger.error('migrate 188 error', error as Error)
return state
}
}
}