mirror of
https://github.com/open-webui/open-webui
synced 2025-02-21 12:29:29 +00:00
commit
d75d638b9a
@ -333,10 +333,24 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_verified_us
|
|||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
response_data = r.json()
|
response_data = r.json()
|
||||||
|
|
||||||
if "api.openai.com" in url:
|
if "api.openai.com" in url:
|
||||||
response_data["data"] = list(
|
# Filter the response data
|
||||||
filter(lambda model: "gpt" in model["id"], response_data["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
|
return response_data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user