mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 11:15:00 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -10,27 +10,21 @@ const inboundDedupeCache = createDedupeCache({
|
||||
maxSize: DEFAULT_INBOUND_DEDUPE_MAX,
|
||||
});
|
||||
|
||||
const normalizeProvider = (value?: string | null) =>
|
||||
value?.trim().toLowerCase() || "";
|
||||
const normalizeProvider = (value?: string | null) => value?.trim().toLowerCase() || "";
|
||||
|
||||
const resolveInboundPeerId = (ctx: MsgContext) =>
|
||||
ctx.OriginatingTo ?? ctx.To ?? ctx.From ?? ctx.SessionKey;
|
||||
|
||||
export function buildInboundDedupeKey(ctx: MsgContext): string | null {
|
||||
const provider = normalizeProvider(
|
||||
ctx.OriginatingChannel ?? ctx.Provider ?? ctx.Surface,
|
||||
);
|
||||
const provider = normalizeProvider(ctx.OriginatingChannel ?? ctx.Provider ?? ctx.Surface);
|
||||
const messageId = ctx.MessageSid?.trim();
|
||||
if (!provider || !messageId) return null;
|
||||
const peerId = resolveInboundPeerId(ctx);
|
||||
if (!peerId) return null;
|
||||
const sessionKey = ctx.SessionKey?.trim() ?? "";
|
||||
const accountId = ctx.AccountId?.trim() ?? "";
|
||||
const threadId =
|
||||
typeof ctx.MessageThreadId === "number" ? String(ctx.MessageThreadId) : "";
|
||||
return [provider, accountId, sessionKey, peerId, threadId, messageId]
|
||||
.filter(Boolean)
|
||||
.join("|");
|
||||
const threadId = typeof ctx.MessageThreadId === "number" ? String(ctx.MessageThreadId) : "";
|
||||
return [provider, accountId, sessionKey, peerId, threadId, messageId].filter(Boolean).join("|");
|
||||
}
|
||||
|
||||
export function shouldSkipDuplicateInbound(
|
||||
|
||||
Reference in New Issue
Block a user