From cf95efc9a4e55ccf8aafe700326159e40a1b0607 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 3 Jan 2026 12:02:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0OCR=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=BC=80=E5=85=B3=E4=BB=A5=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.json | 5 ++-- douyin/core/state/reservations.json | 2 +- douyin/fudai/douyin_fudai_core.py | 45 +++++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/config/config.json b/config/config.json index e56c108..aba2887 100644 --- a/config/config.json +++ b/config/config.json @@ -130,7 +130,7 @@ "debug_captures": { "enabled": false, "keep_days": 3, - "max_files": 1900, + "max_files": 2000, "auto_cleanup": true, "async_save": false, "log_on_complete": false @@ -149,5 +149,6 @@ "fansclub_auto_join_wait_seconds": 5.0, "fansclub_manual_wait_seconds": 3.0, "enable_streaming_screenshot": false, - "fudai_exit_after_misses": 30 + "fudai_exit_after_misses": 30, + "fudai_disable_task_recognition": true } diff --git a/douyin/core/state/reservations.json b/douyin/core/state/reservations.json index 5b06447..e4c69d7 100644 --- a/douyin/core/state/reservations.json +++ b/douyin/core/state/reservations.json @@ -1,5 +1,5 @@ { - "updated_ts": 1767411026.6766307, + "updated_ts": 1767412685.263923, "reason": "startup_clear", "room_pos": 0, "current_room_title": "", diff --git a/douyin/fudai/douyin_fudai_core.py b/douyin/fudai/douyin_fudai_core.py index 3a1d1a2..0fc98c7 100644 --- a/douyin/fudai/douyin_fudai_core.py +++ b/douyin/fudai/douyin_fudai_core.py @@ -388,18 +388,51 @@ def get_fudai_contain(analyser, renwu: int = 2) -> Tuple[str, str, int, int, flo else: try: name_tl = _safe_preprocess("福袋任务列表") - results["task_list"] = analyser.operation.analyse_pic_word(name_tl, 1) + results["task_list"] = analyser.operation.analyse_pic_word( + name_tl, 1 + ) except Exception: pass - - # 内容:使用更重的文本模型兜底 - if "content" in fields: + # 内容OCR开关(运行时读取 analyser 属性或 config.json) + try: + disable_content_recognition = bool( + getattr(analyser, "fudai_disable_content_recognition", False) + ) + except Exception: + disable_content_recognition = False + if not disable_content_recognition: try: - name_fc = _safe_preprocess("福袋内容") - results["content"] = analyser.operation.analyse_pic_word(name_fc, 1) + import json + + cfg_path = path_config.get_config_path() + if cfg_path and os.path.exists(cfg_path): + with open(cfg_path, "r", encoding="utf-8") as f: + cfg = json.load(f) + disable_content_recognition = bool( + cfg.get("fudai_disable_content_recognition", False) + ) except Exception: pass + # 内容:使用更重的文本模型兜底(尊重配置开关) + if "content" in fields: + if disable_content_recognition: + try: + analyser._log_kv( + "福袋", + "跳过福袋内容OCR识别(配置启用)", + ) + except Exception: + pass + else: + try: + name_fc = _safe_preprocess("福袋内容") + results["content"] = analyser.operation.analyse_pic_word( + name_fc, 1 + ) + except Exception: + pass + # 倒计时:先数字模型,失败再文本提取数字 if "countdown_mm" in fields: mm_digits = ""