diff --git a/backend/open_webui/utils/chat.py b/backend/open_webui/utils/chat.py index 253eaedfb..58cd2baba 100644 --- a/backend/open_webui/utils/chat.py +++ b/backend/open_webui/utils/chat.py @@ -187,19 +187,18 @@ async def generate_chat_completion( model = models[model_id] - # Check if user has access to the model - if not bypass_filter and user.role == "user": - try: - check_model_access(user, model) - except Exception as e: - raise e - if getattr(request.state, "direct", False): return await generate_direct_chat_completion( request, form_data, user=user, models=models ) - else: + # Check if user has access to the model + if not bypass_filter and user.role == "user": + try: + check_model_access(user, model) + except Exception as e: + raise e + if model["owned_by"] == "arena": model_ids = model.get("info", {}).get("meta", {}).get("model_ids") filter_mode = model.get("info", {}).get("meta", {}).get("filter_mode")