Update subheartflow_manager.py
This commit is contained in:
@@ -262,10 +262,12 @@ class SubHeartflowManager:
|
|||||||
|
|
||||||
async def evaluate_interest_and_promote(self):
|
async def evaluate_interest_and_promote(self):
|
||||||
"""评估子心流兴趣度,满足条件且未达上限则提升到FOCUSED状态(基于start_hfc_probability)"""
|
"""评估子心流兴趣度,满足条件且未达上限则提升到FOCUSED状态(基于start_hfc_probability)"""
|
||||||
|
try:
|
||||||
log_prefix = "[兴趣评估]"
|
log_prefix = "[兴趣评估]"
|
||||||
# 使用 self.mai_state_info 获取当前状态和限制
|
# 使用 self.mai_state_info 获取当前状态和限制
|
||||||
current_state = self.mai_state_info.get_current_state()
|
current_state = self.mai_state_info.get_current_state()
|
||||||
focused_limit = current_state.get_focused_chat_max_num()
|
focused_limit = current_state.get_focused_chat_max_num()
|
||||||
|
logger.debug(f"{log_prefix} 当前状态 ({current_state.value}) 开始尝试提升到FOCUSED状态")
|
||||||
|
|
||||||
if int(time.time()) % 20 == 0: # 每20秒输出一次
|
if int(time.time()) % 20 == 0: # 每20秒输出一次
|
||||||
logger.debug(f"{log_prefix} 当前状态 ({current_state.value}) 可以在{focused_limit}个群激情聊天")
|
logger.debug(f"{log_prefix} 当前状态 ({current_state.value}) 可以在{focused_limit}个群激情聊天")
|
||||||
@@ -319,6 +321,8 @@ class SubHeartflowManager:
|
|||||||
final_subflow := self.subheartflows.get(flow_id)
|
final_subflow := self.subheartflows.get(flow_id)
|
||||||
) and final_subflow.chat_state.chat_status == ChatState.FOCUSED:
|
) and final_subflow.chat_state.chat_status == ChatState.FOCUSED:
|
||||||
current_focused_count += 1
|
current_focused_count += 1
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"启动HFC 兴趣评估失败: {e}", exc_info=True)
|
||||||
|
|
||||||
async def evaluate_and_transition_subflows_by_llm(self):
|
async def evaluate_and_transition_subflows_by_llm(self):
|
||||||
"""
|
"""
|
||||||
@@ -352,7 +356,7 @@ class SubHeartflowManager:
|
|||||||
first_observation = sub_hf.observations[0]
|
first_observation = sub_hf.observations[0]
|
||||||
if isinstance(first_observation, ChattingObservation):
|
if isinstance(first_observation, ChattingObservation):
|
||||||
# 组合中期记忆和当前聊天内容
|
# 组合中期记忆和当前聊天内容
|
||||||
first_observation.observe()
|
await first_observation.observe()
|
||||||
current_chat = first_observation.talking_message_str or "当前无聊天内容。"
|
current_chat = first_observation.talking_message_str or "当前无聊天内容。"
|
||||||
combined_summary = f"当前聊天内容:\n{current_chat}"
|
combined_summary = f"当前聊天内容:\n{current_chat}"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user