md表格细胞值提取加固+replied子串包含过滤 CUDA Torch 安装 2>&1

This commit is contained in:
youpaishidifu
2026-07-27 19:47:39 +08:00
parent 17bfe35520
commit 79b739f59d
+19 -6
View File
@@ -1499,12 +1499,20 @@ class MessageMonitor:
# 提取 md 标记前的用户文本 # 提取 md 标记前的用户文本
if md_start > 2: if md_start > 2:
head = text[:md_start].strip() # 如果 md 标记是 | 且前一个字符非空白 → head 是表格细胞值,不是用户提问
# 去掉尾部状态标记 skip_head = (
head = re.sub(r'\s*(?:[A-Za-z0-9]~)+\s*$', '', head).strip() md_start < len(text)
# 过滤纯标点/符号 and text[md_start] == '|'
if head and not re.match(r'^[\d:\s|]+$', head): and md_start > 0
results.append(head) and not text[md_start-1].isspace()
)
if not skip_head:
head = text[:md_start].strip()
# 去掉尾部状态标记
head = re.sub(r'\s*(?:[A-Za-z0-9]~)+\s*$', '', head).strip()
# 过滤纯标点/符号
if head and not re.match(r'^[\d:\s|]+$', head):
results.append(head)
# 提取末尾可能的用户文本(md 块之后的尾巴) # 提取末尾可能的用户文本(md 块之后的尾巴)
# 找最后一个句号/感叹号/问号后的内容(可能是新消息的开头) # 找最后一个句号/感叹号/问号后的内容(可能是新消息的开头)
@@ -2067,6 +2075,11 @@ class MessageMonitor:
if self._fuzzy_duplicate(ts, replied, threshold=0.85): if self._fuzzy_duplicate(ts, replied, threshold=0.85):
logger.debug(f"[{platform}] 回复模糊跳过: {ts[:50]}") logger.debug(f"[{platform}] 回复模糊跳过: {ts[:50]}")
continue continue
# _replied_texts 子串包含:OCR 提取的 md 表格细胞值(如"依赖插件可选/必选")
# 是 bot 回复表的一部分,不是用户提问。长度>5才检查避免误杀短消息。
if len(ts) > 5 and any(ts in r for r in replied):
logger.debug(f"[{platform}] 回复子串包含跳过({len(ts)}c): {ts[:50]}")
continue
if ts in seen: if ts in seen:
continue continue
# 模糊匹配:OCR 输出每次微小差异(勖彐碎片、行首数字、尾部截断) # 模糊匹配:OCR 输出每次微小差异(勖彐碎片、行首数字、尾部截断)