feat(ai): 接入 PixelRAG RAG replay smoke

This commit is contained in:
ogt
2026-07-09 22:40:51 +08:00
parent cc3c0697a7
commit 1bbf73a176
13 changed files with 886 additions and 18 deletions

View File

@@ -0,0 +1,38 @@
# AI Automation Mainline Work Items
> Updated: 2026-07-09
> Scope: EwoooC / MOMO Pro System AI automation, PixelRAG, MCP/RAG, production UX.
## Source Of Truth
- Production readback stays authoritative after deploy: `/health`, container health, AI automation API readback, and smoke.
- Gitea is the only source-control truth. GitHub remains frozen and must not be used.
- Runtime truth must stay separate from source truth: a green test or registry does not mean MCP/RAG runtime is enabled.
- PixelRAG visual receipts are evidence, not formal price truth. They cannot write `competitor_prices`, `competitor_price_history`, or `ai_insights` without replay and promotion gates.
## P0
| Status | Work item | Evidence / next machine action |
|---|---|---|
| Completed | Multi-commerce PixelRAG visual evidence lane for momo, pchome, shopee_tw, coupang_tw, yahoo_shopping_tw, etmall_tw, friday_tw, rakuten_tw | API and CLI can emit expansion plans and marketplace manifests; PChome parser failures can queue manifests. |
| Completed | External MCP/RAG capability inventory absorbed into internal governance readback | `/api/ai-automation/external-mcp-rag-integration` and `scripts/ops/report_external_mcp_rag_integration.py` expose 9 capabilities, absorbed/unresolved counts, and runtime flags. |
| In progress | PixelRAG receipts to internal RAG candidate replay | `/api/ai-automation/pixelrag-rag-candidate-replay` and `scripts/ops/report_pixelrag_rag_candidate_replay.py` read receipts, split eligible vs blocked, and require OCR/VLM replay plus PromotionGate before knowledge writes. |
| In progress | MCP/RAG runtime health in AI automation smoke | `/api/ai-automation/smoke` and `/api/ai-automation/scheduled-health-summary` include external MCP/RAG integration and PixelRAG RAG candidate replay families. |
| In progress | Formal production deploy/readback discipline | Every mainline change must update version, push Gitea main/dev, deploy to 188 without touching `momo-db`, and read back `/health` plus new endpoints. |
## P1
| Status | Work item | Evidence / next machine action |
|---|---|---|
| Not started | OCR/VLM replay contract for visual fields | Build a no-write replay that extracts title, price, promo badge, seller, rating, delivery badge from saved tiles and emits confidence/evidence only. |
| Not started | Ollama-first multimodal embedding benchmark | Verify local Qwen3-VL or equivalent visual embedding on GCP-A -> GCP-B -> 111 before any visual vector retrieval. |
| Not started | pgvector-compatible visual evidence metadata | Design metadata-first retrieval without FAISS in production unless ADR approves a different store. |
| Not started | Coupang platform probe / structured API strategy | Treat 403 as platform barrier; prefer public structured data or approved probe, never count blocked pages as product data. |
| Not started | Marketplace source contracts beyond MOMO/PChome | Promote stable Shopee/Coupang/Yahoo/ETMall/friday/Rakuten receipts into source contracts only after provenance, rate-limit, public boundary, and replay evidence. |
| In progress | Professional product website UI/UX text reduction | Continue compact AI surfaces, visual QA, and user-facing copy guardrails; avoid engineering logs or work-session prose in the UI. |
## Always Enforced
- Manual review is exception-only for low-risk, machine-verifiable controlled apply.
- Break-glass still applies to secrets, destructive DB actions, force pushes, production provider switchovers, raw runtime volumes, and unverified core model replacement.
- AI automation smoke must expose health honestly: `MCP_ROUTER_ENABLED=false` or `RAG_ENABLED=false` is a runtime gap, not a source-code failure.

View File

@@ -28,6 +28,9 @@
- AI 自動化閉環變更必須確認 `/api/ai-automation/smoke``/ai_automation_smoke` 仍能反映新狀態。
- 外部 MCP / RAG 能力導入內部治理時,必須確認 `/api/ai-automation/external-mcp-rag-integration`
`python scripts/ops/report_external_mcp_rag_integration.py` 可讀回每個能力的內部落點、狀態、資料邊界與下一個機器動作。
- PixelRAG 視覺 receipt 導入內部 RAG 時,必須確認 `/api/ai-automation/pixelrag-rag-candidate-replay`
`python scripts/ops/report_pixelrag_rag_candidate_replay.py` 可讀回 eligible / blocked / invalid receipts且 blocked page 不得被視為商品資料。
- AI automation smoke 必須包含 external MCP/RAG integration 與 PixelRAG RAG candidate replay family避免 registry 已完成但 runtime flag / receipt replay 未完成時被誤報為全自動閉環。
- AI 自動化 Prometheus 指標變更必須同步檢查 `docker/grafana/provisioning/dashboards/json/ai-automation-overview.json` 是否需要新增 panel 或查詢。
- 188 線上 active monitoring stack 以 `monitoring/prometheus.yml` 為準110 gateway 另有 `/home/wooo/monitoring/prometheus.yml`。若 dashboard 無資料,先確認 Prometheus `momo-app` target 與 `momo-network` 連線;所有 Blackbox HTTP target 必須打 `/health`,不可打 Dashboard 首頁 `/`
- Smoke dashboard 會保存 JSONL 趨勢;若新增檢查項目,要確保 history compact record 仍保持小而可讀。

View File

@@ -122,6 +122,7 @@ python scripts/ops/report_pixelrag_crawler_integration.py \
/api/ai-automation/pixelrag-crawler-integration?platform=coupang_tw&marketplace_keyword=iphone
/api/ai-automation/pixelrag-crawler-integration?platform=pchome&manifest_url=https://24h.pchome.com.tw/prod/TEST-000000001&crawler=PChomeCrawler.search_products&trigger_reason=parser_empty
/api/ai-automation/pixelrag-visual-evidence-readback?platform=pchome&manifest_id=4a93e95e5afb414bc8c3
/api/ai-automation/pixelrag-rag-candidate-replay?platform=shopee_tw&platform=coupang_tw
```
視覺證據 capture worker
@@ -161,6 +162,15 @@ runtime_artifacts/pixelrag_visual_evidence/<platform>/<manifest_id>/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`
RAG candidate replay
```bash
python scripts/ops/report_pixelrag_rag_candidate_replay.py
python scripts/ops/report_pixelrag_rag_candidate_replay.py --platform shopee_tw --platform coupang_tw
```
此 replay 只把 receipt 轉成內部 RAG candidate previeweligible receipt 仍需 OCR/VLM replay、identity matcher replay、PromotionGate 與 embedding signature guardblocked / 403 / captcha / access denied receipt 只能進 platform probe 或 structured API 策略,不得當成商品資料。
安全邊界:
- read-only不登入、不下單、不加入購物車、不寫第三方狀態。