feat(messages): also derive responsePrefix from identity.name
When identity.name is configured and responsePrefix is not explicitly set,
automatically default responsePrefix to [identity.name].
This means users only need to set their identity once:
{ identity: { name: "MyBot" } }
And outbound messages will automatically be prefixed with [MyBot].
This commit is contained in:
committed by
Peter Steinberger
parent
8112b276c0
commit
43848b7b43
@@ -1170,9 +1170,15 @@ export async function monitorWebProvider(
|
||||
const textLimit = resolveTextChunkLimit(cfg, "whatsapp");
|
||||
let didLogHeartbeatStrip = false;
|
||||
let didSendReply = false;
|
||||
// Derive responsePrefix from identity.name if not explicitly set
|
||||
const responsePrefix =
|
||||
cfg.messages?.responsePrefix ??
|
||||
(cfg.identity?.name?.trim()
|
||||
? `[${cfg.identity.name.trim()}]`
|
||||
: undefined);
|
||||
const { dispatcher, replyOptions, markDispatchIdle } =
|
||||
createReplyDispatcherWithTyping({
|
||||
responsePrefix: cfg.messages?.responsePrefix,
|
||||
responsePrefix,
|
||||
onHeartbeatStrip: () => {
|
||||
if (!didLogHeartbeatStrip) {
|
||||
didLogHeartbeatStrip = true;
|
||||
|
||||
Reference in New Issue
Block a user