perf(slack): avoid redundant thread participation lookups · openclaw/openclaw@ac74a92
vincentkoc
·
2026-05-07
·
via Recent Commits to openclaw:main
File tree
extensions/slack/src/monitor/message-handler
| Original file line number | Diff line number | Diff line change |
|---|
@@ -369,20 +369,30 @@ export async function prepareSlackMessage(params: {
|
369 | 369 | `slack: routed via bound conversation ${runtimeBinding.conversation.conversationId} -> ${runtimeBinding.targetSessionKey}`, |
370 | 370 | ); |
371 | 371 | } |
372 | | -const implicitMentionKinds = |
373 | | -isDirectMessage || !ctx.botUserId || !message.thread_ts |
374 | | - ? [] |
375 | | - : [ |
376 | | - ...implicitMentionKindWhen("reply_to_bot", message.parent_user_id === ctx.botUserId), |
377 | | - ...implicitMentionKindWhen( |
| 372 | +let implicitMentionKinds: ReturnType<typeof implicitMentionKindWhen> = []; |
| 373 | +if ( |
| 374 | +!isDirectMessage && |
| 375 | +ctx.botUserId && |
| 376 | +message.thread_ts && |
| 377 | +!ctx.threadRequireExplicitMention && |
| 378 | +!wasMentioned |
| 379 | +) { |
| 380 | +const replyToBotKinds = implicitMentionKindWhen( |
| 381 | +"reply_to_bot", |
| 382 | +message.parent_user_id === ctx.botUserId, |
| 383 | +); |
| 384 | +implicitMentionKinds = |
| 385 | +replyToBotKinds.length > 0 |
| 386 | + ? replyToBotKinds |
| 387 | + : implicitMentionKindWhen( |
378 | 388 | "bot_thread_participant", |
379 | 389 | await hasSlackThreadParticipationWithPersistence({ |
380 | 390 | accountId: account.accountId, |
381 | 391 | channelId: message.channel, |
382 | 392 | threadTs: message.thread_ts, |
383 | 393 | }), |
384 | | -), |
385 | | - ]; |
| 394 | +); |
| 395 | +} |
386 | 396 | |
387 | 397 | let resolvedSenderName = normalizeOptionalString(message.username); |
388 | 398 | const resolveSenderName = async (): Promise<string> => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。