refactor ai_auto_response into xiaoniu group bot
This commit is contained in:
23
plugins/ai_auto_response/response_planner.py
Normal file
23
plugins/ai_auto_response/response_planner.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class ResponsePlanner:
|
||||
def choose_reply_mode(self, trigger: Dict, flow_state: str) -> str:
|
||||
if trigger.get("is_question"):
|
||||
return "qa_with_context" if flow_state in {"engaged", "deep_engaged"} else "qa_fast"
|
||||
if trigger.get("is_followup"):
|
||||
return "qa_with_context"
|
||||
if trigger.get("is_social_call"):
|
||||
return "social_short"
|
||||
if trigger.get("is_returning_member"):
|
||||
return "social_short"
|
||||
return "social_short" if flow_state in {"warming", "engaged"} else "refuse_or_skip"
|
||||
|
||||
def should_reply(self, trigger: Dict, flow_state: str, allow_proactive: bool) -> bool:
|
||||
if trigger.get("should_respond"):
|
||||
return True
|
||||
if not allow_proactive:
|
||||
return False
|
||||
return flow_state in {"warming", "engaged", "deep_engaged"} and trigger.get("priority", 0) >= 0.35
|
||||
Reference in New Issue
Block a user