From a9c92248352342f41119cb26cb07463aa553314a Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Tue, 18 Nov 2025 11:01:13 +0800 Subject: [PATCH] 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. --- src/renderer/src/config/providers.ts | 2 +- src/renderer/src/store/index.ts | 2 +- src/renderer/src/store/migrate.ts | 22 ++++++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/config/providers.ts b/src/renderer/src/config/providers.ts index 5b0875b3d0..92ac37e9f1 100644 --- a/src/renderer/src/config/providers.ts +++ b/src/renderer/src/config/providers.ts @@ -275,7 +275,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record = 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 diff --git a/src/renderer/src/store/index.ts b/src/renderer/src/store/index.ts index edc23f7895..16254dfaa8 100644 --- a/src/renderer/src/store/index.ts +++ b/src/renderer/src/store/index.ts @@ -67,7 +67,7 @@ const persistedReducer = persistReducer( { key: 'cherry-studio', storage, - version: 175, + version: 176, blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs', 'toolPermissions'], migrate }, diff --git a/src/renderer/src/store/migrate.ts b/src/renderer/src/store/migrate.ts index 5a7f3b3a0c..8b8b00d20e 100644 --- a/src/renderer/src/store/migrate.ts +++ b/src/renderer/src/store/migrate.ts @@ -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 + } } }