Add debug logging to asset serving to see file content

This commit is contained in:
ajaysi
2026-04-22 12:56:48 +05:30
parent 26ccb2f609
commit 3c4965462a

View File

@@ -99,5 +99,10 @@ async def serve_voice_sample(
raise HTTPException(status_code=404, detail="Asset not found")
media_type = _get_media_type(safe_filename)
logger.info(f"[Assets] Serving voice sample: {safe_filename} ({media_type}, {file_path.stat().st_size} bytes)")
file_size = file_path.stat().st_size
first_bytes_hex = "N/A"
if file_size > 0:
with open(file_path, 'rb') as f:
first_bytes_hex = f.read(16).hex()
logger.warning(f"[Assets] Serving voice sample: {safe_filename} ({media_type}, {file_size} bytes, first_16hex: {first_bytes_hex})")
return FileResponse(file_path, media_type=media_type)