Fix provider comparison issue in model comparison

Fixed an issue where comparing models using the provider object directly resulted in errors. Changed to compare provider.id to ensure the comparison is based on a unique identifier, accurately determining if the models are the same.

If the provider comparison fails, more models will be stored in persistStore. Although this issue is not immediately visible in the frontend due to subsequent processing, it leads to increased memory usage and longer startup times with each page reload.
This commit is contained in:
Aiharara 2025-04-29 04:51:14 +08:00
parent 3809375694
commit e83f2bad84

View File

@ -203,7 +203,7 @@ export const useAppConfig = createPersistStore(
const models = currentState.models.slice();
state.models.forEach((pModel) => {
const idx = models.findIndex(
(v) => v.name === pModel.name && v.provider === pModel.provider,
(v) => v.name === pModel.name && v.provider.id === pModel.provider.id,
);
if (idx !== -1) models[idx] = pModel;
else models.push(pModel);