fix(telegram): fix streaming with extended thinking models overwriting previous messages/ also happens to Execution error (#17973)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 34b52eead8
Co-authored-by: Marvae <11957602+Marvae@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
Hongwei Ma
2026-02-16 21:24:34 +08:00
committed by GitHub
parent 553d17f8af
commit dddb1bc942
14 changed files with 260 additions and 134 deletions

View File

@@ -10,6 +10,8 @@ export type TelegramDraftStream = {
messageId: () => number | undefined;
clear: () => Promise<void>;
stop: () => void;
/** Reset internal state so the next update creates a new message instead of editing. */
forceNewMessage: () => void;
};
export function createTelegramDraftStream(params: {
@@ -174,6 +176,12 @@ export function createTelegramDraftStream(params: {
}
};
const forceNewMessage = () => {
streamMessageId = undefined;
lastSentText = "";
pendingText = "";
};
params.log?.(`telegram stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
return {
@@ -182,5 +190,6 @@ export function createTelegramDraftStream(params: {
messageId: () => streamMessageId,
clear,
stop,
forceNewMessage,
};
}