瀏覽代碼

Merge pull request #5406 from open-webui/main

refac
Timothy Jaeryang Baek 7 月之前
父節點
當前提交
d75d638b9a
共有 1 個文件被更改,包括 17 次插入3 次删除
  1. 17 3
      backend/open_webui/apps/openai/main.py

+ 17 - 3
backend/open_webui/apps/openai/main.py

@@ -333,10 +333,24 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_verified_us
             r.raise_for_status()
 
             response_data = r.json()
+
             if "api.openai.com" in url:
-                response_data["data"] = list(
-                    filter(lambda model: "gpt" in model["id"], response_data["data"])
-                )
+                # Filter the response data
+                response_data["data"] = [
+                    model
+                    for model in response_data["data"]
+                    if not any(
+                        name in model["id"]
+                        for name in [
+                            "babbage",
+                            "dall-e",
+                            "davinci",
+                            "embedding",
+                            "tts",
+                            "whisper",
+                        ]
+                    )
+                ]
 
             return response_data
         except Exception as e: