fix(ocr): 修复过滤器1中未定义变量stripped导致新鲜时间戳消息被误丢

问题:_ocr_text_has_fresh_timestamp在发现新鲜时间戳后调用record_user_message
时使用了未定义的stripped变量,触发NameError,被except捕获后继续执行
最终返回False,导致消息被丢弃。

修复:在函数开头提前定义stripped = text.strip()
This commit is contained in:
youpaishidifu
2026-08-12 21:38:15 +08:00
parent d286a7cab0
commit 43fcb87238
+2
View File
@@ -4921,6 +4921,8 @@ class MessageMonitor:
if not text:
logger.debug(f"[ocr] 过滤器1结果: 空文本,返回False")
return False
# ⭐ 提前定义 stripped,供后续 record_user_message 使用(修复 NameError)
stripped = text.strip()
# 标准化时间戳:规整 OCR 逐字输出的时间戳(清除字符间空格 + 全角冒号→ASCII)
# 16:28:40 → 16:28:40, 1 6 : 2 8 : 4 0 → 16:28:40(见 _normalize_timestamps,修复孤儿空格导致漏消息)
normalized = self._normalize_timestamps(text)