fix: ruff
This commit is contained in:
@@ -128,7 +128,6 @@ class SubHeartflow:
|
||||
if rewind:
|
||||
self.normal_chat_instance = NormalChat(chat_stream=chat_stream, interest_dict=self.get_interest_dict())
|
||||
else:
|
||||
|
||||
self.normal_chat_instance = NormalChat(chat_stream=chat_stream)
|
||||
|
||||
# 进行异步初始化
|
||||
|
||||
@@ -249,22 +249,14 @@ class SubMind:
|
||||
else:
|
||||
# 调用记忆系统获取相关记忆
|
||||
related_memory = await HippocampusManager.get_instance().get_memory_from_topic(
|
||||
valid_keywords=filtered_keywords,
|
||||
max_memory_num=3,
|
||||
max_memory_length=2,
|
||||
max_depth=3
|
||||
valid_keywords=filtered_keywords, max_memory_num=3, max_memory_length=2, max_depth=3
|
||||
)
|
||||
|
||||
logger.debug(f"{self.log_prefix} 获取到的记忆: {related_memory}")
|
||||
|
||||
if related_memory:
|
||||
for topic, memory in related_memory:
|
||||
new_item = {
|
||||
"type": "memory",
|
||||
"id": topic,
|
||||
"content": memory,
|
||||
"ttl": 3
|
||||
}
|
||||
new_item = {"type": "memory", "id": topic, "content": memory, "ttl": 3}
|
||||
self.structured_info.append(new_item)
|
||||
logger.debug(f"{self.log_prefix} 添加新记忆: {topic} - {memory}")
|
||||
else:
|
||||
|
||||
@@ -280,7 +280,7 @@ class SubHeartflowManager:
|
||||
# --- 新增:检查是否允许进入 FOCUS 模式 --- #
|
||||
if not global_config.allow_focus_mode:
|
||||
if int(time.time()) % 60 == 0: # 每60秒输出一次日志避免刷屏
|
||||
logger.trace(f"未开启 FOCUSED 状态 (allow_focus_mode=False)")
|
||||
logger.trace("未开启 FOCUSED 状态 (allow_focus_mode=False)")
|
||||
return # 如果不允许,直接返回
|
||||
# --- 结束新增 ---
|
||||
|
||||
@@ -303,19 +303,20 @@ class SubHeartflowManager:
|
||||
if sub_hf.chat_state.chat_status == ChatState.FOCUSED:
|
||||
continue
|
||||
|
||||
|
||||
if sub_hf.interest_chatting.start_hfc_probability == 0:
|
||||
continue
|
||||
else:
|
||||
logger.debug(f"{stream_name},现在状态: {sub_hf.chat_state.chat_status.value},进入专注概率: {sub_hf.interest_chatting.start_hfc_probability}")
|
||||
logger.debug(
|
||||
f"{stream_name},现在状态: {sub_hf.chat_state.chat_status.value},进入专注概率: {sub_hf.interest_chatting.start_hfc_probability}"
|
||||
)
|
||||
|
||||
# 调试用
|
||||
from .mai_state_manager import enable_unlimited_hfc_chat
|
||||
|
||||
if not enable_unlimited_hfc_chat:
|
||||
if sub_hf.chat_state.chat_status != ChatState.CHAT:
|
||||
continue
|
||||
|
||||
|
||||
if random.random() >= sub_hf.interest_chatting.start_hfc_probability:
|
||||
continue
|
||||
|
||||
@@ -416,7 +417,9 @@ class SubHeartflowManager:
|
||||
|
||||
chat_status_prompt = "当前没有在任何群聊中。" # 默认消息喵~
|
||||
if chat_status_lines:
|
||||
chat_status_prompt = "当前聊天情况,你已经参与了下面这几个群的聊天:\n" + "\n".join(chat_status_lines) # 拼接状态信息
|
||||
chat_status_prompt = "当前聊天情况,你已经参与了下面这几个群的聊天:\n" + "\n".join(
|
||||
chat_status_lines
|
||||
) # 拼接状态信息
|
||||
|
||||
prompt = (
|
||||
f"{prompt_personality}\n"
|
||||
|
||||
Reference in New Issue
Block a user