From b31d3146389cee1f4be751caa9a761ca913be2e0 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 22 Oct 2024 12:04:45 -0700 Subject: [PATCH] refac --- backend/open_webui/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 8c5348762..1d3239d25 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -910,8 +910,6 @@ async def get_all_models(): openai_models = [] ollama_models = [] - open_webui_models = await get_open_webui_models() - if app.state.config.ENABLE_OPENAI_API: openai_models = await get_openai_models() openai_models = openai_models["data"] @@ -930,8 +928,14 @@ async def get_all_models(): for model in ollama_models["models"] ] + open_webui_models = await get_open_webui_models() + models = open_webui_models + openai_models + ollama_models + # If there are no models, return an empty list + if len([model for model in models if model["owned_by"] != "arena"]) == 0: + return [] + global_action_ids = [ function.id for function in Functions.get_global_action_functions() ]