This commit is contained in:
Timothy Jaeryang Baek
2026-04-24 17:49:22 +09:00
parent 2419899ac6
commit a7a92d2d9b
2 changed files with 10 additions and 2 deletions
+2
View File
@@ -143,6 +143,8 @@ class ModelAccessListResponse(BaseModel):
class ModelForm(BaseModel):
model_config = ConfigDict(extra='ignore')
id: str
base_model_id: Optional[str] = None
name: str
+8 -2
View File
@@ -152,6 +152,9 @@ export const getBaseModels = async (token: string = '') => {
export const createNewModel = async (token: string, model: object) => {
let error = null;
const { id, base_model_id, name, meta, params, access_grants, is_active } = model as any;
const payload = { id, base_model_id, name, meta, params, access_grants, is_active };
const res = await fetch(`${WEBUI_API_BASE_URL}/models/create`, {
method: 'POST',
headers: {
@@ -159,7 +162,7 @@ export const createNewModel = async (token: string, model: object) => {
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify(model)
body: JSON.stringify(payload)
})
.then(async (res) => {
if (!res.ok) throw await res.json();
@@ -251,6 +254,9 @@ export const toggleModelById = async (token: string, id: string) => {
export const updateModelById = async (token: string, id: string, model: object) => {
let error = null;
const { base_model_id, name, meta, params, access_grants, is_active } = model as any;
const payload = { id, base_model_id, name, meta, params, access_grants, is_active };
const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/update`, {
method: 'POST',
headers: {
@@ -258,7 +264,7 @@ export const updateModelById = async (token: string, id: string, model: object)
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({ ...model, id })
body: JSON.stringify(payload)
})
.then(async (res) => {
if (!res.ok) throw await res.json();