Merge branch 'main-fix' of https://github.com/SengokuCola/MaiMBot into refactor

This commit is contained in:
tcmofashi
2025-03-28 12:00:33 +08:00
7 changed files with 194 additions and 84 deletions

View File

@@ -113,16 +113,24 @@ class ChatBot:
# 根据话题计算激活度
topic = ""
await self.storage.store_message(message, chat, topic[0] if topic else None)
interested_rate = 0
interested_rate = await HippocampusManager.get_instance().get_activate_from_text(
message.processed_plain_text, fast_retrieval=True
)
# interested_rate = 0.1
# logger.info(f"对{message.processed_plain_text}的激活度:{interested_rate}")
# logger.info(f"\033[1;32m[主题识别]\033[0m 使用{global_config.topic_extract}主题: {topic}")
await self.storage.store_message(message, chat, topic[0] if topic else None)
is_mentioned = is_mentioned_bot_in_message(message)
if global_config.enable_think_flow:
current_willing_old = willing_manager.get_willing(chat_stream=chat)
current_willing_new = (subheartflow_manager.get_subheartflow(chat.stream_id).current_state.willing - 5) / 4
print(f"旧回复意愿:{current_willing_old},新回复意愿:{current_willing_new}")
current_willing = (current_willing_old + current_willing_new) / 2
else:
current_willing = willing_manager.get_willing(chat_stream=chat)
willing_manager.set_willing(chat.stream_id, current_willing)
reply_probability = await willing_manager.change_reply_willing_received(
chat_stream=chat,
is_mentioned_bot=is_mentioned,
@@ -131,10 +139,6 @@ class ChatBot:
interested_rate=interested_rate,
sender_id=str(message.message_info.user_info.user_id),
)
current_willing_old = willing_manager.get_willing(chat_stream=chat)
current_willing_new = (subheartflow_manager.get_subheartflow(chat.stream_id).current_state.willing - 5) / 4
print(f"旧回复意愿:{current_willing_old},新回复意愿:{current_willing_new}")
current_willing = (current_willing_old + current_willing_new) / 2
logger.info(
f"[{current_time}][{chat.group_info.group_name if chat.group_info else '私聊'}]"