{% extends "ewoooc_base.html" %} {% block title %}AI 成本治理艙{% endblock %} {% block ewooo_content %} {% set total_budget = namespace(value=0) %}{% set total_spent = namespace(value=0) %}{% set warn_count = namespace(value=0) %}{% set throttled_count = namespace(value=0) %} {% for r in rows %}{% set total_budget.value = total_budget.value + (r.budget_usd or 0) %}{% set total_spent.value = total_spent.value + (r.spent or 0) %}{% if r.ratio >= 0.8 %}{% set warn_count.value = warn_count.value + 1 %}{% endif %}{% if r.throttled %}{% set throttled_count.value = throttled_count.value + 1 %}{% endif %}{% endfor %} {% set total_ratio = (total_spent.value / total_budget.value * 100) if total_budget.value > 0 else 0 %}
AI Cost Governance · Budget / Throttle / RAG Strategy

AI 成本治理艙

這頁回答一個問題:AI 中樞花錢是否仍在治理邊界內?預算、實際支出、月底推估、節流狀態與 RAG 策略建議集中在同一個 cockpit。

超過 110% 時不用等 cron,直接 evaluate provider throttle。
Month Spend
${{ "%.2f"|format(total_spent.value) }}
預算 ${{ "%.2f"|format(total_budget.value) }}
Budget Ratio
{{ "%.0f"|format(total_ratio) }}%
全 provider 加總
Warnings
{{ warn_count.value }}
使用率 ≥ 80%
Throttled
{{ throttled_count.value }}
已啟動成本節流
{% if error %}
{{ error }}
{% endif %}
Budget Lines

預算線與節流狀態

{% for r in rows %}= 0.8 %}class="table-warning"{% endif %}>{% else %}{% endfor %}
週期供應商已花費預算閾值使用率狀態動作
{{ r.period }}{{ r.provider }}${{ "%.2f"|format(r.spent) }}{{ "%.0f"|format(r.ratio * 100) }}%{% if r.throttled %}已節流{% elif r.ratio >= 0.8 %}接近上限{% else %}正常{% endif %}
無預算資料(需先跑 migrations/025)
{% if cost_trend_30d %}
30d Cost Trend

每日成本堆疊趨勢

{% endif %}
{% if budget_strategies %}
RAG Strategy

RAG 自動策略建議

{% for s in budget_strategies %}
{{ s.insight_type }}相似度 {{ "%.2f"|format(s.similarity) }}{{ s.content }}{% if s.content|length >= 240 %}…{% endif %}
{% endfor %}
{% endif %} {% if price_rec_7d %}
Business Output

AI 價格決策 7 日

{% for p in price_rec_7d %}
{{ p.strategy }}{{ p.count }}信心 {{ "%.2f"|format(p.avg_confidence) }}
{% endfor %}
{% endif %}

Operation Ollama-First v5.0 — AI 成本治理艙

{% endblock %}