forked from open-webui/open-webui
feat: model filter frontend integration
This commit is contained in:
parent
b550e23bf6
commit
81daf4ceb9
4 changed files with 83 additions and 6 deletions
|
@ -135,11 +135,14 @@ async def get_ollama_tags(
|
|||
):
|
||||
if url_idx == None:
|
||||
models = await get_all_models()
|
||||
|
||||
if app.state.MODEL_FILTER_ENABLED:
|
||||
if user.role == "user":
|
||||
models["models"] = filter(
|
||||
lambda model: model["name"] in app.state.MODEL_LIST,
|
||||
models["models"],
|
||||
models["models"] = list(
|
||||
filter(
|
||||
lambda model: model["name"] in app.state.MODEL_LIST,
|
||||
models["models"],
|
||||
)
|
||||
)
|
||||
return models
|
||||
return models
|
||||
|
|
|
@ -196,9 +196,11 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_current_use
|
|||
models = await get_all_models()
|
||||
if app.state.MODEL_FILTER_ENABLED:
|
||||
if user.role == "user":
|
||||
models["data"] = filter(
|
||||
lambda model: model["id"] in app.state.MODEL_LIST,
|
||||
models["data"],
|
||||
models["data"] = list(
|
||||
filter(
|
||||
lambda model: model["id"] in app.state.MODEL_LIST,
|
||||
models["data"],
|
||||
)
|
||||
)
|
||||
return models
|
||||
return models
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue