From e79bfcee77a1a92559be7df5c3388f5a6c8e1df7 Mon Sep 17 00:00:00 2001 From: icarus Date: Fri, 22 Aug 2025 16:31:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(store):=20=E6=9B=B4=E6=96=B0=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E5=AD=98=E5=82=A8=E7=89=88=E6=9C=AC=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0OCR=E9=85=8D=E7=BD=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加137版本迁移逻辑,初始化OCR提供者和默认图像提供者配置 --- src/renderer/src/store/index.ts | 2 +- src/renderer/src/store/migrate.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/store/index.ts b/src/renderer/src/store/index.ts index 839fa279de..cdd3be560d 100644 --- a/src/renderer/src/store/index.ts +++ b/src/renderer/src/store/index.ts @@ -64,7 +64,7 @@ const persistedReducer = persistReducer( { key: 'cherry-studio', storage, - version: 136, + version: 137, blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs'], migrate }, diff --git a/src/renderer/src/store/migrate.ts b/src/renderer/src/store/migrate.ts index ee677ead39..155f0a50b0 100644 --- a/src/renderer/src/store/migrate.ts +++ b/src/renderer/src/store/migrate.ts @@ -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 + } } }