Merge branch 'Yidadaa:main' into main

This commit is contained in:
Hk-Gosuto
2023-07-16 23:02:53 +08:00
committed by GitHub
12 changed files with 207 additions and 66 deletions

View File

@@ -622,7 +622,7 @@ Reply in ${getLang()} and markdown.`;
}),
{
name: StoreKey.Chat,
version: 3,
version: 3.1,
migrate(persistedState, version) {
const state = persistedState as any;
const newState = JSON.parse(JSON.stringify(state)) as ChatStore;
@@ -650,6 +650,23 @@ Reply in ${getLang()} and markdown.`;
});
}
// Enable `enableInjectSystemPrompts` attribute for old sessions.
// Resolve issue of old sessions not automatically enabling.
if (version < 3.1) {
newState.sessions.forEach((s) => {
if (
// Exclude those already set by user
!s.mask.modelConfig.hasOwnProperty("enableInjectSystemPrompts")
) {
// Because users may have changed this configuration,
// the user's current configuration is used instead of the default
const config = useAppConfig.getState();
s.mask.modelConfig.enableInjectSystemPrompts =
config.modelConfig.enableInjectSystemPrompts;
}
});
}
return newState;
},
},