feat(affinity-flow): 优化提及检测逻辑和阈值配置

- 简化提及检测逻辑,移除冗余的私聊检查变量
- 使用配置项 mention_bot_adjustment_threshold 替换硬编码的50%阈值
- 在消息处理中清除开头可能存在的空行
- 增加首次认识用户的信息存储方法,避免未知用户处理逻辑
- 调整消息管理器检查间隔从2秒到5秒,减少系统负载
- 修复计划执行器中用户ID比较逻辑,防止自我回复死循环
This commit is contained in:
Windpicker-owo
2025-09-21 18:01:38 +08:00
parent df3c616d09
commit ad729d74c8
6 changed files with 35 additions and 15 deletions

View File

@@ -1051,10 +1051,12 @@ class DefaultReplyer:
# 如果person_name为None使用fallback值
if person_name is None:
# 尝试从reply_message获取用户名
fallback_name = reply_message.get("user_nickname") or reply_message.get("user_id", "未知用户")
logger.warning(f"未知用户,将存储用户信息:{fallback_name}")
person_name = str(fallback_name)
person_info_manager.set_value(person_id, "person_name", fallback_name)
await person_info_manager.first_knowing_some_one(
platform, # type: ignore
reply_message.get("user_id"), # type: ignore
reply_message.get("user_nickname"),
reply_message.get("user_cardname")
)
# 检查是否是bot自己的名字如果是则替换为"(你)"
bot_user_id = str(global_config.bot.qq_account)