|
@@ -436,11 +436,20 @@ class DialogueManager:
|
|
|
if hours_passed < threshold:
|
|
|
return False
|
|
|
# 根据时间上下文决定主动交互的状态
|
|
|
+ if self.is_time_suitable_for_active_conversation(time_context):
|
|
|
+ return True
|
|
|
+ return False
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def is_time_suitable_for_active_conversation(time_context=None) -> bool:
|
|
|
+ if not time_context:
|
|
|
+ time_context = DialogueManager.get_time_context()
|
|
|
if time_context in [TimeContext.MORNING,
|
|
|
TimeContext.NOON, TimeContext.AFTERNOON]:
|
|
|
return True
|
|
|
return False
|
|
|
|
|
|
+
|
|
|
def is_in_human_intervention(self) -> bool:
|
|
|
"""检查是否处于人工介入状态"""
|
|
|
return self.current_state == DialogueState.HUMAN_INTERVENTION
|