修复Markdown标题过滤:支持无空格格式#xxx

This commit is contained in:
youpaishidifu
2026-08-22 09:55:56 +08:00
parent 7257bfb028
commit 05e7722816
+4 -1
View File
@@ -6776,7 +6776,9 @@ class MessageMonitor:
# 引用块 > (容忍无空格)
re.compile(r'^>\s*'),
# 标题 # / ## (容忍直接跟汉字/数字、容忍无空格)
# ⭐ 2026-08-22 修复:增加无空格模式,确保 "#@xxx" 或 "#xxx" 能被剥离
re.compile(r'^#{1,6}\s*'),
re.compile(r'^#{1,6}(?=[@A-Za-z0-9\u4e00-\u9fff])'),
# md checkbox 残片(单字符/空方括号,OCR 退化 [ √ ] [x] [ ] 全覆盖)
# 仅单字符/空白内容,用户游戏名词方括号[钻石](多字词)绝不命中
re.compile(r'^\[\s*.?\s*\]\s*'),
@@ -6870,7 +6872,8 @@ class MessageMonitor:
logger.debug(f"[ocr] 过滤器3结果: 空文本,返回False")
return False
# # 行首标题:短文本也检测(OCR 把 ##协议修 切成 5 字符片段)
if re.match(r'^#{1,6}(?:\s|\[|[\u4e00-\u9fff])', text):
# ⭐ 2026-08-22 修复:增加无空格检测,防止 "#@xxx" 格式漏网
if re.match(r'^#{1,6}(?:\s|\[|[\u4e00-\u9fff]|[@A-Za-z0-9])', text):
logger.debug(f"[ocr] 过滤器3结果: 检测到Markdown标题语法,返回True")
return True
# 中文编号列表:第X步 / 步骤X(Bot md 回复常见,用户日常不打)