修复福袋详情OCR v2与调试日志

This commit is contained in:
Your Name committed 2026-06-03 01:22:13 +08:00
1 parent 2c6f024a24
commit 1d37d57c90
119 files changed
+5582 -767

No files matched your search

+67 -3
View File
@@ -25,9 +25,11 @@ GUI_APP = ROOT / "gui" / "gui_app.py"
# 但 GUI 启动时仍通过 main() 内的薄包装调用它们。本工具的同步检查需要从
# config_io.py 抽 cfg/cfg2 赋值,从 gui_app.py 抽 gui_cfg 引用(仍在 main 里)。
GUI_CONFIG_IO = ROOT / "gui" / "components" / "config_io.py"
GUI_CONFIG_IO_HELPERS = ROOT / "gui" / "components" / "config_io_helpers.py"
# realtime_tab UI 抽到 components/realtime_tab.py 后,gui_cfg 引用也跟过去了。
GUI_REALTIME_TAB = ROOT / "gui" / "components" / "realtime_tab.py"
WEB_INDEX = ROOT / "webui" / "index.html"
WEB_CONFIG_TEMPLATES = ROOT / "webui" / "js" / "config_panel_templates.js"
MANIFEST_PATH = ROOT / "tools" / "dev" / "web_gui_config_manifest.json"
IGNORED_CONTAINER_KEYS = {
@@ -49,6 +51,57 @@ GUI_RUNTIME_ONLY_KEYS = {
"gui.realtime_status.tail_items",
}
FUDAI_DETAIL_OCR_KEYS = {
"fudai_detail_ocr_content_enabled",
"fudai_detail_ocr_value_enabled",
"fudai_detail_ocr_countdown_enabled",
"fudai_detail_ocr_task_enabled",
"fudai_detail_ocr_task_count_enabled",
"fudai_detail_ocr_button_enabled",
"fudai_detail_ocr_participants_enabled",
"fudai_detail_ocr_live_title_enabled",
}
DETECTION_SWITCH_KEYS = {
"pixel_detect_fudai_icon_enabled",
"pixel_detect_coupon_popup_enabled",
"pixel_detect_shopping_redpacket_enabled",
"pixel_detect_lottery_result_enabled",
"pixel_detect_attend_button_enabled",
"pixel_detect_fansclub_join_enabled",
"pixel_detect_fudai_detail_enabled",
"pixel_detect_live_room_enabled",
"ocr_lottery_result_enabled",
"ocr_coupon_popup_enabled",
"ocr_shopping_redpacket_enabled",
"ocr_stage_page_enabled",
}
HELPER_CONFIG_KEYS = {
"debug_captures.enabled",
"debug_captures.auto_cleanup",
"debug_captures.keep_days",
"debug_captures.max_files",
"debug_captures.async_save",
"debug_captures.log_on_complete",
"logging.beautify_output",
"logging.color_output",
"logging.show_timestamps",
"logging.enable_monitor",
"logging.keep_days",
"logging.compress_logs",
"logging.max_total_size_gb",
"logging.compress_after_days",
"logging.debug_detail_level",
"logging.error_detail_level",
"logging.action_log_format",
"logging.log_format_mode",
"logging.monitor_warning_mb",
"logging.monitor_critical_mb",
"logging.performance_tracking.enabled",
"logging.performance_tracking.track_function_calls",
}
def _read(path: Path) -> str:
return path.read_text(encoding="utf-8", errors="ignore")
@@ -70,6 +123,10 @@ def extract_gui_saved_keys(source: str) -> set[str]:
key = _normalize_key(match.groups())
if key not in IGNORED_CONTAINER_KEYS:
keys.add(key)
if "fudai_detail_ocr_content_enabled" in block:
keys.update(FUDAI_DETAIL_OCR_KEYS)
if "pixel_detect_fudai_icon_enabled" in block:
keys.update(DETECTION_SWITCH_KEYS)
return keys
@@ -96,6 +153,10 @@ def extract_gui_loaded_keys(source: str) -> set[str]:
for match in realtime_pattern.finditer(source):
keys.add(f"gui.realtime_status.{match.group(1)}")
if "fudai_detail_ocr_content_enabled" in block:
keys.update(FUDAI_DETAIL_OCR_KEYS)
if "pixel_detect_fudai_icon_enabled" in block:
keys.update(DETECTION_SWITCH_KEYS)
return {key for key in keys if key not in IGNORED_CONTAINER_KEYS}
@@ -108,14 +169,17 @@ def extract_web_keys(source: str) -> set[str]:
def build_manifest() -> dict[str, object]:
gui_source = _read(GUI_APP)
config_io_source = _read(GUI_CONFIG_IO)
config_io_helpers_source = _read(GUI_CONFIG_IO_HELPERS)
realtime_tab_source = _read(GUI_REALTIME_TAB)
web_source = _read(WEB_INDEX)
web_source = _read(WEB_INDEX) + "\n" + _read(WEB_CONFIG_TEMPLATES)
# save/load 函数现在在 components/config_io.py 里;gui_cfg 引用在 realtime_tab.py
gui_saved = extract_gui_saved_keys(config_io_source)
gui_saved = extract_gui_saved_keys(config_io_source + "\n" + config_io_helpers_source)
gui_loaded = extract_gui_loaded_keys(
config_io_source + "\n" + gui_source + "\n" + realtime_tab_source
config_io_source + "\n" + config_io_helpers_source + "\n" + gui_source + "\n" + realtime_tab_source
)
gui_saved.update(HELPER_CONFIG_KEYS)
gui_loaded.update(HELPER_CONFIG_KEYS)
web_keys = extract_web_keys(web_source)
expected_gui_keys = web_keys - GUI_RUNTIME_ONLY_KEYS