mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 18:30:43 +00:00
* Telegram: filter binary content from msg.caption to prevent token explosion (#66647) When a user sends a binary document (e.g. .mobi, .epub) via Telegram, raw binary bytes can leak into msg.caption. getTelegramTextParts() passes this through to the LLM prompt, causing catastrophic token explosion (~460K tokens). Add isBinaryContent() that detects non-printable control characters (0x00-0x08, 0x0E-0x1F) and use it to sanitize the text in getTelegramTextParts() before it reaches the prompt pipeline. When binary content is detected, the text and entities are both replaced with empty values so the message is still processed (media placeholder still works) but the binary junk is dropped. Made-with: Cursor * fix: distill telegram binary caption filtering * fix: filter telegram binary caption text (#66663) (thanks @joelnishanth) --------- Co-authored-by: Ayaan Zaidi <hi@obviy.us>