This commit is contained in:
Timothy Jaeryang Baek
2026-02-22 15:41:10 -06:00
parent ad9fbfc1af
commit 3c54863414
3 changed files with 5 additions and 4 deletions

View File

@@ -512,6 +512,7 @@ async def update_model_by_id(
class ModelAccessGrantsForm(BaseModel):
id: str
name: Optional[str] = None
access_grants: list[dict]
@@ -535,7 +536,7 @@ async def update_model_access_by_id(
model = Models.insert_new_model(
ModelForm(
id=form_data.id,
name=form_data.id,
name=form_data.name or form_data.id,
meta=ModelMeta(),
params=ModelParams(),
),

View File

@@ -281,7 +281,7 @@ export const updateModelById = async (token: string, id: string, model: object)
return res;
};
export const updateModelAccessGrants = async (token: string, id: string, accessGrants: any[]) => {
export const updateModelAccessGrants = async (token: string, id: string, name: string, accessGrants: any[]) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/access/update`, {
@@ -291,7 +291,7 @@ export const updateModelAccessGrants = async (token: string, id: string, accessG
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({ id, access_grants: accessGrants })
body: JSON.stringify({ id, name, access_grants: accessGrants })
})
.then(async (res) => {
if (!res.ok) throw await res.json();

View File

@@ -346,7 +346,7 @@
onChange={async () => {
if (edit && model?.id) {
try {
await updateModelAccessGrants(localStorage.token, model.id, accessGrants);
await updateModelAccessGrants(localStorage.token, model.id, model.name ?? name, accessGrants);
toast.success($i18n.t('Saved'));
} catch (error) {
toast.error(error?.detail ?? `${error}`);