Timothy J. Baek 6 mēneši atpakaļ
vecāks
revīzija
24885a2e38
2 mainītis faili ar 9 papildinājumiem un 4 dzēšanām
  1. 5 0
      backend/open_webui/apps/webui/main.py
  2. 4 4
      backend/open_webui/main.py

+ 5 - 0
backend/open_webui/apps/webui/main.py

@@ -144,6 +144,11 @@ async def get_status():
     }
 
 
+async def get_all_models():
+    pipe_models = await get_pipe_models()
+    return pipe_models
+
+
 def get_function_module(pipe_id: str):
     # Check if function is already loaded
     if pipe_id not in app.state.FUNCTIONS:

+ 4 - 4
backend/open_webui/main.py

@@ -57,7 +57,7 @@ from open_webui.apps.webui.internal.db import Session
 from open_webui.apps.webui.main import (
     app as webui_app,
     generate_function_chat_completion,
-    get_pipe_models,
+    get_all_models as get_open_webui_models,
 )
 from open_webui.apps.webui.models.functions import Functions
 from open_webui.apps.webui.models.models import Models
@@ -904,11 +904,11 @@ webui_app.state.EMBEDDING_FUNCTION = retrieval_app.state.EMBEDDING_FUNCTION
 
 async def get_all_models():
     # TODO: Optimize this function
-    pipe_models = []
+    open_webui_models = []
     openai_models = []
     ollama_models = []
 
-    pipe_models = await get_pipe_models()
+    open_webui_models = await get_open_webui_models()
 
     if app.state.config.ENABLE_OPENAI_API:
         openai_models = await get_openai_models()
@@ -928,7 +928,7 @@ async def get_all_models():
             for model in ollama_models["models"]
         ]
 
-    models = pipe_models + openai_models + ollama_models
+    models = open_webui_models + openai_models + ollama_models
 
     global_action_ids = [
         function.id for function in Functions.get_global_action_functions()