refactor: md checkbox 一刀切,不再枚举符号

用户从不手打 markdown,短方括号结构才是稳定特征:
- [√] [x] [ ] [⚠] [✔] [V] 及 OCR 变体 [ √ ]、全角【√】全部覆盖
- 不再枚举具体勾选符号——OCR 偏差永远撞不全符号
- 多字词方括号([钻石] [VIP])绝不命中,保护用户正文
- \s*.?\s* = 空或单字符,md checkbox 的本质特征

改动点:
1. monitor.py _MD_TAIL_PATTERNS: checkbox 模式改一刀切 + 补全角【】
2. monitor.py _is_markdown_document: checkbox 检测同步放宽
3. monitor.py OCR 过滤链: checkbox残片/多checkbox/计数/行首菜单 4处同步
4. auto_reply.py _clean_markdown: checkbox 移除改一刀切,(?!\() 保护链接

策略(用户定):md在头→整段跳过;在中间→看语义(C#负向前瞻已挡);在尾→一刀切
This commit is contained in:
youpaishidifu
2026-08-17 21:55:28 +08:00
parent 4005369492
commit f8366798f6
2 changed files with 34 additions and 22 deletions
+6 -5
View File
@@ -622,11 +622,12 @@ class AutoReply:
# 移除列表语法:- item → item
text = re.sub(r'^[\-\*]\s+', '', text, flags=re.MULTILINE)
# ⭐ Task #1549: 移除 checkbox 标记:[√] GitHub(稳定版) → GitHub(稳定版)
# KB 中的下载选项列表使用 checkbox 格式,如 "- [ √ ] GitHub(稳定版)"
# 清理后应返回 "GitHub(稳定版)" 而非 "[ √ ] GitHub(稳定版)"
# 支持: [√] [✗] [X] [x] [V] [v] [ ] [⚠] [!]
text = re.sub(r'\[\s*[√✗XxVv⚠! ]?\s*\]\s*', '', text)
# ⭐ Task #1549+ 一刀切:md checkbox 内容=单符号或空白([√] [x] [ ] [⚠]),
# 直接剥掉。不再枚举具体符号——OCR 偏差永远撞不全符号,
# 单字符方括号结构才是稳定特征([ √ ] 带空格变体也覆盖)。
# \s*.?\s* = 空 或 单字符;多字词 [钻石] [VIP] 不剥,保护正文内容。
# (?!\() 保护 md 链接 [text](url):keep_links 模式下不误伤链接体。
text = re.sub(r'\[\s*.?\s*\](?!\()\s*', '', text)
# 移除加粗语法:**text** → text
text = re.sub(r'\*\*(.+?)\*\*', r'\1', text)