|
@@ -330,26 +330,6 @@ class DialogueManager:
|
|
# 默认为闲聊状态
|
|
# 默认为闲聊状态
|
|
return DialogueState.CHITCHAT
|
|
return DialogueState.CHITCHAT
|
|
|
|
|
|
- def _trigger_human_intervention(self, reason: str) -> None:
|
|
|
|
- """触发人工介入"""
|
|
|
|
- # 记录人工介入事件
|
|
|
|
- # FIXME: 重启即丢失
|
|
|
|
- event = {
|
|
|
|
- "timestamp": int(time.time() * 1000),
|
|
|
|
- "reason": reason,
|
|
|
|
- "dialogue_context": self.dialogue_history[-10:]
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- # 更新用户资料中的人工介入历史
|
|
|
|
- if "human_intervention_history" not in self.user_profile:
|
|
|
|
- self.user_profile["human_intervention_history"] = []
|
|
|
|
-
|
|
|
|
- self.user_profile["human_intervention_history"].append(event)
|
|
|
|
- self.user_manager.save_user_profile(self.user_id, self.user_profile)
|
|
|
|
-
|
|
|
|
- # 发送告警
|
|
|
|
- self._send_human_intervention_alert()
|
|
|
|
-
|
|
|
|
def _send_human_intervention_alert(self, reason: Optional[str] = None) -> None:
|
|
def _send_human_intervention_alert(self, reason: Optional[str] = None) -> None:
|
|
time_str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
time_str = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
staff_info = f"{self.staff_profile.get("agent_name", "未知")}[{self.staff_id}]"
|
|
staff_info = f"{self.staff_profile.get("agent_name", "未知")}[{self.staff_id}]"
|