This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-09 01:21:17 +09:00
1 parent 2a18dc98ac
commit 1dee67b64d
1 file changed
+17 -1
+17 -1
View File
@@ -456,16 +456,32 @@ async def get_model_by_id(id: str, user=Depends(get_verified_user), db: AsyncSes
@router.get('/model/profile/image') @router.get('/model/profile/image')
async def get_model_profile_image( async def get_model_profile_image(
request: Request,
id: str, id: str,
user=Depends(get_verified_user), user=Depends(get_verified_user),
db: AsyncSession = Depends(get_async_session), db: AsyncSession = Depends(get_async_session),
): ):
model_meta = await Models.get_model_meta_by_id(id, db=db) profile_image_url = None
updated_at = None
# First, check the database for regular models
model_meta = await Models.get_model_meta_by_id(id, db=db)
if model_meta: if model_meta:
meta, updated_at = model_meta meta, updated_at = model_meta
profile_image_url = (meta or {}).get('profile_image_url') profile_image_url = (meta or {}).get('profile_image_url')
# Fallback: check arena models stored in config (not in the DB)
if not profile_image_url:
arena_models = getattr(
getattr(request.app.state, 'config', None),
'EVALUATION_ARENA_MODELS',
[],
)
for arena_model in arena_models:
if arena_model.get('id') == id:
profile_image_url = arena_model.get('meta', {}).get('profile_image_url')
break
if profile_image_url: if profile_image_url:
if profile_image_url.startswith('http'): if profile_image_url.startswith('http'):
return Response( return Response(