mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac/fix: endpoint conflict
This commit is contained in:
parent
478163eb3b
commit
6681ff5cbd
3 changed files with 6 additions and 4 deletions
|
|
@ -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)):
|
async def get_models(id: Optional[str] = None, user=Depends(get_verified_user)):
|
||||||
if user.role == "admin" and BYPASS_ADMIN_ACCESS_CONTROL:
|
if user.role == "admin" and BYPASS_ADMIN_ACCESS_CONTROL:
|
||||||
return Models.get_models()
|
return Models.get_models()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { WEBUI_API_BASE_URL } from '$lib/constants';
|
import { WEBUI_API_BASE_URL } from '$lib/constants';
|
||||||
|
|
||||||
export const getModels = async (token: string = '') => {
|
export const getModelItems = async (token: string = '') => {
|
||||||
let error = null;
|
let error = null;
|
||||||
|
|
||||||
const res = await fetch(`${WEBUI_API_BASE_URL}/models/`, {
|
const res = await fetch(`${WEBUI_API_BASE_URL}/models/list`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
import {
|
import {
|
||||||
createNewModel,
|
createNewModel,
|
||||||
deleteModelById,
|
deleteModelById,
|
||||||
getModels as getWorkspaceModels,
|
getModelItems as getWorkspaceModels,
|
||||||
toggleModelById,
|
toggleModelById,
|
||||||
updateModelById
|
updateModelById
|
||||||
} from '$lib/apis/models';
|
} from '$lib/apis/models';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue