Merge pull request #2092 from PaRaD1SE98/main

fix: migrate modelConfig state
This commit is contained in:
Yifei Zhang 2023-06-22 11:31:46 +08:00 committed by GitHub
commit ad1fe8762b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,14 +176,15 @@ export const useAppConfig = create<ChatConfigStore>()(
}), }),
{ {
name: StoreKey.Config, name: StoreKey.Config,
version: 2, version: 3,
migrate(persistedState, version) { migrate(persistedState, version) {
if (version === 2) return persistedState as any; if (version === 3) return persistedState as any;
const state = persistedState as ChatConfig; const state = persistedState as ChatConfig;
state.modelConfig.sendMemory = true; state.modelConfig.sendMemory = true;
state.modelConfig.historyMessageCount = 4; state.modelConfig.historyMessageCount = 4;
state.modelConfig.compressMessageLengthThreshold = 1000; state.modelConfig.compressMessageLengthThreshold = 1000;
state.modelConfig.frequency_penalty = 0;
state.dontShowMaskSplashScreen = false; state.dontShowMaskSplashScreen = false;
return state; return state;