{% extends "ewoooc_base.html" %} {% block title %}AI 流量控制塔{% endblock %} {% block ewooo_content %} {% import "admin/_observability_labels.html" as obs_label %} {% set total = summary.total_calls or 0 %} {% set errors = summary.error_calls or 0 %} {% set error_rate = (errors / total * 100) if total > 0 else 0 %} {% set rag_rate = ((summary.rag_hits or 0) / total * 100) if total > 0 else 0 %} {% set avg_tokens = ((summary.total_tokens or 0) // (total or 1)) %}
AI 流量管制 · {{ hours }} 小時視窗

AI 流量控制塔

看成本、錯誤率與知識命中,確保 AI 建議穩定支援業績判斷。

{% if error %}
{{ error }}
{% endif %}
呼叫總量
{{ "{:,}".format(total) }}{% if hourly_trend %}{% endif %}
用量
{{ "{:,}".format(summary.total_tokens or 0) }}
{{ avg_tokens }} 單位/次
成本
${{ "%.2f"|format(summary.total_cost or 0) }}{% if hourly_trend %}{% endif %}
延遲
{{ summary.avg_duration or 0 }}ms
{{ summary.cache_hits or 0 }} 次快取命中
知識命中
{{ "%.1f"|format(rag_rate) }}%
{{ summary.rag_hits or 0 }} 次命中
錯誤
{{ errors }}{% if hourly_trend %}{% endif %}
{% if hourly_trend %}
每小時流量

每小時呼叫趨勢

{% endif %}
使用情境

情境 × 知識命中矩陣

{% for c in caller_richness %}{% else %}{% endfor %}
使用情境總次數知識命中工具協作品質回饋筆數
{{ obs_label.caller(c.caller) }}{{ "{:,}".format(c.total_calls) }}{{ "%.1f"|format(c.rag_hit_rate) }}% ({{ c.rag_hits }}){{ "%.1f"|format(c.mcp_rate) }}%{% if c.feedback_count > 0 %}{{ "%.2f"|format(c.avg_rag_feedback) }}/5{% else %}{% endif %}{{ c.feedback_count }}
近期尚無足夠情境資料,先看上方錯誤、成本與知識命中。
{% if by_model %}
路徑成本

依建議路徑細分

{% for m in by_model %}{% endfor %}
建議路徑呼叫用量成本耗時錯誤
{{ obs_label.provider(m.provider) }}{{ "{:,}".format(m.calls) }}{{ "{:,}".format(m.tokens) }}${{ "%.4f"|format(m.cost) }}{{ m.avg_ms }} ms{% if m.errors > 0 %}{{ m.errors }}{% else %}0{% endif %}
{% endif %}
最近呼叫

最近呼叫 100 筆

{% for r in recent %}{% endfor %}
編號時間使用情境建議路徑輸入輸出耗時狀態成本標記
{{ r.id }}{{ r.called_at }}{{ r.caller_display or '營運建議流程' }}{{ obs_label.provider(r.provider) }}{{ r.in_tokens }}{{ r.out_tokens }}{{ r.duration_ms }}{{ obs_label.status(r.status, '-') }}${{ "%.4f"|format(r.cost) }}{% for badge in r.route_badges %}{{ badge }}{% endfor %}{% if r.cache_hit %}快取{% endif %}{% if r.rag_hit %}知識命中{% endif %}

AI 流量控制塔

{% set ai_calls_payload = { 'labels': hourly_trend | map(attribute='hour') | list, 'calls': hourly_trend | map(attribute='calls') | list, 'costs': hourly_trend | map(attribute='cost') | list, 'errors': hourly_trend | map(attribute='errors') | list } %} {% endblock %}