mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-02 11:27:15 +00:00
fix(telegram): scope DM topic thread keys by chat id
This commit is contained in:
committed by
Peter Steinberger
parent
bbab94c1fe
commit
049f00ab57
@@ -290,7 +290,7 @@ export const registerTelegramHandlers = ({
|
|||||||
const dmThreadId = !params.isGroup ? params.messageThreadId : undefined;
|
const dmThreadId = !params.isGroup ? params.messageThreadId : undefined;
|
||||||
const threadKeys =
|
const threadKeys =
|
||||||
dmThreadId != null
|
dmThreadId != null
|
||||||
? resolveThreadSessionKeys({ baseSessionKey, threadId: String(dmThreadId) })
|
? resolveThreadSessionKeys({ baseSessionKey, threadId: `${params.chatId}:${dmThreadId}` })
|
||||||
: null;
|
: null;
|
||||||
const sessionKey = threadKeys?.sessionKey ?? baseSessionKey;
|
const sessionKey = threadKeys?.sessionKey ?? baseSessionKey;
|
||||||
const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ describe("buildTelegramMessageContext dm thread sessions", () => {
|
|||||||
|
|
||||||
expect(ctx).not.toBeNull();
|
expect(ctx).not.toBeNull();
|
||||||
expect(ctx?.ctxPayload?.MessageThreadId).toBe(42);
|
expect(ctx?.ctxPayload?.MessageThreadId).toBe(42);
|
||||||
expect(ctx?.ctxPayload?.SessionKey).toBe("agent:main:main:thread:42");
|
expect(ctx?.ctxPayload?.SessionKey).toBe("agent:main:main:thread:1234:42");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps legacy dm session key when no thread id", async () => {
|
it("keeps legacy dm session key when no thread id", async () => {
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ export const buildTelegramMessageContext = async ({
|
|||||||
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : undefined;
|
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : undefined;
|
||||||
const threadKeys =
|
const threadKeys =
|
||||||
dmThreadId != null
|
dmThreadId != null
|
||||||
? resolveThreadSessionKeys({ baseSessionKey, threadId: String(dmThreadId) })
|
? resolveThreadSessionKeys({ baseSessionKey, threadId: `${chatId}:${dmThreadId}` })
|
||||||
: null;
|
: null;
|
||||||
const sessionKey = threadKeys?.sessionKey ?? baseSessionKey;
|
const sessionKey = threadKeys?.sessionKey ?? baseSessionKey;
|
||||||
const mentionRegexes = buildMentionRegexes(cfg, route.agentId);
|
const mentionRegexes = buildMentionRegexes(cfg, route.agentId);
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ export const registerTelegramNativeCommands = ({
|
|||||||
dmThreadId != null
|
dmThreadId != null
|
||||||
? resolveThreadSessionKeys({
|
? resolveThreadSessionKeys({
|
||||||
baseSessionKey,
|
baseSessionKey,
|
||||||
threadId: String(dmThreadId),
|
threadId: `${chatId}:${dmThreadId}`,
|
||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
const sessionKey = threadKeys?.sessionKey ?? baseSessionKey;
|
const sessionKey = threadKeys?.sessionKey ?? baseSessionKey;
|
||||||
|
|||||||
Reference in New Issue
Block a user