chore: format

This commit is contained in:
Timothy J. Baek 2024-09-27 19:43:40 +02:00
parent 5b3ee30ca9
commit 4ead3c5b80

View File

@ -191,8 +191,8 @@ async def fetch_url(url, key):
async def cleanup_response( async def cleanup_response(
response: Optional[aiohttp.ClientResponse], response: Optional[aiohttp.ClientResponse],
session: Optional[aiohttp.ClientSession], session: Optional[aiohttp.ClientSession],
): ):
if response: if response:
response.close() response.close()
@ -217,18 +217,18 @@ def merge_models_lists(model_lists):
} }
for model in models for model in models
if "api.openai.com" if "api.openai.com"
not in app.state.config.OPENAI_API_BASE_URLS[idx] not in app.state.config.OPENAI_API_BASE_URLS[idx]
or not any( or not any(
name in model["id"] name in model["id"]
for name in [ for name in [
"babbage", "babbage",
"dall-e", "dall-e",
"davinci", "davinci",
"embedding", "embedding",
"tts", "tts",
"whisper", "whisper",
] ]
) )
] ]
) )
@ -371,9 +371,9 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_verified_us
@app.post("/chat/completions") @app.post("/chat/completions")
@app.post("/chat/completions/{url_idx}") @app.post("/chat/completions/{url_idx}")
async def generate_chat_completion( async def generate_chat_completion(
form_data: dict, form_data: dict,
url_idx: Optional[int] = None, url_idx: Optional[int] = None,
user=Depends(get_verified_user), user=Depends(get_verified_user),
): ):
idx = 0 idx = 0
payload = {**form_data} payload = {**form_data}