refac: error handling

This commit is contained in:
Timothy Jaeryang Baek 2025-07-31 16:17:33 +04:00
parent 73b07df28f
commit d3547f0f54
2 changed files with 4 additions and 2 deletions

View File

@ -1296,7 +1296,7 @@ async def get_models(
models = get_filtered_models(models, user) models = get_filtered_models(models, user)
log.debug( log.debug(
f"/api/models returned filtered models accessible to the user: {json.dumps([model['id'] for model in models])}" f"/api/models returned filtered models accessible to the user: {json.dumps([model.get('id') for model in models])}"
) )
return {"data": models} return {"data": models}

View File

@ -362,7 +362,9 @@ async def get_all_models_responses(request: Request, user: UserModel) -> list:
response if isinstance(response, list) else response.get("data", []) response if isinstance(response, list) else response.get("data", [])
): ):
if prefix_id: if prefix_id:
model["id"] = f"{prefix_id}.{model['id']}" model["id"] = (
f"{prefix_id}.{model.get('id', model.get('name', ''))}"
)
if tags: if tags:
model["tags"] = tags model["tags"] = tags