|
@@ -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:
|