Return a compact, non-base64 summary of a content block.
(block: dict[str, Any])
| 26 | |
| 27 | |
| 28 | def _content_summary(block: dict[str, Any]) -> dict[str, str]: |
| 29 | """Return a compact, non-base64 summary of a content block.""" |
| 30 | summary: dict[str, str] = {"type": str(block.get("type"))} |
| 31 | for key in ("file_id", "file_url", "filename", "image_url"): |
| 32 | if key in block: |
| 33 | value = str(block[key]) |
| 34 | summary[key] = value[:100] + ("..." if len(value) > 100 else "") |
| 35 | if "file_data" in block: |
| 36 | value = str(block["file_data"]) |
| 37 | summary["file_data"] = value[:80] + f"... ({len(value)} chars)" |
| 38 | return summary |
| 39 | |
| 40 | |
| 41 | def _sanitize_payload(value: Any) -> Any: |
no test coverage detected