mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-23 10:42:00 +00:00
fix(signal): strip bot self-mention from group messages before agent dispatch
This commit is contained in:
parent
65561e9de6
commit
96b10327b6
1 changed files with 11 additions and 0 deletions
|
|
@ -620,6 +620,17 @@ class SignalAdapter(BasePlatformAdapter):
|
|||
"Signal: ignoring group message (require_mention=true, bot not mentioned)"
|
||||
)
|
||||
return
|
||||
# Strip the bot's own @mention from the message text so the agent
|
||||
# doesn't misinterpret "@+155****4567 say hello" as a directive to
|
||||
# contact that phone number. _render_mentions replaces the Signal
|
||||
#  placeholder with @<number-or-uuid>, which looks like an
|
||||
# addressee to the LLM rather than a self-reference.
|
||||
if account_norm:
|
||||
text = text.replace(f"@{account_norm}", "").strip()
|
||||
# Also strip if the mention was rendered using the bot's UUID
|
||||
bot_uuid = self._recipient_uuid_by_number.get(account_norm)
|
||||
if bot_uuid:
|
||||
text = text.replace(f"@{bot_uuid}", "").strip()
|
||||
|
||||
# Extract quote (reply-to) context from Signal dataMessage. Signal's
|
||||
# quote.id is the timestamp of the quoted message; quote.author points
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue