Task #1611: 修复过去日期+未来时间戳被误丢弃
问题:OCR识别到过去日期(2026/8/25),但时间戳是今天的(17:45:35, 18:17:27), 被误判为未来时间戳丢弃,导致用户新消息丢失。 根因:过去日期分支调用_is_timestamp_old时未传skip_future_check=True, 导致时间戳比系统时间晚时被拦截。 修复:过去日期分支增加skip_future_check=True参数, 当日期识别错误但时间戳正确时,信任时间戳判断新鲜度。 场景:OCR把今天日期误读成过去日期,但时间戳正确 例:2026/8/28 → 误读成 2026/8/25,但时间戳17:45:35正确
This commit is contained in:
+5
-1
@@ -6434,10 +6434,14 @@ class MessageMonitor:
|
|||||||
# 例:历史内容"2026年8月3日 | 升级服务器..." + 新消息"17:45:35 登录插件在哪儿下载"
|
# 例:历史内容"2026年8月3日 | 升级服务器..." + 新消息"17:45:35 登录插件在哪儿下载"
|
||||||
# 过去日期→丢弃逻辑误伤新消息
|
# 过去日期→丢弃逻辑误伤新消息
|
||||||
# 解决:检查是否有新鲜时间戳,有则放行(新消息特征),无则丢弃(纯历史消息)
|
# 解决:检查是否有新鲜时间戳,有则放行(新消息特征),无则丢弃(纯历史消息)
|
||||||
|
# ⭐ Task #1611 修复:当日期识别为过去日期但时间戳"未来"时,说明日期识别错误
|
||||||
|
# 例:OCR把"2026/8/28"识别成"2026/8/25",但时间戳"17:45:35"其实是今天
|
||||||
|
# 应跳过未来时间戳拦截,信任时间戳判断新鲜度
|
||||||
_has_fresh_ts = False
|
_has_fresh_ts = False
|
||||||
for ts in timestamps:
|
for ts in timestamps:
|
||||||
try:
|
try:
|
||||||
if not self._is_timestamp_old(ts, 300):
|
# 过去日期+未来时间戳组合 → 日期识别错误 → 跳过未来时间戳检查
|
||||||
|
if not self._is_timestamp_old(ts, 300, skip_future_check=True):
|
||||||
_has_fresh_ts = True
|
_has_fresh_ts = True
|
||||||
logger.debug(f"[ocr] 过滤器1结果: 过去日期+新鲜时间戳{ts}(≤300s),放行")
|
logger.debug(f"[ocr] 过滤器1结果: 过去日期+新鲜时间戳{ts}(≤300s),放行")
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user