feat(telegram): streaming output support (Edit + Draft modes)#276
Open
Youhai020616 wants to merge 1 commit intoRightNow-AI:mainfrom
Open
feat(telegram): streaming output support (Edit + Draft modes)#276Youhai020616 wants to merge 1 commit intoRightNow-AI:mainfrom
Youhai020616 wants to merge 1 commit intoRightNow-AI:mainfrom
Conversation
Add progressive message display for Telegram so AI responses appear like typing instead of waiting for the full response. Implements two strategies: Edit mode (sendMessage + editMessageText, works everywhere) and Draft mode (sendMessageDraft, DM only, experimental). Auto mode selects the best strategy. Includes rate-limit adaptive backoff, cursor indicator, message splitting for long responses, and full backward compatibility via default trait implementations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
egargale
pushed a commit
to egargale/openfang
that referenced
this pull request
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sendMessage+editMessageText, works in groups and DMs) and Draft mode (sendMessageDraftBot API 9.5, DM only, experimental)stream_mode: offpreserves existing behavior with zero impactChanges
openfang-types/config.rsTelegramStreamModeenum,TelegramStreamConfigstruct, new fields onTelegramConfigopenfang-channels/types.rsChannelStreamEventenum,StreamSinktrait,supports_streaming()/begin_stream()onChannelAdapteropenfang-channels/formatter.rsescape_html_entities(),find_split_point()helpersopenfang-channels/telegram.rsTelegramStreamSinkimplementingStreamSink, Edit/Draft modes, rate-limit backoff, message splitting, cursor indicatoropenfang-channels/bridge.rssend_message_streaming()onChannelBridgeHandle,dispatch_streaming(), streaming fallback in dispatchopenfang-api/channel_bridge.rssend_message_streaming()impl withStreamEvent → ChannelStreamEventconversion+819 lines, -19 lines across 7 files (including Cargo.lock)
Key Features
▌shown during streaming, removed on finalizeConfig Example
🤖 Generated with Claude Code