OCR行过滤加*开头和*配对残片丢弃,修复*如有错误、*x但不衢...x*漏网

This commit is contained in:
youpaishidifu
2026-07-28 18:42:10 +08:00
parent 06ead20a6d
commit f3cdb142b8
+12
View File
@@ -1370,6 +1370,18 @@ class MessageMonitor:
logger.debug(f"[{platform}] OCR 过滤: 全角链接残片 line={line!r}")
continue
# —— * 开头 md 残片:OCR 吞了另一半,如 *如有错误。请您 ——
# 正常用户在 QQ/微信聊天从不以 * 开头
if line.startswith('*'):
logger.debug(f"[{platform}] OCR 过滤: *开头残片 line={line!r}")
continue
# —— *...* 配对残片:OCR 把 **使用** 啃成 *x但不衢...x* ——
# 任何 * 包裹内容(不论内容如何)都是 md 语法残余
if re.search(r'\*[^*]+\*', line):
logger.debug(f"[{platform}] OCR 过滤: *配对残片 line={line!r}")
continue
texts.append(line)
logger.debug(f"[{platform}] OCR -> {len(ocr_lines)} raw, {len(texts)} filtered, "
f"last=\"{texts[-1][:50] if texts else ''}\"")