tighten xiaoniu reply triggers for direct mentions only

This commit is contained in:
liuwei
2026-04-07 11:50:30 +08:00
parent 8476149a2d
commit d6abb1cc23
2 changed files with 17 additions and 1 deletions

View File

@@ -124,6 +124,8 @@ class AIAutoResponsePlugin(MessagePluginInterface):
return False
if self._should_ignore(content):
return False
if self._is_targeting_other_user(message):
return False
return True
async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
@@ -299,6 +301,12 @@ class AIAutoResponsePlugin(MessagePluginInterface):
return True
return any(content.startswith(prefix) for prefix in self.filters.get("ignore_prefixes", []))
def _is_targeting_other_user(self, message: Dict[str, Any]) -> bool:
if message.get("is_at", False):
return False
raw_content = str(message.get("content", "") or "")
return "@" in raw_content
def _get_sender_name(self, room_id: str, sender: str) -> str:
try:
members = ContactManager.get_instance().get_group_members(room_id)

View File

@@ -16,8 +16,16 @@ class ResponsePlanner:
return "social_short" if flow_state in {"deep_engaged"} else "refuse_or_skip"
def should_reply(self, trigger: Dict, flow_state: str, allow_proactive: bool) -> bool:
if trigger.get("should_respond"):
if trigger.get("is_at"):
return True
if trigger.get("is_question"):
return True
if trigger.get("is_followup"):
return False
if trigger.get("is_social_call"):
return False
if trigger.get("is_returning_member"):
return False
if not allow_proactive:
return False
return flow_state in {"deep_engaged"} and trigger.get("priority", 0) >= 0.65