Prechádzať zdrojové kódy

Update dialogue_manager: fix recovering interaction time

StrayWarrior 2 týždňov pred
rodič
commit
b7dc40629c
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      dialogue_manager.py

+ 2 - 2
dialogue_manager.py

@@ -111,9 +111,9 @@ class DialogueManager:
         self.current_state, self.previous_state = self.state_cache.get_state(self.staff_id, self.user_id)
 
         # 从数据库恢复对话状态
-        last_message = self.history_dialogue_service.get_dialogue_history(self.staff_id, self.user_id, 1)
+        last_message = self.history_dialogue_service.get_dialogue_history(self.staff_id, self.user_id, 10)
         if last_message:
-            self.last_interaction_time = last_message[0]['timestamp']
+            self.last_interaction_time = last_message[-1]['timestamp']
         else:
             # 默认设置为24小时前
             self.last_interaction_time = int(time.time() * 1000) - 24 * 3600 * 1000