From 8126ab0747f361835a146cdc905f69c0180de9bb Mon Sep 17 00:00:00 2001 From: Windpicker-owo <3431391539@qq.com> Date: Sun, 2 Nov 2025 11:48:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(expression=5Flearner):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=BF=87=E6=BB=A4=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BB=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AD=A6=E4=B9=A0=E8=BF=87=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/express/expression_learner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chat/express/expression_learner.py b/src/chat/express/expression_learner.py index a922a06aa..41068ae7e 100644 --- a/src/chat/express/expression_learner.py +++ b/src/chat/express/expression_learner.py @@ -182,11 +182,12 @@ class ExpressionLearner: if time_diff < min_interval: return False - # 检查消息数量(只检查指定聊天流的消息) + # 检查消息数量(只检查指定聊天流的消息,排除机器人自己的消息) recent_messages = await get_raw_msg_by_timestamp_with_chat_inclusive( chat_id=self.chat_id, timestamp_start=self.last_learning_time, timestamp_end=time.time(), + filter_bot=True, # 过滤掉机器人自己的消息 ) if not recent_messages or len(recent_messages) < self.min_messages_for_learning: @@ -506,12 +507,13 @@ class ExpressionLearner: current_time = time.time() - # 获取上次学习时间 + # 获取上次学习时间,过滤掉机器人自己的消息 random_msg: list[dict[str, Any]] | None = await get_raw_msg_by_timestamp_with_chat_inclusive( chat_id=self.chat_id, timestamp_start=self.last_learning_time, timestamp_end=current_time, limit=num, + filter_bot=True, # 过滤掉机器人自己的消息,防止学习自己的表达方式 ) # print(random_msg)