fix(translate): add EXPLORE logging for LLM JSON parse failures

Preview + executor now log the raw LLM response (first 1000 chars)
when JSON parsing fails, enabling debugging of malformed LLM output.

Previously ValueErrors from JSON parse failures were silently returned
as 400 without any diagnostic data in logs.
This commit is contained in:
2026-05-15 09:15:36 +03:00
parent a74c50206a
commit 7947700188
4 changed files with 412 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ async def preview_translation(
)
return result
except ValueError as e:
logger.explore("preview_translation validation failed", extra={"src": "translate_routes", "error": str(e)})
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=str(e))
except Exception as e:
logger.explore("preview_translation failed", extra={"src": "translate_routes", "error": str(e)})