refactor(distribution_manager): 优化流循环管理逻辑,减少重复代码并改进异常处理

refactor(action_manager): 将异步存储操作改为非阻塞任务,提升性能
refactor(default_generator): 简化回复生成器中的消息处理逻辑
refactor(generator_api): 更新类型提示,增强代码可读性
refactor(affinity_chatter): 清理异常处理中的冗余代码,确保处理标记的正确清理
refactor(affinity_interest_calculator): 重命名阈值调整方法,提升代码一致性
refactor(plan_executor): 移除冗余的已读消息处理逻辑
refactor(planner): 优化规划器中的异常处理,确保正常模式的退出检查
This commit is contained in:
Windpicker-owo
2025-11-12 16:08:52 +08:00
parent 66c23e1ba1
commit 80736a0deb
8 changed files with 38 additions and 78 deletions

View File

@@ -380,8 +380,8 @@ class DefaultReplyer:
if not prompt:
logger.warning("构建prompt失败跳过回复生成")
return False, None, None
from src.plugin_system.core.event_manager import event_manager
# 触发 POST_LLM 事件(请求 LLM 之前)
if not from_plugin:
result = await event_manager.trigger_event(
@@ -1202,19 +1202,11 @@ class DefaultReplyer:
return ""
else:
# 有 reply_message正常处理
# 统一处理 DatabaseMessages 对象和字典
if isinstance(reply_message, DatabaseMessages):
platform = reply_message.chat_info.platform
user_id = reply_message.user_info.user_id
user_nickname = reply_message.user_info.user_nickname
user_cardname = reply_message.user_info.user_cardname
processed_plain_text = reply_message.processed_plain_text
else:
platform = reply_message.get("chat_info_platform")
user_id = reply_message.get("user_id")
user_nickname = reply_message.get("user_nickname")
user_cardname = reply_message.get("user_cardname")
processed_plain_text = reply_message.get("processed_plain_text")
platform = reply_message.chat_info.platform
user_id = reply_message.user_info.user_id
user_nickname = reply_message.user_info.user_nickname
user_cardname = reply_message.user_info.user_cardname
processed_plain_text = reply_message.processed_plain_text
person_id = person_info_manager.get_person_id(
platform, # type: ignore
@@ -1237,7 +1229,7 @@ class DefaultReplyer:
current_user_id = await person_info_manager.get_value(person_id, "user_id")
current_platform = platform
if current_user_id == bot_user_id and current_platform == global_config.bot.platform:
if str(current_user_id) == bot_user_id and current_platform == global_config.bot.platform:
sender = f"{person_name}(你)"
else:
# 如果不是bot自己直接使用person_name