Browse Source

fix: model list hide issue

Timothy Jaeryang Baek 4 months ago
parent
commit
daabc188e8
1 changed files with 6 additions and 3 deletions
  1. 6 3
      backend/open_webui/utils/models.py

+ 6 - 3
backend/open_webui/utils/models.py

@@ -114,9 +114,12 @@ async def get_all_models(request, user: UserModel = None):
     for custom_model in custom_models:
         if custom_model.base_model_id is None:
             for model in models:
-                if (
-                    custom_model.id == model["id"]
-                    or custom_model.id == model["id"].split(":")[0]
+                if custom_model.id == model["id"] or (
+                    model.get("owned_by") == "ollama"
+                    and custom_model.id
+                    == model["id"].split(":")[
+                        0
+                    ]  # Ollama may return model ids in different formats (e.g., 'llama3' vs. 'llama3:7b')
                 ):
                     if custom_model.is_active:
                         model["name"] = custom_model.name