fix: harden telegram streaming state

This commit is contained in:
Ayaan Zaidi
2026-01-31 22:08:01 +05:30
committed by Ayaan Zaidi
parent 37721ebd7c
commit a64d8d2d66
3 changed files with 10 additions and 4 deletions

View File

@@ -74,13 +74,17 @@ export function createTelegramDraftStream(params: {
return;
}
const text = pendingText;
pendingText = "";
if (!text.trim()) {
const trimmed = text.trim();
if (!trimmed) {
if (pendingText === text) {
pendingText = "";
}
if (pendingText) {
schedule();
}
return;
}
pendingText = "";
inFlight = true;
try {
await sendDraft(text);