tune xiaoniu low-frequency social interjections
This commit is contained in:
@@ -35,18 +35,19 @@ at_bot = 1.0
|
|||||||
explicit_question = 0.95
|
explicit_question = 0.95
|
||||||
followup = 0.90
|
followup = 0.90
|
||||||
social_call = 0.65
|
social_call = 0.65
|
||||||
|
light_social = 0.45
|
||||||
casual_topic = 0.35
|
casual_topic = 0.35
|
||||||
|
|
||||||
[flow]
|
[flow]
|
||||||
enable_flow_state = true
|
enable_flow_state = true
|
||||||
flow_decay_per_minute = 12
|
flow_decay_per_minute = 12
|
||||||
idle_threshold = 30
|
idle_threshold = 30
|
||||||
warming_threshold = 55
|
warming_threshold = 48
|
||||||
engaged_threshold = 90
|
engaged_threshold = 78
|
||||||
at_bot_boost = 40
|
at_bot_boost = 40
|
||||||
question_boost = 30
|
question_boost = 30
|
||||||
followup_boost = 20
|
followup_boost = 20
|
||||||
topic_boost = 8
|
topic_boost = 10
|
||||||
returning_member_boost = 6
|
returning_member_boost = 6
|
||||||
response_accepted_boost = 10
|
response_accepted_boost = 10
|
||||||
ignored_reply_penalty = 20
|
ignored_reply_penalty = 20
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ class ResponsePlanner:
|
|||||||
if trigger.get("is_followup"):
|
if trigger.get("is_followup"):
|
||||||
return False
|
return False
|
||||||
if trigger.get("is_social_call"):
|
if trigger.get("is_social_call"):
|
||||||
|
if acceptance_state == "cold":
|
||||||
return False
|
return False
|
||||||
|
return flow_state in {"engaged", "deep_engaged"}
|
||||||
if trigger.get("is_returning_member"):
|
if trigger.get("is_returning_member"):
|
||||||
return False
|
return False
|
||||||
if not allow_proactive:
|
if not allow_proactive:
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ QUESTION_PATTERNS = [
|
|||||||
r"有人知道", r"谁知道", r"能不能", r"可以吗", r"报错", r"怎么解决",
|
r"有人知道", r"谁知道", r"能不能", r"可以吗", r"报错", r"怎么解决",
|
||||||
]
|
]
|
||||||
SOCIAL_PATTERNS = [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
|
@dataclass
|
||||||
@@ -66,6 +70,12 @@ class TriggerRouter:
|
|||||||
result.priority = max(result.priority, float(self.config.get("social_call", 0.65)))
|
result.priority = max(result.priority, float(self.config.get("social_call", 0.65)))
|
||||||
result.is_social_call = True
|
result.is_social_call = True
|
||||||
result.reasons.append("social_call")
|
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"}:
|
if memory_hints.get("returning_member_state") in {"returning_member", "long_absent_member"}:
|
||||||
result.is_returning_member = True
|
result.is_returning_member = True
|
||||||
result.reasons.append(memory_hints.get("returning_member_state"))
|
result.reasons.append(memory_hints.get("returning_member_state"))
|
||||||
@@ -80,6 +90,11 @@ class TriggerRouter:
|
|||||||
def _is_social_call(self, content: str) -> bool:
|
def _is_social_call(self, content: str) -> bool:
|
||||||
return any(re.search(pattern, content, flags=re.IGNORECASE) for pattern in SOCIAL_PATTERNS)
|
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:
|
def _detect_topic(self, content_lower: str) -> str:
|
||||||
for keyword in self.topic_keywords:
|
for keyword in self.topic_keywords:
|
||||||
if keyword and keyword in content_lower:
|
if keyword and keyword in content_lower:
|
||||||
|
|||||||
Reference in New Issue
Block a user