mirror of
https://github.com/open-webui/open-webui
synced 2024-11-21 23:57:51 +00:00
refac
This commit is contained in:
parent
a0f1164af7
commit
147bd0717d
@ -116,7 +116,7 @@ async def delete_model_by_id(id: str, user=Depends(get_verified_user)):
|
||||
detail=ERROR_MESSAGES.NOT_FOUND,
|
||||
)
|
||||
|
||||
if model.user_id != user.id:
|
||||
if model.user_id != user.id and user.role != "admin":
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail=ERROR_MESSAGES.UNAUTHORIZED,
|
||||
|
@ -28,6 +28,7 @@
|
||||
import GarbageBin from '../icons/GarbageBin.svelte';
|
||||
import Search from '../icons/Search.svelte';
|
||||
import Plus from '../icons/Plus.svelte';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
let shiftKey = false;
|
||||
|
||||
@ -51,13 +52,17 @@
|
||||
let searchValue = '';
|
||||
|
||||
const deleteModelHandler = async (model) => {
|
||||
const res = await deleteModelById(localStorage.token, model.id);
|
||||
const res = await deleteModelById(localStorage.token, model.id).catch((e) => {
|
||||
toast.error(e);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t(`Deleted {{name}}`, { name: model.id }));
|
||||
}
|
||||
|
||||
await _models.set(await getModels(localStorage.token));
|
||||
models = $_models;
|
||||
models = await getWorkspaceModels(localStorage.token);
|
||||
};
|
||||
|
||||
const cloneModelHandler = async (model) => {
|
||||
@ -123,7 +128,7 @@
|
||||
}
|
||||
|
||||
await _models.set(await getModels(localStorage.token));
|
||||
models = $_models;
|
||||
models = await getWorkspaceModels(localStorage.token);
|
||||
};
|
||||
|
||||
const downloadModels = async (models) => {
|
||||
@ -431,7 +436,7 @@
|
||||
}
|
||||
|
||||
await _models.set(await getModels(localStorage.token));
|
||||
models = $_models;
|
||||
models = await getWorkspaceModels(localStorage.token);
|
||||
};
|
||||
|
||||
reader.readAsText(importFiles[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user