38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
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
|