feat(messages): add whatsapp messagePrefix and responsePrefix auto
This commit is contained in:
@@ -15,6 +15,7 @@ export type ResolvedWhatsAppAccount = {
|
||||
accountId: string;
|
||||
name?: string;
|
||||
enabled: boolean;
|
||||
messagePrefix?: string;
|
||||
authDir: string;
|
||||
isLegacyAuthDir: boolean;
|
||||
selfChatMode?: boolean;
|
||||
@@ -111,6 +112,10 @@ export function resolveWhatsAppAccount(params: {
|
||||
accountId,
|
||||
name: accountCfg?.name?.trim() || undefined,
|
||||
enabled,
|
||||
messagePrefix:
|
||||
accountCfg?.messagePrefix ??
|
||||
params.cfg.whatsapp?.messagePrefix ??
|
||||
params.cfg.messages?.messagePrefix,
|
||||
authDir,
|
||||
isLegacyAuthDir: isLegacy,
|
||||
selfChatMode: accountCfg?.selfChatMode ?? params.cfg.whatsapp?.selfChatMode,
|
||||
|
||||
@@ -784,6 +784,7 @@ export async function monitorWebProvider(
|
||||
...baseCfg,
|
||||
whatsapp: {
|
||||
...baseCfg.whatsapp,
|
||||
messagePrefix: account.messagePrefix,
|
||||
allowFrom: account.allowFrom,
|
||||
groupAllowFrom: account.groupAllowFrom,
|
||||
groupPolicy: account.groupPolicy,
|
||||
@@ -1039,8 +1040,9 @@ export async function monitorWebProvider(
|
||||
};
|
||||
|
||||
const buildLine = (msg: WebInboundMsg, agentId: string) => {
|
||||
// Build message prefix: explicit config > identity name > default based on allowFrom
|
||||
// WhatsApp inbound prefix: whatsapp.messagePrefix > legacy messages.messagePrefix > identity/defaults
|
||||
const messagePrefix = resolveMessagePrefix(cfg, agentId, {
|
||||
configured: cfg.whatsapp?.messagePrefix,
|
||||
hasAllowFrom: (cfg.whatsapp?.allowFrom?.length ?? 0) > 0,
|
||||
});
|
||||
const prefixStr = messagePrefix ? `${messagePrefix} ` : "";
|
||||
|
||||
Reference in New Issue
Block a user