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): class ModelForm(BaseModel):
model_config = ConfigDict(extra='ignore')
id: str id: str
base_model_id: Optional[str] = None base_model_id: Optional[str] = None
name: str name: str
+8 -2
View File
@@ -152,6 +152,9 @@ export const getBaseModels = async (token: string = '') => {
export const createNewModel = async (token: string, model: object) => { export const createNewModel = async (token: string, model: object) => {
let error = null; 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`, { const res = await fetch(`${WEBUI_API_BASE_URL}/models/create`, {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -159,7 +162,7 @@ export const createNewModel = async (token: string, model: object) => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
authorization: `Bearer ${token}` authorization: `Bearer ${token}`
}, },
body: JSON.stringify(model) body: JSON.stringify(payload)
}) })
.then(async (res) => { .then(async (res) => {
if (!res.ok) throw await res.json(); 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) => { export const updateModelById = async (token: string, id: string, model: object) => {
let error = null; 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`, { const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/update`, {
method: 'POST', method: 'POST',
headers: { headers: {
@@ -258,7 +264,7 @@ export const updateModelById = async (token: string, id: string, model: object)
'Content-Type': 'application/json', 'Content-Type': 'application/json',
authorization: `Bearer ${token}` authorization: `Bearer ${token}`
}, },
body: JSON.stringify({ ...model, id }) body: JSON.stringify(payload)
}) })
.then(async (res) => { .then(async (res) => {
if (!res.ok) throw await res.json(); if (!res.ok) throw await res.json();