mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 18:49:45 +08:00
fix: persisted available models ard not be update after source code have been updated
This commit is contained in:
@@ -143,6 +143,21 @@ export const useAppConfig = createPersistStore(
|
||||
{
|
||||
name: StoreKey.Config,
|
||||
version: 4,
|
||||
|
||||
merge(persistedState, currentState) {
|
||||
const state = persistedState as ChatConfig | undefined;
|
||||
if (!state) return { ...currentState };
|
||||
const models = currentState.models.slice();
|
||||
state.models.forEach((pModel) => {
|
||||
const idx = models.findIndex(
|
||||
(v) => v.name === pModel.name && v.provider === pModel.provider,
|
||||
);
|
||||
if (idx !== -1) models[idx] = pModel;
|
||||
else models.push(pModel);
|
||||
});
|
||||
return { ...currentState, ...state, models: models };
|
||||
},
|
||||
|
||||
migrate(persistedState, version) {
|
||||
const state = persistedState as ChatConfig;
|
||||
|
||||
|
Reference in New Issue
Block a user