fix(migrate): update anthropicApiHost for qiniu and longcat providers in migration to version 176

- Added anthropicApiHost configuration for qiniu and longcat providers during state migration.
- Incremented version number in persistedReducer to 176.
- Ensured proper handling of reasoning_effort settings during migration.
This commit is contained in:
kangfenmao 2025-11-18 11:01:13 +08:00
parent 43223fd1f5
commit a9c9224835
3 changed files with 22 additions and 4 deletions

View File

@ -275,7 +275,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record<SystemProviderId, SystemProvider> =
type: 'openai',
apiKey: '',
apiHost: 'https://api.qnaigc.com',
anthropicApiHost: 'https://api.qnaigc.com'
anthropicApiHost: 'https://api.qnaigc.com',
models: SYSTEM_MODELS.qiniu,
isSystem: true,
enabled: false

View File

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

View File

@ -2823,12 +2823,14 @@ const migrateConfig = {
'175': (state: RootState) => {
try {
state.assistants.assistants.forEach((assistant) => {
// @ts-expect-error removed type 'off'
// @ts-ignore
if (assistant.settings?.reasoning_effort === 'off') {
// @ts-ignore
assistant.settings.reasoning_effort = 'none'
}
// @ts-expect-error removed type 'off'
// @ts-ignore
if (assistant.settings?.reasoning_effort_cache === 'off') {
// @ts-ignore
assistant.settings.reasoning_effort_cache = 'none'
}
})
@ -2838,6 +2840,22 @@ const migrateConfig = {
logger.error('migrate 175 error', error as Error)
return state
}
},
'176': (state: RootState) => {
try {
state.llm.providers.forEach((provider) => {
if (provider.id === SystemProviderIds.qiniu) {
provider.anthropicApiHost = 'https://api.qnaigc.com'
}
if (provider.id === SystemProviderIds.longcat) {
provider.anthropicApiHost = 'https://api.longcat.chat/anthropic'
}
})
return state
} catch (error) {
logger.error('migrate 176 error', error as Error)
return state
}
}
}