{% 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 中樞的飛航管制台:看呼叫量、權杖量、成本、錯誤率、RAG 命中與 MCP 編排,並在異常時一鍵派出程式碼審查管線。

{% 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 }} 次快取命中
RAG 命中
{{ "%.1f"|format(rag_rate) }}%
{{ summary.rag_hits or 0 }} 次命中
錯誤
{{ errors }}{% if hourly_trend %}{% endif %}
{% if hourly_trend %}
每小時流量

每小時呼叫趨勢

{% endif %} {% if caller_richness %}
呼叫端編排

呼叫端 × RAG × MCP 編排矩陣

{% for c in caller_richness %}{% endfor %}
呼叫端總呼叫RAG 命中MCP 編排RAG 反饋筆數
{{ 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 }}
{% endif %}
{% if by_model %}
模型成本

依模型細分

{% for m in by_model %}{% endfor %}
模型供應商呼叫權杖成本耗時錯誤
{{ m.model[:35] }}{{ 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 r.caller }}{% if r.caller_display and r.caller_display != r.caller %}
原始:{{ r.caller }}{% endif %}
{{ obs_label.provider(r.provider) }}{{ r.model[:25] }}{{ 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 %}RAG{% endif %}

Ollama 優先策略 v5.0 — 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 %}