mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-15 04:18:18 +00:00
fix: turning a model back on or showing it again in admin Models is saved
This commit is contained in:
parent
93d25dbe3b
commit
7d3a5462ba
1 changed files with 10 additions and 2 deletions
|
|
@ -506,6 +506,10 @@
|
|||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
savedModels = [...savedModels, res];
|
||||
}
|
||||
|
||||
if (res && showToast) {
|
||||
toast.success($i18n.t('Model updated successfully'));
|
||||
await init().catch((error) => toast.error(`${error}`));
|
||||
|
|
@ -515,8 +519,8 @@
|
|||
};
|
||||
|
||||
const toggleModelHandler = async (model) => {
|
||||
if (!Object.keys(model).includes('base_model_id') && !isPresetModel(model)) {
|
||||
await createNewModel(localStorage.token, {
|
||||
if (!savedModels.find((m: ModelListItem) => m.id === model.id) && !isPresetModel(model)) {
|
||||
const res = await createNewModel(localStorage.token, {
|
||||
id: model.id,
|
||||
name: model.name,
|
||||
base_model_id: null,
|
||||
|
|
@ -527,6 +531,10 @@
|
|||
}).catch((error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
savedModels = [...savedModels, res];
|
||||
}
|
||||
} else {
|
||||
await toggleModelById(localStorage.token, model.id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue