From d9230b13a4ad21ac34311df76185fcdf8ca911a4 Mon Sep 17 00:00:00 2001 From: Yihao Date: Sat, 28 Feb 2026 12:24:42 +0800 Subject: [PATCH] feat(feishu): skip reply-to in DM conversations (#13211) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In DM (p2p) chats, use message.create instead of message.reply so that bot responses don't show a 'Reply to' quote. Group chats retain the reply-to behavior for context clarity. The typing indicator (emoji reaction on the user's message) is preserved in DMs — only the reply reference in sent messages is removed. Changes: - Add skipReplyToInMessages param to createFeishuReplyDispatcher - In bot.ts, set skipReplyToInMessages: !isGroup for both dispatch sites - In reply-dispatcher.ts, use sendReplyToMessageId (undefined for DMs) for message sending while keeping replyToMessageId for typing indicator --- extensions/feishu/src/bot.ts | 1 + extensions/feishu/src/reply-dispatcher.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/extensions/feishu/src/bot.ts b/extensions/feishu/src/bot.ts index a5fd255cfd6..6dcfa6eb02c 100644 --- a/extensions/feishu/src/bot.ts +++ b/extensions/feishu/src/bot.ts @@ -1160,6 +1160,7 @@ export async function handleFeishuMessage(params: { runtime: runtime as RuntimeEnv, chatId: ctx.chatId, replyToMessageId: ctx.messageId, + skipReplyToInMessages: !isGroup, replyInThread, rootId: ctx.rootId, mentionTargets: ctx.mentionTargets, diff --git a/extensions/feishu/src/reply-dispatcher.ts b/extensions/feishu/src/reply-dispatcher.ts index cbdca4b570e..cda4e6e506e 100644 --- a/extensions/feishu/src/reply-dispatcher.ts +++ b/extensions/feishu/src/reply-dispatcher.ts @@ -28,6 +28,8 @@ export type CreateFeishuReplyDispatcherParams = { runtime: RuntimeEnv; chatId: string; replyToMessageId?: string; + /** When true, preserve typing indicator on reply target but send messages without reply metadata */ + skipReplyToInMessages?: boolean; replyInThread?: boolean; rootId?: string; mentionTargets?: MentionTarget[]; @@ -41,11 +43,13 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP agentId, chatId, replyToMessageId, + skipReplyToInMessages, replyInThread, rootId, mentionTargets, accountId, } = params; + const sendReplyToMessageId = skipReplyToInMessages ? undefined : replyToMessageId; const account = resolveFeishuAccount({ cfg, accountId }); const prefixContext = createReplyPrefixContext({ cfg, agentId }); @@ -189,7 +193,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP cfg, to: chatId, mediaUrl, - replyToMessageId, + replyToMessageId: sendReplyToMessageId, replyInThread, accountId, }); @@ -209,7 +213,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP cfg, to: chatId, text: chunk, - replyToMessageId, + replyToMessageId: sendReplyToMessageId, replyInThread, mentions: first ? mentionTargets : undefined, accountId, @@ -227,7 +231,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP cfg, to: chatId, text: chunk, - replyToMessageId, + replyToMessageId: sendReplyToMessageId, replyInThread, mentions: first ? mentionTargets : undefined, accountId, @@ -243,7 +247,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP cfg, to: chatId, mediaUrl, - replyToMessageId, + replyToMessageId: sendReplyToMessageId, replyInThread, accountId, });