mirror of
https://github.com/open-webui/open-webui
synced 2024-11-29 07:21:01 +00:00
refac: admin models setting toast
This commit is contained in:
parent
6906a0bd26
commit
7858be7fda
@ -21,6 +21,7 @@
|
|||||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||||
|
|
||||||
import ModelEditor from '$lib/components/workspace/Models/ModelEditor.svelte';
|
import ModelEditor from '$lib/components/workspace/Models/ModelEditor.svelte';
|
||||||
|
import { toast } from 'svelte-sonner';
|
||||||
|
|
||||||
let importFiles;
|
let importFiles;
|
||||||
let modelsImportInputElement: HTMLInputElement;
|
let modelsImportInputElement: HTMLInputElement;
|
||||||
@ -72,13 +73,21 @@
|
|||||||
model.base_model_id = null;
|
model.base_model_id = null;
|
||||||
|
|
||||||
if (workspaceModels.find((m) => m.id === model.id)) {
|
if (workspaceModels.find((m) => m.id === model.id)) {
|
||||||
await updateModelById(localStorage.token, model.id, model).catch((error) => {
|
const res = await updateModelById(localStorage.token, model.id, model).catch((error) => {
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
toast.success($i18n.t('Model updated successfully'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await createNewModel(localStorage.token, model).catch((error) => {
|
const res = await createNewModel(localStorage.token, model).catch((error) => {
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
toast.success($i18n.t('Model updated successfully'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_models.set(await getModels(localStorage.token));
|
_models.set(await getModels(localStorage.token));
|
||||||
|
Loading…
Reference in New Issue
Block a user