improve xiaoniu recipient cues and name-prefixed replies

This commit is contained in:
liuwei
2026-04-07 15:32:38 +08:00
parent 9e95b805ec
commit 19d2938870
2 changed files with 86 additions and 4 deletions

View File

@@ -35,7 +35,8 @@ class TriggerRouter:
self.config = config or {}
self.topic_keywords = [str(item).lower() for item in self.config.get("focus", [])]
def route(self, message: Dict, memory_hints: Dict) -> TriggerResult:
def route(self, message: Dict, memory_hints: Dict, conversation_hints: Dict | None = None) -> TriggerResult:
conversation_hints = conversation_hints or {}
content = str(message.get("content", "")).strip()
content_lower = content.lower()
result = TriggerResult()
@@ -80,6 +81,17 @@ class TriggerRouter:
result.priority = max(result.priority, float(self.config.get("light_social", 0.45)))
result.is_social_call = True
result.reasons.append("light_social")
if conversation_hints.get("quote_targets_bot"):
result.is_directed = True
result.should_respond = True
result.reasons.append("quote_targets_bot")
if result.trigger_type == "none":
result.trigger_type = "quote_followup_trigger"
result.priority = max(result.priority, float(self.config.get("followup", 0.90)))
if conversation_hints.get("previous_same_sender_directed") and result.is_question:
result.is_directed = True
result.should_respond = True
result.reasons.append("same_sender_directed")
if result.is_question and result.is_directed:
result.should_respond = True
if memory_hints.get("returning_member_state") in {"returning_member", "long_absent_member"}: