fix(telegram): preserve finalized previews on mixed text+voice turns

This commit is contained in:
Peter Steinberger
2026-02-26 03:41:58 +01:00
parent 03e689fc89
commit 53fcfdf794
3 changed files with 53 additions and 1 deletions

View File

@@ -567,7 +567,10 @@ export const dispatchTelegramMessage = async ({
reasoningStepState.resetForNextStep();
if (answerLane.hasStreamedMessage) {
const previewMessageId = answerLane.stream?.messageId();
if (typeof previewMessageId === "number") {
// Only archive previews that still need a matching final text update.
// Once a preview has already been finalized, archiving it here causes
// cleanup to delete a user-visible final message on later media-only turns.
if (typeof previewMessageId === "number" && !finalizedPreviewByLane.answer) {
archivedAnswerPreviews.push({
messageId: previewMessageId,
textSnapshot: answerLane.lastPartialText,
@@ -576,6 +579,8 @@ export const dispatchTelegramMessage = async ({
answerLane.stream?.forceNewMessage();
}
resetDraftLaneState(answerLane);
// New assistant message boundary: this lane now tracks a fresh preview lifecycle.
finalizedPreviewByLane.answer = false;
}
: undefined,
onReasoningEnd: reasoningLane.stream