feat(p55): 3 個圓餅圖補齊 — promotion_review/ppt_audit/budget
All checks were successful
CD Pipeline / deploy (push) Successful in 7m39s
All checks were successful
CD Pipeline / deploy (push) Successful in 7m39s
S-1: promotion_review 蒸餾池 30d doughnut - 取代原 col-md-2 卡片網格 - 8 種狀態各自分色: pending(灰) / awaiting_review(黃) / approved(綠) / rejected_quality(紅) / rejected_hallucination(深紅) / rejected_duplicate(橘) / rejected_human(暗紅) / expired(灰) - 左圓餅 + 右表格雙視角 S-2: ppt_audit 30d 結果 doughnut - 取代部分 col-md-2 卡片佈局 - 通過(綠)/失敗(黃)/錯誤(紅)/跳過(灰) 圓餅 - 6 個 KPI 卡併入右側 col-6 grid(總筆數/通過率/通過/issue/失敗/錯誤) - 統一視覺語言:「圖+表」雙視角 S-3: budget 當月各 provider 成本 doughnut - 新加 query:ai_calls.cost_usd GROUP BY provider 月初至今 - 8 個 provider 分色(本地 Ollama 綠系 vs 付費 LLM 橘紫系) - 左圓餅 + 右表格(供應商/成本/佔比)+ 總計列 chart.js 視覺化從 7 個 → 10 個: - hourly trend line - 30d cost stacked bar - 三主機 sparkline × 3 - RAG feedback doughnut - KPI sparkline × 3 (calls/cost/errors) - verdict doughnut - heal 7d trend - **promotion_review status doughnut(新)** - **ppt_audit pass/fail doughnut(新)** - **provider cost doughnut(新)** Phase 38→55 累計 20 commits / 10 觀測頁 / 10 chart.js / DB 100%。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1575,6 +1575,17 @@ def budget_dashboard():
|
||||
'cost': float(r[2] or 0),
|
||||
})
|
||||
|
||||
# Phase 55 S-3: 當月各 provider cost 分布(給圓餅圖用)
|
||||
provider_cost_month = session.execute(
|
||||
sa_text("""
|
||||
SELECT provider, COALESCE(SUM(cost_usd), 0) AS cost
|
||||
FROM ai_calls
|
||||
WHERE called_at >= :ms AND cost_usd > 0
|
||||
GROUP BY provider ORDER BY cost DESC
|
||||
"""),
|
||||
{'ms': month_start},
|
||||
).fetchall()
|
||||
|
||||
# Phase 47 K-3: top 5 cost-burning caller (當月)
|
||||
top_cost_callers = session.execute(
|
||||
sa_text("""
|
||||
@@ -1643,6 +1654,10 @@ def budget_dashboard():
|
||||
}
|
||||
for r in top_cost_callers
|
||||
],
|
||||
provider_cost_month=[
|
||||
{'provider': r[0], 'cost': float(r[1] or 0)}
|
||||
for r in provider_cost_month
|
||||
],
|
||||
price_rec_7d=[
|
||||
{
|
||||
'strategy': r[0], 'count': int(r[1] or 0),
|
||||
@@ -1656,6 +1671,7 @@ def budget_dashboard():
|
||||
return render_template('admin/budget.html', active_page='obs_budget', rows=[],
|
||||
budget_strategies=[], cost_trend_30d=[],
|
||||
top_cost_callers=[], price_rec_7d=[],
|
||||
provider_cost_month=[],
|
||||
error=f'查詢失敗: {type(e).__name__}: {str(e)[:200]}')
|
||||
finally:
|
||||
session.close()
|
||||
|
||||
Reference in New Issue
Block a user