feat: 更新OCR任务识别功能,添加配置开关以控制内容识别

This commit is contained in:
Your Name committed 2026-01-03 12:02:00 +08:00
1 parent 1a69dd87b1
commit cf95efc9a4
3 files changed
+43 -9

No files matched your search

+3 -2
View File
@@ -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
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"updated_ts": 1767411026.6766307,
"updated_ts": 1767412685.263923,
"reason": "startup_clear",
"room_pos": 0,
"current_room_title": "",
+39 -6
View File
@@ -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 = ""