feat(ai): 建立 PixelRAG VLM route readiness
This commit is contained in:
49
scripts/ops/report_pixelrag_vlm_route_readiness.py
Normal file
49
scripts/ops/report_pixelrag_vlm_route_readiness.py
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Report PixelRAG VLM route/model readiness."""
|
||||
|
||||
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_vlm_route_readiness_service import ( # noqa: E402
|
||||
build_pixelrag_vlm_route_readiness,
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="讀回 PixelRAG VLM approved Ollama route / model readiness。"
|
||||
)
|
||||
parser.add_argument("--model", help="要檢查的 configured VLM model。")
|
||||
parser.add_argument(
|
||||
"--timeout",
|
||||
type=int,
|
||||
default=3,
|
||||
help="/api/tags probe timeout 秒數。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--include-models",
|
||||
action="store_true",
|
||||
help="輸出每個 host 的 model list。",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
payload = build_pixelrag_vlm_route_readiness(
|
||||
model=args.model,
|
||||
timeout_seconds=args.timeout,
|
||||
include_models=args.include_models,
|
||||
)
|
||||
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())
|
||||
@@ -76,6 +76,17 @@ def main() -> int:
|
||||
action="store_true",
|
||||
help="execute 後寫入 VLM replay artifact receipt;不寫 DB。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-auto-select-model",
|
||||
action="store_true",
|
||||
help="停用 execute 前的 approved route / installed model 自動選擇。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--route-readiness-timeout",
|
||||
type=int,
|
||||
default=3,
|
||||
help="auto-select model 的 /api/tags readiness timeout 秒數。",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
payload = run_pixelrag_ollama_vlm_replay_worker(
|
||||
@@ -89,6 +100,8 @@ def main() -> int:
|
||||
timeout=args.timeout,
|
||||
execute=args.execute,
|
||||
write_receipt=bool(args.write_receipt and args.execute),
|
||||
auto_select_model=not args.no_auto_select_model,
|
||||
route_readiness_timeout=args.route_readiness_timeout,
|
||||
)
|
||||
print(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0 if payload.get("success") else 1
|
||||
|
||||
Reference in New Issue
Block a user