Skip to content

feat(tgapp): stream MarkdownV2 replies with draft fallback and file segments#135

Merged
lsdefine merged 1 commit intolsdefine:mainfrom
YooooEX:telegram-polish
Apr 24, 2026
Merged

feat(tgapp): stream MarkdownV2 replies with draft fallback and file segments#135
lsdefine merged 1 commit intolsdefine:mainfrom
YooooEX:telegram-polish

Conversation

@YooooEX
Copy link
Copy Markdown
Contributor

@YooooEX YooooEX commented Apr 22, 2026

Context

Telegram currently streams replies through a polling + HTML path, which makes draft updates, MarkdownV2 rendering, long-message splitting, and attachment delivery inconsistent with the newer chat frontend behavior.
This PR keeps the change radius inside frontends/tgapp.py plus focused regression tests. No new dependencies are added.

Summary

Upgrade Telegram reply streaming to use MarkdownV2-first draft/live updates, segmented final output, and attachment-aware delivery.

Changes

frontends/tgapp.py

  • switch Telegram streaming from fixed-interval polling edits to event-driven queue consumption
  • prefer reply_text_draft(...) in private chats and fall back to normal reply/edit flows when draft updates are unavailable
  • render replies with MarkdownV2 escaping instead of the previous HTML conversion path
  • split long final replies into multiple visible segments instead of truncating or restarting from the tail
  • strip [FILE:...] hints from visible text and send extracted files as Telegram attachments after finalize
  • keep stop/error flows explicit by finalizing the current stream session with a notice

Copy link
Copy Markdown
Owner

@lsdefine lsdefine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lsdefine lsdefine merged commit f516c52 into lsdefine:main Apr 24, 2026
ZZFFLL pushed a commit to ZZFFLL/zfengl-ga that referenced this pull request Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants