refac
This commit is contained in:
@@ -3,6 +3,7 @@ import hashlib
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiocache import cached
|
from aiocache import cached
|
||||||
@@ -520,9 +521,11 @@ async def get_all_models(request: Request, user: UserModel) -> dict[str, list]:
|
|||||||
for model in model_list:
|
for model in model_list:
|
||||||
model_id = model.get("id") or model.get("name")
|
model_id = model.get("id") or model.get("name")
|
||||||
|
|
||||||
if "api.openai.com" in api_base_urls[
|
base_url = api_base_urls[idx]
|
||||||
idx
|
hostname = urlparse(base_url).hostname if base_url else None
|
||||||
] and not is_supported_openai_models(model_id):
|
if hostname == "api.openai.com" and not is_supported_openai_models(
|
||||||
|
model_id
|
||||||
|
):
|
||||||
# Skip unwanted OpenAI models
|
# Skip unwanted OpenAI models
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user