Files
ewoooc/scripts/observability_contract.py
ogt 2888bac597
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
fix: align pchome growth comparison and promo watch
2026-06-26 11:53:14 +08:00

126 lines
3.2 KiB
Python
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.
"""Single source of truth for AI observability QA contracts."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class ObservabilityPage:
template: str
active_page: str
url: str
label: str
short_label: str
markers: tuple[str, ...]
@property
def route_suffix(self) -> str:
return self.url.replace("/observability", "", 1) or "/"
@dataclass(frozen=True)
class AssetCheck:
url: str
label: str
markers: tuple[str, ...]
OBSERVABILITY_PAGES = (
ObservabilityPage(
"templates/admin/observability_overview.html",
"obs_overview",
"/observability/overview",
"觀測台總覽",
"總覽",
("觀測台總覽", "主機健康", "AI 呼叫"),
),
ObservabilityPage(
"templates/admin/agent_orchestration.html",
"obs_agent_orchestration",
"/observability/agent_orchestration",
"AI 分工矩陣",
"分工",
("AI 分工矩陣", "建議路徑", "知識"),
),
ObservabilityPage(
"templates/admin/business_intel.html",
"obs_business_intel",
"/observability/business_intel",
"商業面 × AI",
"商業",
("外部促銷活動監控", "PChome 解法", "競品"),
),
ObservabilityPage(
"templates/admin/host_health.html",
"obs_host_health",
"/observability/host_health",
"主機健康",
"主機",
("主機健康", "AI 建議服務", "自癒"),
),
ObservabilityPage(
"templates/admin/ai_calls_dashboard.html",
"obs_ai_calls",
"/observability/ai_calls",
"AI 呼叫",
"AI 呼叫",
("AI 呼叫", "供應商", "知識命中"),
),
ObservabilityPage(
"templates/admin/budget.html",
"obs_budget",
"/observability/budget",
"預算控管",
"預算",
("預算控管", "預算線", "節流"),
),
ObservabilityPage(
"templates/admin/promotion_review.html",
"obs_promotion_review",
"/observability/promotion_review",
"知識晉升審核",
"晉升",
("知識晉升審核", "晉升", "ai_insights"),
),
ObservabilityPage(
"templates/admin/rag_queries.html",
"obs_rag_queries",
"/observability/rag_queries",
"知識召回詳情",
"知識",
("知識召回雷達", "最近 50", "命中"),
),
ObservabilityPage(
"templates/admin/quality_trend.html",
"obs_quality_trend",
"/observability/quality_trend",
"反饋趨勢",
"品質",
("反饋趨勢", "呼叫端", "蒸餾"),
),
ObservabilityPage(
"templates/admin/ppt_audit_history.html",
"obs_ppt_audit",
"/observability/ppt_audit_history",
"PPT 視覺審核",
"PPT",
("PPT 視覺審核", "修復流程", "審核"),
),
)
CSS_ASSET_CHECKS = (
AssetCheck(
"/static/css/observability-system.css",
"觀測台 CSS",
(
"--obs-title-size",
"--obs-value-size",
".momo-observability-mode",
".obs-chart-frame",
".obs-modal-preview",
),
),
)