fix: undefined model_id issue

This commit is contained in:
Timothy Jaeryang Baek 2025-08-10 13:48:12 +04:00
parent 25cc8049c8
commit cd778582d5

View file

@ -1375,13 +1375,13 @@ async def chat_completion(
if not request.app.state.MODELS:
await get_all_models(request, user=user)
model_id = form_data.get("model", None)
model_item = form_data.pop("model_item", {})
tasks = form_data.pop("background_tasks", None)
metadata = {}
try:
if not model_item.get("direct", False):
model_id = form_data.get("model", None)
if model_id not in request.app.state.MODELS:
raise Exception("Model not found")