Ver Fonte

refac/fix: model name retrieval edge case

Timothy Jaeryang Baek há 1 mês atrás
pai
commit
2387877dae
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      backend/open_webui/main.py

+ 2 - 2
backend/open_webui/main.py

@@ -1324,8 +1324,8 @@ async def get_models(
         # Sort models by order list priority, with fallback for those not in the list
         models.sort(
             key=lambda model: (
-                model_order_dict.get(model.get("id"), float("inf")),
-                model.get("name"),
+                model_order_dict.get(model.get("id", ""), float("inf")),
+                (model.get("name", "") or ""),
             )
         )