mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-04 11:49:02 +08:00
fix: migration for missing providers … (#10438)
chore: bump version to 1.6.3 and add migration for missing providers #10425 fix: #10425 - Updated the version from 158 to 159 in the persisted reducer configuration. - Implemented a migration function to ensure missing system providers are added to the state during the migration to version 159, enhancing state consistency.
This commit is contained in:
parent
504531d4d5
commit
65d066cbef
@ -67,7 +67,7 @@ const persistedReducer = persistReducer(
|
||||
{
|
||||
key: 'cherry-studio',
|
||||
storage,
|
||||
version: 158,
|
||||
version: 159,
|
||||
blacklist: ['runtime', 'messages', 'messageBlocks', 'tabs'],
|
||||
migrate
|
||||
},
|
||||
|
||||
@ -85,6 +85,15 @@ function addProvider(state: RootState, id: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Fix missing provider
|
||||
function fixMissingProvider(state: RootState) {
|
||||
SYSTEM_PROVIDERS.forEach((p) => {
|
||||
if (!state.llm.providers.find((provider) => provider.id === p.id)) {
|
||||
state.llm.providers.push(p)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// add ocr provider
|
||||
function addOcrProvider(state: RootState, provider: BuiltinOcrProvider) {
|
||||
if (!state.ocr.providers.find((p) => p.id === provider.id)) {
|
||||
@ -2553,6 +2562,7 @@ const migrateConfig = {
|
||||
'159': (state: RootState) => {
|
||||
try {
|
||||
addProvider(state, 'ovms')
|
||||
fixMissingProvider(state)
|
||||
return state
|
||||
} catch (error) {
|
||||
logger.error('migrate 159 error', error as Error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user