refactor(at_user): 优化艾特用户插件逻辑并移除模糊匹配
重构了艾特用户插件,主要改动如下: - 移除 `fuzzywuzzy` 依赖和相关的模糊匹配逻辑,改为直接通过 `person_info_manager` 精确查找用户。 - 优化了 `AtAction` 的执行流程,现在通过调用 `DefaultReplyer` 生成更智能、更符合上下文的回复内容,而不是发送固定文本。 - 新增了 `/at` 命令,允许用户通过指令直接艾特指定用户并发送消息。 - 删除了 `proactive_thinker.py` 中不再使用的 `_get_reminder_context` 方法,以清理与旧提醒功能相关的代码。
This commit is contained in:
committed by
Windpicker-owo
parent
5eaa5f74e8
commit
31bdaa3747
@@ -138,20 +138,6 @@ class ProactiveThinker:
|
||||
except Exception as e:
|
||||
logger.error(f"{self.context.log_prefix} 主动思考执行异常: {e}")
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
async def _get_reminder_context(self, message_id: str) -> str:
|
||||
"""获取提醒消息的上下文"""
|
||||
try:
|
||||
# 只获取那一条消息
|
||||
message_record = await db_get(Messages, {"message_id": message_id}, single_result=True)
|
||||
if message_record:
|
||||
# 使用 build_readable_messages_with_id 来格式化单条消息
|
||||
chat_context_block, _ = build_readable_messages_with_id(messages=[message_record])
|
||||
return chat_context_block
|
||||
return "无法加载相关的聊天记录。"
|
||||
except Exception as e:
|
||||
logger.error(f"{self.context.log_prefix} 获取提醒上下文失败: {e}")
|
||||
return "无法加载相关的聊天记录。"
|
||||
|
||||
|
||||
async def _generate_proactive_content_and_send(self, action_result: Dict[str, Any], trigger_event: ProactiveTriggerEvent):
|
||||
|
||||
Reference in New Issue
Block a user