mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 13:44:03 +00:00
fix(whatsapp): remove implicit [openclaw] self-chat prefix
This commit is contained in:
@@ -219,6 +219,33 @@ describe("web processMessage inbound contract", () => {
|
||||
expect(dispatcherOptions?.responsePrefix).toBe("[Mainbot]");
|
||||
});
|
||||
|
||||
it("does not force an [openclaw] response prefix in self-chats when identity is unset", async () => {
|
||||
capturedDispatchParams = undefined;
|
||||
|
||||
await processMessage(
|
||||
makeProcessMessageArgs({
|
||||
routeSessionKey: "agent:main:whatsapp:direct:+1555",
|
||||
groupHistoryKey: "+1555",
|
||||
cfg: {
|
||||
messages: {},
|
||||
session: { store: sessionStorePath },
|
||||
} as unknown as ReturnType<typeof import("../../../config/config.js").loadConfig>,
|
||||
msg: {
|
||||
id: "msg1",
|
||||
from: "+1555",
|
||||
to: "+1555",
|
||||
selfE164: "+1555",
|
||||
chatType: "direct",
|
||||
body: "hi",
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const dispatcherOptions = (capturedDispatchParams as any)?.dispatcherOptions;
|
||||
expect(dispatcherOptions?.responsePrefix).toBeUndefined();
|
||||
});
|
||||
|
||||
it("clears pending group history when the dispatcher does not queue a final reply", async () => {
|
||||
capturedCtx = undefined;
|
||||
const groupHistories = new Map<string, Array<{ sender: string; body: string }>>([
|
||||
|
||||
@@ -279,7 +279,7 @@ export async function processMessage(params: {
|
||||
const responsePrefix =
|
||||
prefixOptions.responsePrefix ??
|
||||
(configuredResponsePrefix === undefined && isSelfChat
|
||||
? (resolveIdentityNamePrefix(params.cfg, params.route.agentId) ?? "[openclaw]")
|
||||
? resolveIdentityNamePrefix(params.cfg, params.route.agentId)
|
||||
: undefined);
|
||||
|
||||
const inboundHistory =
|
||||
|
||||
Reference in New Issue
Block a user