From 33848de623a623ab22ccac1d73e18ca4e1e8e356 Mon Sep 17 00:00:00 2001 From: youpaishidifu Date: Tue, 4 Aug 2026 15:14:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dcleaned=5Fitem?= =?UTF-8?q?=E6=9C=AA=E5=AE=9A=E4=B9=89=E9=94=99=E8=AF=AF=20-=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=B8=85=E7=90=86=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:QQ轮询时cleaned_item变量未定义 根因:OCR清理函数调用顺序错误,在使用变量后才定义变量 修复:将cleaned_item = self._clean_ocr_prefix(item)移到使用前 --- monitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor.py b/monitor.py index e8bde35..8398c6b 100644 --- a/monitor.py +++ b/monitor.py @@ -5269,12 +5269,12 @@ class MessageMonitor: self._last_screenshot_hash.pop(platform, None) self._last_new_msg_time[platform] = time.time() else: + # ⭐ 清理OCR噪声前缀(如"必选,")后再搜索知识库 + cleaned_item = self._clean_ocr_prefix(item) self._last_new_msg_time[platform] = time.time() self._last_msg[platform] = cleaned_item engine_tag = self._last_chosen_engine.get(platform, "") logger.info(f"[{platform}] 新消息[{engine_tag}]: {item[:60]}") - # ⭐ 清理OCR噪声前缀(如"必选,")后再搜索知识库 - cleaned_item = self._clean_ocr_prefix(item) # ⚠️ 急停检查:回复前最后检查,防止急停后仍然发送 if not self._running: return