Skip to content

feat(telegram): add native DM draft streaming with segmented stream results#340

Open
lurenjia534 wants to merge 3 commits into
vercel:mainfrom
lurenjia534:main
Open

feat(telegram): add native DM draft streaming with segmented stream results#340
lurenjia534 wants to merge 3 commits into
vercel:mainfrom
lurenjia534:main

Conversation

@lurenjia534
Copy link
Copy Markdown

Summary

Add native Telegram DM streaming via sendMessageDraft while preserving Chat SDK's existing post+edit fallback for non-DM threads.

This PR:

  • adds native private-chat draft streaming to the Telegram adapter
  • splits long streamed markdown into Telegram-safe persisted segments
  • retries without parse_mode when Telegram rejects markdown entity parsing
  • exposes segmented native stream results in the chat core
  • updates docs and feature matrices to reflect Telegram DM draft streaming

Test plan

  • pnpm check
  • pnpm typecheck
  • pnpm test:workspace
  • pnpm build

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 6, 2026

@lurenjia534 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@lurenjia534
Copy link
Copy Markdown
Author

Ah, I forgot to upload a video showing this PR

screen-20260407-075015-1775519367603-10mb.mp4

's effect it currently only works in private chats, since Telegram's official streaming API only allows us to use it in private conversations.

@bensabic bensabic requested a review from visyat May 9, 2026 12:21
# Conflicts:
#	README.md
#	apps/docs/content/docs/adapters.mdx
#	apps/docs/content/docs/index.mdx
#	apps/docs/content/docs/streaming.mdx
#	packages/adapter-telegram/README.md
#	packages/adapter-telegram/src/index.ts
#	packages/chat/src/thread.test.ts
#	packages/chat/src/thread.ts
@lurenjia534 lurenjia534 requested a review from a team as a code owner May 15, 2026 22:39
@lurenjia534
Copy link
Copy Markdown
Author

@visyat I resolved the merge conflict and pushed a follow-up fix for Telegram streaming segmentation.

The latest commit prevents streamed MarkdownV2 content from being truncated when the rendered Telegram payload grows beyond the original markdown source
length. I also added a regression test covering escaped MarkdownV2 expansion.

Verified locally:

  • pnpm --filter @chat-adapter/telegram test
  • pnpm check
  • pnpm typecheck
  • pnpm test:workspace
  • pnpm build

Could you take another look when you have a chance?

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