Skip to content

Commit d9230b1

Browse files
feat(feishu): skip reply-to in DM conversations (#13211)
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
1 parent 6a8d83b commit d9230b1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

extensions/feishu/src/bot.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ export async function handleFeishuMessage(params: {
11601160
runtime: runtime as RuntimeEnv,
11611161
chatId: ctx.chatId,
11621162
replyToMessageId: ctx.messageId,
1163+
skipReplyToInMessages: !isGroup,
11631164
replyInThread,
11641165
rootId: ctx.rootId,
11651166
mentionTargets: ctx.mentionTargets,

extensions/feishu/src/reply-dispatcher.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export type CreateFeishuReplyDispatcherParams = {
2828
runtime: RuntimeEnv;
2929
chatId: string;
3030
replyToMessageId?: string;
31+
/** When true, preserve typing indicator on reply target but send messages without reply metadata */
32+
skipReplyToInMessages?: boolean;
3133
replyInThread?: boolean;
3234
rootId?: string;
3335
mentionTargets?: MentionTarget[];
@@ -41,11 +43,13 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP
4143
agentId,
4244
chatId,
4345
replyToMessageId,
46+
skipReplyToInMessages,
4447
replyInThread,
4548
rootId,
4649
mentionTargets,
4750
accountId,
4851
} = params;
52+
const sendReplyToMessageId = skipReplyToInMessages ? undefined : replyToMessageId;
4953
const account = resolveFeishuAccount({ cfg, accountId });
5054
const prefixContext = createReplyPrefixContext({ cfg, agentId });
5155

@@ -189,7 +193,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP
189193
cfg,
190194
to: chatId,
191195
mediaUrl,
192-
replyToMessageId,
196+
replyToMessageId: sendReplyToMessageId,
193197
replyInThread,
194198
accountId,
195199
});
@@ -209,7 +213,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP
209213
cfg,
210214
to: chatId,
211215
text: chunk,
212-
replyToMessageId,
216+
replyToMessageId: sendReplyToMessageId,
213217
replyInThread,
214218
mentions: first ? mentionTargets : undefined,
215219
accountId,
@@ -227,7 +231,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP
227231
cfg,
228232
to: chatId,
229233
text: chunk,
230-
replyToMessageId,
234+
replyToMessageId: sendReplyToMessageId,
231235
replyInThread,
232236
mentions: first ? mentionTargets : undefined,
233237
accountId,
@@ -243,7 +247,7 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP
243247
cfg,
244248
to: chatId,
245249
mediaUrl,
246-
replyToMessageId,
250+
replyToMessageId: sendReplyToMessageId,
247251
replyInThread,
248252
accountId,
249253
});

0 commit comments

Comments
 (0)