Merge branch 'afc' of https://github.com/MoFox-Studio/MoFox_Bot into afc
This commit is contained in:
@@ -107,6 +107,16 @@ class ChatterManager:
|
||||
result = await self.instances[stream_id].execute(context)
|
||||
self.stats["successful_executions"] += 1
|
||||
|
||||
# 从 mood_manager 获取最新的 chat_stream 并同步回 StreamContext
|
||||
try:
|
||||
from src.mood.mood_manager import mood_manager
|
||||
mood = mood_manager.get_mood_by_chat_id(stream_id)
|
||||
if mood and mood.chat_stream:
|
||||
context.chat_stream = mood.chat_stream
|
||||
logger.debug(f"已将最新的 chat_stream 同步回流 {stream_id} 的 StreamContext")
|
||||
except Exception as sync_e:
|
||||
logger.error(f"同步 chat_stream 回 StreamContext 失败: {sync_e}")
|
||||
|
||||
# 记录处理结果
|
||||
success = result.get("success", False)
|
||||
actions_count = result.get("actions_count", 0)
|
||||
|
||||
@@ -257,6 +257,10 @@ class ChatStream:
|
||||
self.last_interaction_time = time.time()
|
||||
self.focus_energy = self._calculate_dynamic_focus_energy()
|
||||
|
||||
def update_focus_energy(self):
|
||||
"""手动触发更新focus_energy"""
|
||||
self.focus_energy = self._calculate_dynamic_focus_energy()
|
||||
|
||||
def record_action(self, is_reply: bool = False):
|
||||
"""记录动作执行"""
|
||||
self.action_count += 1
|
||||
@@ -530,7 +534,6 @@ class ChatManager:
|
||||
"action_count": s_data_dict.get("action_count", 0),
|
||||
"reply_count": s_data_dict.get("reply_count", 0),
|
||||
"last_interaction_time": s_data_dict.get("last_interaction_time", time.time()),
|
||||
"relationship_score": s_data_dict.get("relationship_score", 0.3),
|
||||
"consecutive_no_reply": s_data_dict.get("consecutive_no_reply", 0),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user