style(obs): compact ai calls workbench copy
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-02 20:07:36 +08:00
parent f02723b7f4
commit 9dc0393f5e
5 changed files with 53 additions and 4 deletions

View File

@@ -0,0 +1,37 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_ai_calls_uses_compact_workbench_contract():
template = (ROOT / "templates/admin/ai_calls_dashboard.html").read_text(encoding="utf-8")
assert 'data-density-guardrail="compact-ai-calls-workbench"' in template
assert 'aria-label="AI 流量狀態模式"' in template
assert "流量監控" in template
assert "成本守門" in template
assert "知識命中" in template
def test_ai_calls_keeps_core_signals_and_hides_explanatory_copy():
template = (ROOT / "templates/admin/ai_calls_dashboard.html").read_text(encoding="utf-8")
for marker in ["呼叫總量", "用量", "成本", "延遲", "知識命中", "錯誤"]:
assert marker in template
assert ".calls-subtitle, .calls-note, .calls-context-note, .calls-footer-copy { display:none; }" in template
assert 'class="calls-subtitle"' in template
assert 'class="calls-note"' in template
assert "calls-context-note" in template
assert "calls-footer-copy" in template
def test_ai_calls_preserves_workbench_tables_and_non_raw_wording():
template = (ROOT / "templates/admin/ai_calls_dashboard.html").read_text(encoding="utf-8")
for marker in ["情境 × 知識命中矩陣", "最近作戰素材", "最近呼叫 100 筆"]:
assert marker in template
for forbidden in ["權杖量", "權杖/次", ">權杖<", "Agent 上下文", "RAG × MCP"]:
assert forbidden not in template