修复_is_noise_text中|运算符类型错误

re.search返回re.Match|None与bool的|=报unsupported operand type(s),
三处_has_user_msg_feature赋值处re.search外加bool()包装。
This commit is contained in:
youpaishidifu
2026-08-24 22:32:20 +08:00
parent 08ddc5a89a
commit 5952b8672c
+1 -1
View File
@@ -7619,7 +7619,7 @@ class MessageMonitor:
_kv_pattern = re.search(r'["\']?\w+["\']?\s*[::]\s*["\']?[^"\']+["\']?', _json_content)
if _kv_pattern:
# ⭐ Task #1595: 检查用户消息特征
_has_user_msg_feature = '@' in text and re.search(r'@\w+', text)
_has_user_msg_feature = '@' in text and bool(re.search(r'@\w+', text))
_has_user_msg_feature |= any(q in text for q in ['?', '?', '吗', '呢', '多少', '怎么', '如何', '哪', '什么', '几'])
if _has_user_msg_feature:
logger.debug(f"[ocr] 过滤器2结果: 检测到JSON但含用户消息特征,继续检查: {text[:80]!r}")