From 5ca9a8d1d951e463e12fc8f7d79cacbd060279da Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 7 Apr 2026 14:52:38 +0800 Subject: [PATCH] tune xiaoniu low-frequency social interjections --- plugins/ai_auto_response/config.toml | 7 ++++--- plugins/ai_auto_response/response_planner.py | 4 +++- plugins/ai_auto_response/triggers.py | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/plugins/ai_auto_response/config.toml b/plugins/ai_auto_response/config.toml index 5f183fa..3babd0c 100644 --- a/plugins/ai_auto_response/config.toml +++ b/plugins/ai_auto_response/config.toml @@ -35,18 +35,19 @@ at_bot = 1.0 explicit_question = 0.95 followup = 0.90 social_call = 0.65 +light_social = 0.45 casual_topic = 0.35 [flow] enable_flow_state = true flow_decay_per_minute = 12 idle_threshold = 30 -warming_threshold = 55 -engaged_threshold = 90 +warming_threshold = 48 +engaged_threshold = 78 at_bot_boost = 40 question_boost = 30 followup_boost = 20 -topic_boost = 8 +topic_boost = 10 returning_member_boost = 6 response_accepted_boost = 10 ignored_reply_penalty = 20 diff --git a/plugins/ai_auto_response/response_planner.py b/plugins/ai_auto_response/response_planner.py index 8a85ffa..23dce00 100644 --- a/plugins/ai_auto_response/response_planner.py +++ b/plugins/ai_auto_response/response_planner.py @@ -33,7 +33,9 @@ class ResponsePlanner: if trigger.get("is_followup"): return False if trigger.get("is_social_call"): - return False + if acceptance_state == "cold": + return False + return flow_state in {"engaged", "deep_engaged"} if trigger.get("is_returning_member"): return False if not allow_proactive: diff --git a/plugins/ai_auto_response/triggers.py b/plugins/ai_auto_response/triggers.py index 5c8f294..1660a23 100644 --- a/plugins/ai_auto_response/triggers.py +++ b/plugins/ai_auto_response/triggers.py @@ -10,6 +10,10 @@ QUESTION_PATTERNS = [ r"有人知道", r"谁知道", r"能不能", r"可以吗", r"报错", r"怎么解决", ] SOCIAL_PATTERNS = [r"小牛", r"在吗", r"出来", r"帮忙看", r"看看"] +LIGHT_SOCIAL_PATTERNS = [ + r"哈哈", r"笑死", r"绷不住", r"离谱", r"逆天", r"牛逼", r"卧槽", r"我去", + r"确实", r"也是", r"6$", r"可以啊", r"有点东西", r"抽象", +] @dataclass @@ -66,6 +70,12 @@ class TriggerRouter: result.priority = max(result.priority, float(self.config.get("social_call", 0.65))) result.is_social_call = True result.reasons.append("social_call") + elif self._is_light_social_moment(content_lower): + if result.priority < float(self.config.get("light_social", 0.45)): + result.trigger_type = result.trigger_type if result.trigger_type != "none" else "light_social_trigger" + result.priority = max(result.priority, float(self.config.get("light_social", 0.45))) + result.is_social_call = True + result.reasons.append("light_social") if memory_hints.get("returning_member_state") in {"returning_member", "long_absent_member"}: result.is_returning_member = True result.reasons.append(memory_hints.get("returning_member_state")) @@ -80,6 +90,11 @@ class TriggerRouter: def _is_social_call(self, content: str) -> bool: return any(re.search(pattern, content, flags=re.IGNORECASE) for pattern in SOCIAL_PATTERNS) + def _is_light_social_moment(self, content: str) -> bool: + if len(content) > 24: + return False + return any(re.search(pattern, content, flags=re.IGNORECASE) for pattern in LIGHT_SOCIAL_PATTERNS) + def _detect_topic(self, content_lower: str) -> str: for keyword in self.topic_keywords: if keyword and keyword in content_lower: