feat(store): 更新持久化存储版本并添加OCR配置迁移

添加137版本迁移逻辑,初始化OCR提供者和默认图像提供者配置
This commit is contained in:
icarus 2025-08-22 16:31:46 +08:00
parent a6aee21a96
commit e79bfcee77
2 changed files with 12 additions and 1 deletions

View File

@ -64,7 +64,7 @@ const persistedReducer = persistReducer(
{
key: 'cherry-studio',
storage,
version: 136,
version: 137,
blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs'],
migrate
},

View File

@ -3,6 +3,7 @@ import { nanoid } from '@reduxjs/toolkit'
import { DEFAULT_CONTEXTCOUNT, DEFAULT_TEMPERATURE, isMac } from '@renderer/config/constant'
import { DEFAULT_MIN_APPS } from '@renderer/config/minapps'
import { isFunctionCallingModel, isNotSupportedTextDelta, SYSTEM_MODELS } from '@renderer/config/models'
import { BUILTIN_OCR_PROVIDERS, DEFAULT_OCR_PROVIDER } from '@renderer/config/ocr'
import { TRANSLATE_PROMPT } from '@renderer/config/prompts'
import {
isSupportArrayContentProvider,
@ -2174,6 +2175,16 @@ const migrateConfig = {
logger.error('migrate 136 error', error as Error)
return state
}
},
'137': (state: RootState) => {
try {
state.ocr.providers = BUILTIN_OCR_PROVIDERS
state.ocr.imageProvider = DEFAULT_OCR_PROVIDER.image
return state
} catch (error) {
logger.error('migrate 136 error', error as Error)
return state
}
}
}