fix(whatsapp): use conversation id for context isolation (#911)
Thanks @tristanmanchester. Co-authored-by: Tristan Manchester <tmanchester96@gmail.com>
This commit is contained in:
@@ -25,13 +25,15 @@ export function buildThreadingToolContext(params: {
|
||||
if (!provider) return {};
|
||||
const dock = getChannelDock(provider);
|
||||
if (!dock?.threading?.buildToolContext) return {};
|
||||
// WhatsApp context isolation keys off conversation id, not the bot's own number.
|
||||
const threadingTo = provider === "whatsapp" ? sessionCtx.From ?? sessionCtx.To : sessionCtx.To;
|
||||
return (
|
||||
dock.threading.buildToolContext({
|
||||
cfg: config,
|
||||
accountId: sessionCtx.AccountId,
|
||||
context: {
|
||||
Channel: sessionCtx.Provider,
|
||||
To: sessionCtx.To,
|
||||
To: threadingTo,
|
||||
ReplyToId: sessionCtx.ReplyToId,
|
||||
ThreadLabel: sessionCtx.ThreadLabel,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user