This commit is contained in:
@@ -25,7 +25,6 @@ WEB_CSS_PATH = Path("web/static/css/observability-system.css")
|
||||
SHELL_PATH = Path("templates/components/_ewoooc_shell.html")
|
||||
BASE_PATH = Path("templates/ewoooc_base.html")
|
||||
ROUTE_PATH = Path("routes/admin_observability_routes.py")
|
||||
OVERVIEW_PATH = Path("templates/admin/observability_overview.html")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -79,6 +78,7 @@ REQUIRED_CSS_SNIPPETS = [
|
||||
"--obs-title-size",
|
||||
"--obs-value-size",
|
||||
"--obs-matrix-dot",
|
||||
"v3.11 V2 workbench normalization",
|
||||
"v3.10 terminal dot-matrix layer",
|
||||
".momo-observability-mode",
|
||||
".obs-chart-frame",
|
||||
@@ -137,16 +137,55 @@ FORBIDDEN_BASE_PATTERNS = [
|
||||
),
|
||||
]
|
||||
|
||||
FORBIDDEN_OVERVIEW_COPY = [
|
||||
FORBIDDEN_OBSERVABILITY_COPY = [
|
||||
"AI Observability Command Room",
|
||||
"Business Intelligence",
|
||||
"Agent Command Matrix",
|
||||
"AI Traffic Control",
|
||||
"AI Cost Governance",
|
||||
"RAG Recall Radar",
|
||||
"Quality Diagnostics",
|
||||
"PPT Visual QA Pipeline",
|
||||
"RAG Promotion Gate",
|
||||
"Infrastructure Lifeline",
|
||||
"Risk Signals",
|
||||
"AI Calls / 24h",
|
||||
"Host Cascade",
|
||||
"AI Runtime",
|
||||
"Learning Loop",
|
||||
">Command<",
|
||||
">Runtime<",
|
||||
">Quality<",
|
||||
"Total Calls",
|
||||
"Ollama Share",
|
||||
"Paid Cost",
|
||||
"Provider Split",
|
||||
"Caller Orchestration",
|
||||
"Model Economics",
|
||||
"Recent Calls",
|
||||
"Budget Ratio",
|
||||
"Budget Lines",
|
||||
"Provider Mix",
|
||||
"Burn Rate",
|
||||
"Saved Call",
|
||||
"Query Stream",
|
||||
"Caller Quality",
|
||||
"Worst Avg",
|
||||
"RAG Scores",
|
||||
"Caller Feedback",
|
||||
"RAG Feedback",
|
||||
"Learning Pool",
|
||||
"Root Cause",
|
||||
"Action Outcomes",
|
||||
"Audit History",
|
||||
"Generated Files",
|
||||
"30d Audit Mix",
|
||||
"Failure Hotspots",
|
||||
"Awaiting Review",
|
||||
"Review Queue",
|
||||
"Ollama Down",
|
||||
"AIOps Open",
|
||||
"Heal Rate",
|
||||
"Cost Throttle",
|
||||
"MCP Workload",
|
||||
"Operation Ollama-First",
|
||||
"RAG hits",
|
||||
"Cache hits",
|
||||
"30d episodes",
|
||||
@@ -258,18 +297,20 @@ def scan_base_topbar() -> list[str]:
|
||||
return findings
|
||||
|
||||
|
||||
def scan_overview_copy() -> list[str]:
|
||||
path = ROOT / OVERVIEW_PATH
|
||||
if not path.exists():
|
||||
return [f"{OVERVIEW_PATH}: missing required overview page"]
|
||||
|
||||
text = path.read_text(encoding="utf-8")
|
||||
def scan_observability_copy() -> list[str]:
|
||||
findings: list[str] = []
|
||||
for snippet in FORBIDDEN_OVERVIEW_COPY:
|
||||
if snippet in text:
|
||||
findings.append(
|
||||
f"{OVERVIEW_PATH}: legacy English overview copy `{snippet}` must be localized to the V2 workbench language"
|
||||
)
|
||||
for template_path in TEMPLATE_PATHS:
|
||||
path = ROOT / Path(template_path)
|
||||
if not path.exists():
|
||||
findings.append(f"{template_path}: missing required observability page")
|
||||
continue
|
||||
|
||||
text = path.read_text(encoding="utf-8")
|
||||
for snippet in FORBIDDEN_OBSERVABILITY_COPY:
|
||||
if snippet in text:
|
||||
findings.append(
|
||||
f"{template_path}: legacy English observability copy `{snippet}` must be localized to the V2 workbench language"
|
||||
)
|
||||
return findings
|
||||
|
||||
|
||||
@@ -357,7 +398,7 @@ def main() -> int:
|
||||
findings.extend(scan_css())
|
||||
findings.extend(scan_shell())
|
||||
findings.extend(scan_base_topbar())
|
||||
findings.extend(scan_overview_copy())
|
||||
findings.extend(scan_observability_copy())
|
||||
findings.extend(scan_nav_contract())
|
||||
|
||||
if findings:
|
||||
@@ -371,7 +412,7 @@ def main() -> int:
|
||||
print(f"- css guardrails checked: {len(REQUIRED_CSS_SNIPPETS)}")
|
||||
print(f"- sidebar/nav guardrails checked: {len(REQUIRED_SHELL_SNIPPETS)}")
|
||||
print(f"- base/topbar guardrails checked: {len(REQUIRED_BASE_SNIPPETS) + len(FORBIDDEN_BASE_PATTERNS)}")
|
||||
print(f"- overview copy guardrails checked: {len(FORBIDDEN_OVERVIEW_COPY)}")
|
||||
print(f"- observability copy guardrails checked: {len(TEMPLATE_PATHS)} pages × {len(FORBIDDEN_OBSERVABILITY_COPY)} terms")
|
||||
print(f"- nav contract checked: {len(OBSERVABILITY_PAGES)} pages")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ OBSERVABILITY_PAGES = (
|
||||
"/observability/ai_calls",
|
||||
"AI 呼叫",
|
||||
"AI 呼叫",
|
||||
("AI 呼叫", "Provider", "RAG"),
|
||||
("AI 呼叫", "供應商", "RAG"),
|
||||
),
|
||||
ObservabilityPage(
|
||||
"templates/admin/budget.html",
|
||||
@@ -73,7 +73,7 @@ OBSERVABILITY_PAGES = (
|
||||
"/observability/budget",
|
||||
"預算控管",
|
||||
"預算",
|
||||
("預算控管", "force", "throttle"),
|
||||
("預算控管", "預算線", "節流"),
|
||||
),
|
||||
ObservabilityPage(
|
||||
"templates/admin/promotion_review.html",
|
||||
@@ -81,7 +81,7 @@ OBSERVABILITY_PAGES = (
|
||||
"/observability/promotion_review",
|
||||
"RAG 晉升審核",
|
||||
"晉升",
|
||||
("RAG 晉升審核", "Promotion", "ai_insights"),
|
||||
("RAG 晉升審核", "晉升", "ai_insights"),
|
||||
),
|
||||
ObservabilityPage(
|
||||
"templates/admin/rag_queries.html",
|
||||
@@ -89,7 +89,7 @@ OBSERVABILITY_PAGES = (
|
||||
"/observability/rag_queries",
|
||||
"RAG 召回詳情",
|
||||
"RAG",
|
||||
("RAG 召回詳情", "最近 50", "hits"),
|
||||
("RAG 召回詳情", "最近 50", "命中"),
|
||||
),
|
||||
ObservabilityPage(
|
||||
"templates/admin/quality_trend.html",
|
||||
@@ -97,7 +97,7 @@ OBSERVABILITY_PAGES = (
|
||||
"/observability/quality_trend",
|
||||
"反饋趨勢",
|
||||
"品質",
|
||||
("反饋趨勢", "Caller", "蒸餾"),
|
||||
("反饋趨勢", "呼叫端", "蒸餾"),
|
||||
),
|
||||
ObservabilityPage(
|
||||
"templates/admin/ppt_audit_history.html",
|
||||
@@ -105,7 +105,7 @@ OBSERVABILITY_PAGES = (
|
||||
"/observability/ppt_audit_history",
|
||||
"PPT 視覺審核",
|
||||
"PPT",
|
||||
("PPT 視覺審核", "AiderHeal", "audit"),
|
||||
("PPT 視覺審核", "AiderHeal", "審核"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user