From 157f3e8106e0bb015aa466ae8ecaec6d7350cdc2 Mon Sep 17 00:00:00 2001 From: ogt Date: Thu, 9 Jul 2026 17:44:28 +0800 Subject: [PATCH] fix(crawler): read pixelrag artifacts from app data --- docs/guides/browse_sh_crawler_playbook.md | 1 + services/pixelrag_crawler_integration_service.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/guides/browse_sh_crawler_playbook.md b/docs/guides/browse_sh_crawler_playbook.md index 20d31ce..ba291ea 100644 --- a/docs/guides/browse_sh_crawler_playbook.md +++ b/docs/guides/browse_sh_crawler_playbook.md @@ -123,6 +123,7 @@ runtime_artifacts/pixelrag_visual_evidence///capture_rece ``` API readback 只讀 receipt 和檔案存在狀態,不重新抓外站、不寫資料庫。 +正式 app 容器內的 readback 預設讀 `/app/data/ai_automation/pixelrag_visual_evidence`;host worker 若直接在 188 執行,預設仍可用 `runtime_artifacts/pixelrag_visual_evidence`,需要給 API 回讀時再同步到容器掛載的 `data/ai_automation`。 安全邊界: diff --git a/services/pixelrag_crawler_integration_service.py b/services/pixelrag_crawler_integration_service.py index 1c445a4..31e3d9e 100644 --- a/services/pixelrag_crawler_integration_service.py +++ b/services/pixelrag_crawler_integration_service.py @@ -29,10 +29,14 @@ RESULT_MANIFEST_REJECTED = "PIXELRAG_VISUAL_EVIDENCE_MANIFEST_REJECTED" ALLOWED_PLATFORMS = ("momo", "pchome", "market_intel", "external_market") DEFAULT_VIEWPORT = {"name": "desktop-1440", "width": 1440, "height": 950} DEFAULT_TILE_SIZE = {"width": 512, "height": 512} -DEFAULT_ARTIFACT_ROOT = os.getenv( - "PIXELRAG_VISUAL_EVIDENCE_ROOT", - "runtime_artifacts/pixelrag_visual_evidence", -) +def _default_artifact_root() -> str: + container_root = Path("/app/data/ai_automation") + if container_root.exists(): + return str(container_root / "pixelrag_visual_evidence") + return "runtime_artifacts/pixelrag_visual_evidence" + + +DEFAULT_ARTIFACT_ROOT = os.getenv("PIXELRAG_VISUAL_EVIDENCE_ROOT", _default_artifact_root()) DEFAULT_ARTIFACT_MAX_AGE_HOURS = int(os.getenv("PIXELRAG_VISUAL_EVIDENCE_MAX_AGE_HOURS", "168")) VISUAL_FALLBACK_CONFIDENCE_TRIGGERS = { "low",