diff --git a/monitor.py b/monitor.py index 1cc8626..7e32204 100644 --- a/monitor.py +++ b/monitor.py @@ -570,8 +570,9 @@ class MessageMonitor: # 先切 QQ 到前台再截屏,避免 CMD 窗口遮挡→OCR 读到终端文字 self._ensure_foreground(hwnd) time.sleep(0.15) - # 左边界调到 33%,捕获更靠左的消息文字 - cap_left = int(left + win_w * 0.25) + # 左边界 35%,从消息面板左侧开始(联系人/会话列表 / 消息面板分界约 55%) + # 但消息正文在面板左侧,因此稍左移 35% 覆盖消息文字左侧边缘 + cap_left = int(left + win_w * 0.35) cap_top = top + max(40, int(win_h * 0.04)) # 标题栏下方 cap_right = int(left + win_w * 0.95) # 跳过滚动条 cap_bottom = bottom - max(100, int(win_h * 0.10)) # 输入框上方 @@ -946,19 +947,20 @@ class MessageMonitor: for n in qq_ui_noise: if text == n: return True - # 系统事件模板 + # 系统事件模板 — 注意:用 startswith 而非 in,避免混合文本(OCR 多行合一)误杀 system_patterns = [ "已自动回复", "知识库中未找到", "找到相关结果", "监控已启动", "监控已暂停", "设置已保存", "🤖", "找不到联系人", "当前会话回复", "自动回复触发", "匹配度", - # KB 文档内容格式(机器人回复内容特征) + # KB 文档内容格式(机器人回复格式),OCR 可能把用户消息+KB 回复混成一行 + # 只有全行以"答:"开头才过滤,内含"答:"的混合文本不过滤 "答:", # 纯系统命令反馈 "PS ", "❯ ", "$ ", ] for p in system_patterns: - if p in text: + if text.startswith(p): return True # 纯时间格式(不含消息内容) if re.match(r'^\d{1,2}:\d{2}', text):