fix(telegram): address code review issues from cherry-pick merge

- Fix critical plain-text fallback that was sending raw HTML tags to
  users: keep raw markdown available for the fallback path
- Extract TELEGRAM_HTML_MAX_LEN (4096) constant to replace hardcoded
  magic number and document the difference from TELEGRAM_MAX_MESSAGE_LEN
- Add fallback to _send_text for extra HTML chunks when HTML parse fails
- Add missing @pytest.mark.asyncio decorator on
  test_send_delta_stream_end_html_expansion_does_not_overflow
This commit is contained in:
chengyongru
2026-04-20 16:58:46 +08:00
committed by Xubin Ren
parent 2eea82f5ee
commit f900c5bb8e
2 changed files with 23 additions and 10 deletions
+1
View File
@@ -497,6 +497,7 @@ async def test_send_delta_stream_end_splits_oversized_reply() -> None:
assert "123" not in channel._stream_bufs
@pytest.mark.asyncio
async def test_send_delta_stream_end_html_expansion_does_not_overflow() -> None:
"""Markdown that expands when converted to HTML is still split correctly.