Files
ewoooc/scripts/ops/report_pixelrag_rag_candidate_replay.py
ogt 48c978b455
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
feat(ai): 接入 PixelRAG RAG replay smoke
2026-07-09 22:40:51 +08:00

61 lines
1.7 KiB
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Report PixelRAG visual receipts as internal RAG candidate replay payloads."""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from services.pixelrag_rag_candidate_replay_service import ( # noqa: E402
build_pixelrag_rag_candidate_replay_readback,
)
def main() -> int:
parser = argparse.ArgumentParser(
description="輸出 PixelRAG receipt 對內部 RAG candidate replay 的機器可讀讀回。"
)
parser.add_argument(
"--artifact-root",
help="PixelRAG visual evidence artifact root預設使用 production/container 設定。",
)
parser.add_argument(
"--platform",
action="append",
dest="platforms",
help="限制平台,可重複指定,例如 --platform shopee_tw --platform coupang_tw。",
)
parser.add_argument(
"--max-age-hours",
type=int,
default=168,
help="receipt 最大新鮮度小時數。",
)
parser.add_argument(
"--limit",
type=int,
default=50,
help="最多輸出 receipt candidate 數。",
)
args = parser.parse_args()
payload = build_pixelrag_rag_candidate_replay_readback(
artifact_root=args.artifact_root,
platform=tuple(args.platforms or ()),
max_age_hours=args.max_age_hours,
limit=args.limit,
)
print(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True))
return 0 if payload.get("success") else 1
if __name__ == "__main__":
raise SystemExit(main())