Skip to content

Commit b64c9d9

Browse files
committed
refac
1 parent adf9585 commit b64c9d9

File tree

1 file changed

+17
-3
lines changed
  • backend/open_webui/apps/openai

1 file changed

+17
-3
lines changed

backend/open_webui/apps/openai/main.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,24 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_verified_us
333333
r.raise_for_status()
334334

335335
response_data = r.json()
336+
336337
if "api.openai.com" in url:
337-
response_data["data"] = list(
338-
filter(lambda model: "gpt" in model["id"], response_data["data"])
339-
)
338+
# Filter the response data
339+
response_data["data"] = [
340+
model
341+
for model in response_data["data"]
342+
if not any(
343+
name in model["id"]
344+
for name in [
345+
"babbage",
346+
"dall-e",
347+
"davinci",
348+
"embedding",
349+
"tts",
350+
"whisper",
351+
]
352+
)
353+
]
340354

341355
return response_data
342356
except Exception as e:

0 commit comments

Comments
 (0)