|
@@ -191,8 +191,8 @@ async def fetch_url(url, key):
|
|
|
|
|
|
|
|
|
|
async def cleanup_response(
|
|
async def cleanup_response(
|
|
- response: Optional[aiohttp.ClientResponse],
|
|
|
|
- session: Optional[aiohttp.ClientSession],
|
|
|
|
|
|
+ response: Optional[aiohttp.ClientResponse],
|
|
|
|
+ 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]
|
|
|
|
- or not any(
|
|
|
|
- name in model["id"]
|
|
|
|
- for name in [
|
|
|
|
- "babbage",
|
|
|
|
- "dall-e",
|
|
|
|
- "davinci",
|
|
|
|
- "embedding",
|
|
|
|
- "tts",
|
|
|
|
- "whisper",
|
|
|
|
- ]
|
|
|
|
- )
|
|
|
|
|
|
+ not in app.state.config.OPENAI_API_BASE_URLS[idx]
|
|
|
|
+ or not any(
|
|
|
|
+ name in model["id"]
|
|
|
|
+ for name in [
|
|
|
|
+ "babbage",
|
|
|
|
+ "dall-e",
|
|
|
|
+ "davinci",
|
|
|
|
+ "embedding",
|
|
|
|
+ "tts",
|
|
|
|
+ "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,
|
|
|
|
- url_idx: Optional[int] = None,
|
|
|
|
- user=Depends(get_verified_user),
|
|
|
|
|
|
+ form_data: dict,
|
|
|
|
+ url_idx: Optional[int] = None,
|
|
|
|
+ user=Depends(get_verified_user),
|
|
):
|
|
):
|
|
idx = 0
|
|
idx = 0
|
|
payload = {**form_data}
|
|
payload = {**form_data}
|