Files
awoooi/apps/api
Your Name f6cb938dc3
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
feat(compliance_scanner): Gap 3.2 LLM 升級 — 合規態勢分析 + Telegram 摘要
朝 AI 自主化方向 — 9 新 scanner 從 2/9 LLM 提升到 3/9.

compliance_scanner 原本每次 scan 273 snapshots 寫 DB,無任何人可見摘要.
新增:

1. _write_compliance_for_asset_v2 (wrapper):
   原 _write_compliance_for_asset 保持不變,v2 版加回傳 asset_warning dict
   供上層 LLM 分析用,只有 violations/warnings > 0 才傳回

2. _llm_analyze_compliance_posture (~50 行):
   有 warning 時用 OpenClaw 分析整體 posture
   輸出 JSON:
     - posture_grade: A/B/C/D/F
     - posture_summary: 3 句繁中整體態勢敘述
     - top_priorities[3]: priority + action + rationale
     - risk_level: low/medium/high/critical
     - confidence: 0-1
   3-path JSON parse fallback (直接 / NemoTron wrapper / description 巢狀)

3. _send_telegram_posture (~40 行):
   推每日合規摘要到 SRE group
   含評級 emoji (🟢A / 🟡B / 🟠C / 🔴D / F)
   顯示 asset_type 分布 (Top 5 種問題類型統計)
   含 AI top 3 priority 動作 + rationale

scan_once 流程:
  掃 assets × 7 維 → 收集 warning_assets → LLM 分析 → Telegram 推送

統帥鐵律對齊:
   AI 分析 + 人工決策 (Telegram 末行: '人工評估各項修復優先')
   不寫死優先順序 (LLM 根據 warnings 實際分布推)
   asset_type 分布統計幫統帥快速定位

Gap 3 進度: 3/8 service 升級 LLM (Hermes + capacity_forecaster + compliance_scanner)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 21:59:38 +08:00
..