diff --git a/config/config.json b/config/config.json index cbedb6a..66b4ea9 100644 --- a/config/config.json +++ b/config/config.json @@ -216,7 +216,7 @@ "monitor_critical_mb": 200.0 }, "debug_captures": { - "enabled": false, + "enabled": true, "keep_days": 1, "max_files": 1000, "auto_cleanup": true, diff --git a/douyin/utils/douyin_helpers.py b/douyin/utils/douyin_helpers.py index 864dd6c..2c5aa45 100644 --- a/douyin/utils/douyin_helpers.py +++ b/douyin/utils/douyin_helpers.py @@ -128,7 +128,7 @@ class HelperFunctions: getattr(analyser, "fudai_detail_ui_mode", "auto") ) x1, y1, x2, y2 = tuple(profile.get("button") or (181, 1261, 890, 1389)) - # 裁剪区域用于OCR识别(通过cut_pic会自动保存到debug_captures) + # 裁剪区域仅用于 OCR 输入;调试图由全局 debug_captures 或专用综合标注控制。 douyin_screenshot_handler.ScreenshotHandler.cut_pic( analyser, x1, y1, x2, y2, "", "开奖结果按钮", 0 ) diff --git a/gui/components/config_io.py b/gui/components/config_io.py index 9446d8d..30176f7 100644 --- a/gui/components/config_io.py +++ b/gui/components/config_io.py @@ -148,6 +148,9 @@ def load_config_to_ui( vars_["fudai_detail_ui_mode_var"].set( str(cfg.get("fudai_detail_ui_mode", "auto") or "auto") ) + vars_["fudai_detail_save_debug_images_var"].set( + bool(cfg.get("fudai_detail_save_debug_images", False)) + ) for key, default in { "fudai_detail_ocr_content_enabled": True, "fudai_detail_ocr_value_enabled": True, @@ -437,6 +440,9 @@ def save_ui_to_config( ) ui_mode = str(vars_["fudai_detail_ui_mode_var"].get() or "auto").strip().lower() cfg2["fudai_detail_ui_mode"] = ui_mode if ui_mode in ("auto", "legacy", "v2_0") else "auto" + cfg2["fudai_detail_save_debug_images"] = bool( + vars_["fudai_detail_save_debug_images_var"].get() + ) for key in ( "fudai_detail_ocr_content_enabled", "fudai_detail_ocr_value_enabled", diff --git a/gui/components/config_vars.py b/gui/components/config_vars.py index 163644a..4de697c 100644 --- a/gui/components/config_vars.py +++ b/gui/components/config_vars.py @@ -130,6 +130,9 @@ def build_config_vars(cfg: dict) -> Dict[str, tk.Variable]: fudai_detail_ui_mode_var = tk.StringVar( value=str(cfg.get("fudai_detail_ui_mode", "auto") or "auto") ) + fudai_detail_save_debug_images_var = tk.BooleanVar( + value=bool(cfg.get("fudai_detail_save_debug_images", False)) + ) fudai_detail_ocr_content_enabled_var = tk.BooleanVar( value=bool(cfg.get("fudai_detail_ocr_content_enabled", True)) ) @@ -493,6 +496,7 @@ def build_config_vars(cfg: dict) -> Dict[str, tk.Variable]: "fudai_disable_content_recognition_var": fudai_disable_content_recognition_var, "fudai_disable_task_recognition_var": fudai_disable_task_recognition_var, "fudai_detail_ui_mode_var": fudai_detail_ui_mode_var, + "fudai_detail_save_debug_images_var": fudai_detail_save_debug_images_var, "fudai_detail_ocr_content_enabled_var": fudai_detail_ocr_content_enabled_var, "fudai_detail_ocr_value_enabled_var": fudai_detail_ocr_value_enabled_var, "fudai_detail_ocr_countdown_enabled_var": fudai_detail_ocr_countdown_enabled_var, diff --git a/gui/components/debug_tab.py b/gui/components/debug_tab.py index 07378df..907f4a7 100644 --- a/gui/components/debug_tab.py +++ b/gui/components/debug_tab.py @@ -58,7 +58,7 @@ def setup_debug_tab(parent: ttk.Notebook, *, vars_: Dict[str, tk.Variable]) -> t debug_r0.pack(fill=X, padx=10, pady=(10, 8)) ttk.Checkbutton( debug_r0, - text="保存调试图像(OCR / 像素 / 模板等)", + text="全局调试图像(OCR / 像素 / 模板等)", variable=vars_["debug_captures_enabled_var"], ).pack(side=LEFT) ttk.Checkbutton( @@ -237,6 +237,18 @@ def setup_debug_tab(parent: ttk.Notebook, *, vars_: Dict[str, tk.Variable]) -> t side=LEFT, padx=(6, 0) ) + row4debug = ttk.Frame(fudai_find_box) + row4debug.pack(fill=X, padx=10, pady=(0, 8)) + ttk.Checkbutton( + row4debug, + text="保存福袋详情综合标注图(仅一张,不保存逐字段裁剪图)", + variable=vars_["fudai_detail_save_debug_images_var"], + ).pack(side=LEFT) + ttk.Label( + row4debug, + text="(不受全局调试图像开关影响,用于核对2.0坐标)", + ).pack(side=LEFT, padx=(6, 0)) + row4ocr1 = ttk.Frame(fudai_find_box) row4ocr1.pack(fill=X, padx=10, pady=(0, 8)) for label, var_name in ( diff --git a/gui/web_gui_pkg/routes.py b/gui/web_gui_pkg/routes.py index 7ae29f3..51ace79 100644 --- a/gui/web_gui_pkg/routes.py +++ b/gui/web_gui_pkg/routes.py @@ -380,6 +380,7 @@ def handle_post(handler, u, runner, csrf_token: str) -> None: "fudai_quiet_hours_enabled", "high_value_fudai_enabled", "fudai_disable_content_recognition", + "fudai_detail_save_debug_images", "fudai_detail_ocr_content_enabled", "fudai_detail_ocr_value_enabled", "fudai_detail_ocr_countdown_enabled", diff --git a/tools/dev/web_gui_config_manifest.json b/tools/dev/web_gui_config_manifest.json index 7bac645..6b6f4ee 100644 --- a/tools/dev/web_gui_config_manifest.json +++ b/tools/dev/web_gui_config_manifest.json @@ -29,6 +29,7 @@ "fudai_detail_ocr_task_count_enabled", "fudai_detail_ocr_task_enabled", "fudai_detail_ocr_value_enabled", + "fudai_detail_save_debug_images", "fudai_detail_template_threshold", "fudai_detail_ui_mode", "fudai_disable_content_recognition", @@ -185,6 +186,7 @@ "fudai_detail_ocr_task_count_enabled", "fudai_detail_ocr_task_enabled", "fudai_detail_ocr_value_enabled", + "fudai_detail_save_debug_images", "fudai_detail_template_threshold", "fudai_detail_ui_mode", "fudai_disable_content_recognition", @@ -334,6 +336,7 @@ "fudai_detail_ocr_task_count_enabled", "fudai_detail_ocr_task_enabled", "fudai_detail_ocr_value_enabled", + "fudai_detail_save_debug_images", "fudai_detail_template_threshold", "fudai_detail_ui_mode", "fudai_disable_content_recognition", @@ -485,6 +488,7 @@ "fudai_detail_ocr_task_count_enabled", "fudai_detail_ocr_task_enabled", "fudai_detail_ocr_value_enabled", + "fudai_detail_save_debug_images", "fudai_detail_template_threshold", "fudai_detail_ui_mode", "fudai_disable_content_recognition", diff --git a/webui/js/config_panel_templates.js b/webui/js/config_panel_templates.js index 0e2bfac..6921eb5 100644 --- a/webui/js/config_panel_templates.js +++ b/webui/js/config_panel_templates.js @@ -26,12 +26,12 @@