fix: unify telegram thread handling

This commit is contained in:
Ayaan Zaidi
2026-02-02 08:53:42 +05:30
committed by Ayaan Zaidi
parent 5020bfa2a9
commit 19b8416a81
10 changed files with 151 additions and 46 deletions

View File

@@ -56,7 +56,7 @@ export const dispatchTelegramMessage = async ({
msg,
chatId,
isGroup,
replyThreadId,
threadSpec,
historyKey,
historyLimit,
groupHistories,
@@ -70,8 +70,7 @@ export const dispatchTelegramMessage = async ({
} = context;
const isPrivateChat = msg.chat.type === "private";
const messageThreadId = (msg as { message_thread_id?: number }).message_thread_id;
const draftThreadId = replyThreadId ?? messageThreadId;
const draftThreadId = threadSpec.id;
const draftMaxChars = Math.min(textLimit, 4096);
const canStreamDraft =
streamMode !== "off" &&
@@ -84,7 +83,7 @@ export const dispatchTelegramMessage = async ({
chatId,
draftId: msg.message_id || Date.now(),
maxChars: draftMaxChars,
messageThreadId: draftThreadId,
thread: threadSpec,
log: logVerbose,
warn: logVerbose,
})
@@ -243,7 +242,7 @@ export const dispatchTelegramMessage = async ({
bot,
replyToMode,
textLimit,
messageThreadId: replyThreadId,
thread: threadSpec,
tableMode,
chunkMode,
onVoiceRecording: sendRecordVoice,
@@ -294,7 +293,7 @@ export const dispatchTelegramMessage = async ({
bot,
replyToMode,
textLimit,
messageThreadId: replyThreadId,
thread: threadSpec,
tableMode,
chunkMode,
linkPreview: telegramCfg.linkPreview,