Files
abot/plugins/ai_auto_response/response_planner.py

32 lines
1.1 KiB
Python

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 {"deep_engaged"} else "refuse_or_skip"
def should_reply(self, trigger: Dict, flow_state: str, allow_proactive: bool) -> bool:
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