forked from XiaoMo/ChatGPT-Next-Web
fix: #2295 use correct methods to migrate state
This commit is contained in:
parent
c7e976c8c5
commit
90d8f3117f
@ -139,9 +139,9 @@ export const useAppConfig = create<ChatConfigStore>()(
|
|||||||
name: StoreKey.Config,
|
name: StoreKey.Config,
|
||||||
version: 3.4,
|
version: 3.4,
|
||||||
migrate(persistedState, version) {
|
migrate(persistedState, version) {
|
||||||
if (version === 3.4) return persistedState as any;
|
|
||||||
|
|
||||||
const state = persistedState as ChatConfig;
|
const state = persistedState as ChatConfig;
|
||||||
|
|
||||||
|
if (version < 3.4) {
|
||||||
state.modelConfig.sendMemory = true;
|
state.modelConfig.sendMemory = true;
|
||||||
state.modelConfig.historyMessageCount = 4;
|
state.modelConfig.historyMessageCount = 4;
|
||||||
state.modelConfig.compressMessageLengthThreshold = 1000;
|
state.modelConfig.compressMessageLengthThreshold = 1000;
|
||||||
@ -150,8 +150,9 @@ export const useAppConfig = create<ChatConfigStore>()(
|
|||||||
state.modelConfig.template = DEFAULT_INPUT_TEMPLATE;
|
state.modelConfig.template = DEFAULT_INPUT_TEMPLATE;
|
||||||
state.dontShowMaskSplashScreen = false;
|
state.dontShowMaskSplashScreen = false;
|
||||||
state.hideBuiltinMasks = false;
|
state.hideBuiltinMasks = false;
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state as any;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user