chore: update migration logic for version 186

- Incremented the version number in the persisted reducer from 185 to 186.
- Added migration logic for version 186 to handle API server settings and OpenAI configuration updates, ensuring compatibility with existing user settings.

This change prepares the application for the new migration requirements and maintains backward compatibility.
This commit is contained in:
kangfenmao 2025-12-17 15:41:17 +08:00
parent 782f8496e0
commit bdd272b7cd
2 changed files with 26 additions and 26 deletions

View File

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

View File

@ -2913,31 +2913,6 @@ const migrateConfig = {
return state
}
},
'180': (state: RootState) => {
try {
if (state.settings.apiServer) {
state.settings.apiServer.host = API_SERVER_DEFAULTS.HOST
}
// @ts-expect-error
if (state.settings.openAI.summaryText === 'undefined') {
state.settings.openAI.summaryText = undefined
}
// @ts-expect-error
if (state.settings.openAI.verbosity === 'undefined') {
state.settings.openAI.verbosity = undefined
}
state.llm.providers.forEach((provider) => {
if (provider.id === SystemProviderIds.ollama) {
provider.type = 'ollama'
}
})
logger.info('migrate 180 success')
return state
} catch (error) {
logger.error('migrate 180 error', error as Error)
return state
}
},
'181': (state: RootState) => {
try {
state.llm.providers.forEach((provider) => {
@ -3038,6 +3013,31 @@ const migrateConfig = {
logger.error('migrate 185 error', error as Error)
return state
}
},
'186': (state: RootState) => {
try {
if (state.settings.apiServer) {
state.settings.apiServer.host = API_SERVER_DEFAULTS.HOST
}
// @ts-expect-error
if (state.settings.openAI.summaryText === 'undefined') {
state.settings.openAI.summaryText = undefined
}
// @ts-expect-error
if (state.settings.openAI.verbosity === 'undefined') {
state.settings.openAI.verbosity = undefined
}
state.llm.providers.forEach((provider) => {
if (provider.id === SystemProviderIds.ollama) {
provider.type = 'ollama'
}
})
logger.info('migrate 186 success')
return state
} catch (error) {
logger.error('migrate 186 error', error as Error)
return state
}
}
}