refac/fix: endpoint conflict

This commit is contained in:
Timothy Jaeryang Baek 2025-11-02 18:41:57 -05:00
parent 478163eb3b
commit 6681ff5cbd
3 changed files with 6 additions and 4 deletions

View file

@ -44,7 +44,9 @@ def validate_model_id(model_id: str) -> bool:
###########################
@router.get("/", response_model=list[ModelUserResponse])
@router.get(
"/list", response_model=list[ModelUserResponse]
) # do NOT use "/" as path, conflicts with main.py
async def get_models(id: Optional[str] = None, user=Depends(get_verified_user)):
if user.role == "admin" and BYPASS_ADMIN_ACCESS_CONTROL:
return Models.get_models()

View file

@ -1,9 +1,9 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const getModels = async (token: string = '') => {
export const getModelItems = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/models/`, {
const res = await fetch(`${WEBUI_API_BASE_URL}/models/list`, {
method: 'GET',
headers: {
Accept: 'application/json',

View file

@ -16,7 +16,7 @@
import {
createNewModel,
deleteModelById,
getModels as getWorkspaceModels,
getModelItems as getWorkspaceModels,
toggleModelById,
updateModelById
} from '$lib/apis/models';