diff --git a/backend/open_webui/routers/models.py b/backend/open_webui/routers/models.py index fb3cedd14e..7ec1b0a0dd 100644 --- a/backend/open_webui/routers/models.py +++ b/backend/open_webui/routers/models.py @@ -47,7 +47,6 @@ from open_webui.models.models import ( from open_webui.storage.provider import Storage from open_webui.utils.access_control import ( filter_allowed_access_grants, - has_access, has_permission, validate_access_grants, ) @@ -979,6 +978,8 @@ async def get_model_profile_image( # First, check the database for regular models model_meta = await Models.get_model_meta_by_id(id, db=db) + # As in the model list, a model without a row is visible to admins only. + read_access = bypass_access_control or (not model_meta and user.role == 'admin') if model_meta: meta, model_user_id, model_updated_at = model_meta # Denied callers get the default image rather than an error, so model ids stay unprobeable. @@ -993,6 +994,7 @@ async def get_model_profile_image( db=db, ) ): + read_access = True profile_image_url = (meta or {}).get('profile_image_url') updated_at = model_updated_at @@ -1002,12 +1004,7 @@ async def get_model_profile_image( for router_model in router_models: if router_model.get('id') == id: router_meta = router_model.get('meta', {}) - access_grants = router_meta.get('access_grants', []) - if ( - bypass_access_control - or (not access_grants and user.role == 'admin') - or await has_access(user.id, permission='read', access_grants=access_grants, db=db) - ): + if read_access: profile_image_url = router_meta.get('profile_image_url') break