Commit Graph

29 Commits

Author SHA1 Message Date
OoO
b5511e818f 優化 PPT 產線工作隊列
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s
2026-05-18 19:13:50 +08:00
OoO
ebbf7bc063 優化 PPT 產線健康總覽
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
2026-05-18 19:00:18 +08:00
OoO
1262017261 優化 PPT 最近預覽入口
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-18 16:07:55 +08:00
OoO
217aa4fd6d 微調 PPT 產線狀態文案
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-05-18 15:57:13 +08:00
OoO
d2d8dbab65 強化 PPT 產線與線上預覽
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-18 15:44:11 +08:00
OoO
cb02cd350f feat: schedule full ppt auto generation cadence
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-18 14:22:09 +08:00
OoO
c420d48263 Fix PPT auto generation and analytics fallbacks
Some checks failed
CD Pipeline / deploy (push) Failing after 26s
2026-05-18 11:52:31 +08:00
OoO
f2aece5b71 perf: 外部化觀測台圖表腳本
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
2026-05-18 09:30:34 +08:00
OoO
ff49d31f73 fix: 強化 AI 觀測台新版視覺規範
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
2026-05-17 22:50:18 +08:00
OoO
626a2ed50a fix: guard ppt audit file integrity and disable preview on corrupted files 2026-05-15 14:17:33 +08:00
OoO
0b415d965b feat: 补齐 ppt_history 的 DB-backed 檔案回填並保留開啟/下載
All checks were successful
CD Pipeline / deploy (push) Successful in 59s
2026-05-15 14:14:07 +08:00
OoO
40d4d01007 feat: add ppt file view/download actions in observability audit page
All checks were successful
CD Pipeline / deploy (push) Successful in 58s
2026-05-15 14:11:04 +08:00
OoO
34b1fdf829 fix: align ppt audit history UI and reporting flow
All checks were successful
CD Pipeline / deploy (push) Successful in 59s
2026-05-15 14:08:15 +08:00
OoO
8a7eed3505 整理觀測台顯示字典
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
2026-05-13 19:59:30 +08:00
OoO
250dd58172 統一觀測台新版工作台規範
All checks were successful
CD Pipeline / deploy (push) Successful in 59s
2026-05-13 19:39:33 +08:00
OoO
b21b40cae2 fix(observability): soften frontend error copy
All checks were successful
CD Pipeline / deploy (push) Successful in 1m2s
2026-05-05 21:58:49 +08:00
OoO
ccd26415f3 fix(observability): 導入標題尺度 token 與 modal 樣式
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-05 14:54:17 +08:00
OoO
668d98cd3c fix(observability): 清理硬編碼樣式與圖表容器
Some checks failed
CD Pipeline / deploy (push) Failing after 9m49s
2026-05-05 14:41:00 +08:00
OoO
4afcf3376b fix(observability): 統一標題字型並卡片化商業建議
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-05 14:09:41 +08:00
OoO
054685826a feat(observability): 重塑 AI 觀測台戰情室 UI
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-05 13:17:42 +08:00
OoO
df2311d4f0 feat(p55): 3 個圓餅圖補齊 — promotion_review/ppt_audit/budget
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>
2026-05-05 01:15:58 +08:00
OoO
2e124db602 feat(p47): 6 頁深挖資料庫 — 從 5 表 → 17 表,每頁加 3-5 個 widget
All checks were successful
CD Pipeline / deploy (push) Successful in 2m36s
統帥質疑:「6 頁內容太空洞,要更貼近資料庫裡所有數據」
盤點:DB 有 22 表,6 頁原本只用 5 表(22.7% 利用率)。
本 commit 新接 12 張既有但未用的表。

K-1 host_health(接 +5 表 → 8 表)
- 加 incidents 最近 10 筆詳細(task_name/error_type/嚴重度/狀態/重試/錯誤訊息)
- 加 heal_logs 最近 10 筆(action_type/result/耗時/incident 關聯)
- 加 playbooks 庫排行 TOP 12(success_count/fail_count/成功率/啟用狀態)
- 加 backup_log 7 日歷史(type/status/size/duration/error)
- 加 embedding_retry_queue pending/failed 警示

K-2 ai_calls(接 +3 表)
- 加 24h 每小時呼叫趨勢 bucket(含成本+錯誤+流量分布條)
- 加 by model 細分(不只 provider,到 model 版本級別)TOP 15
- 加 agent_context 最近 10 筆(OpenClaw/Hermes 對話 session preview)

K-3 budget(接 +3 表)
- 加當月 Top 5 燒錢呼叫端(caller × cost ranking)
- 加過去 30 日每日成本 by provider 趨勢表
- 加 ai_price_recommendations 7 日統計(strategy 分布 + 平均信心度)

K-4 promotion_review(接 +2 表)
- 加蒸餾池 30 日 status 分布(不只 awaiting,看 8 種完整流動)
- 加 ai_insights 最近 10 筆已晉升內容預覽
- 加 agent_strategy_weights TOP 12(OpenClaw 學習權重 + 成功率)

K-5 quality_trend(接 +3 表)
- 加 RAG 整體 feedback 1-5 分分布(過去 N 日,星等視覺)
- 加 action_plans status 分布(pending/approved/executed/rejected)
- 加 action_outcomes verdict 分布(effective/neutral/backfired
  — ADR-012 閉環學習核心 KPI)

K-6 ppt_audit_history(接 +0 表,但 deeper SQL)
- 加 30 日統計卡(total/passed/failed/error/通過率/總 issue 數/平均信心度)
- 加 Top 10 反覆失敗檔案(30d 失敗次數 + total issues)
- 加 empty state 說明(PPT_VISION_ENABLED=false 時顯示啟用步驟)

DB 利用率對應:
- Phase 38 起點:5 表(22.7%)
- Phase 39-46 累計:12 表(54.5%)
- Phase 47 收官:17 表(77.3%)
  新接:playbooks / backup_log / embedding_retry_queue / agent_context /
        ai_price_recommendations / agent_strategy_weights / action_plans /
        action_outcomes(之前已接:incidents/heal_logs/ai_insights/learning_episodes/
        rag_query_log/mcp_calls/ai_calls/host_health_probes/ppt_audit_results)

每頁 widget 數對應:
- host_health: 5 卡 → 11 卡
- ai_calls: 5 卡 → 8 卡
- budget: 4 卡 → 7 卡
- promotion_review: 2 卡 → 5 卡
- quality_trend: 4 卡 → 7 卡
- ppt_audit: 3 卡 → 6 卡

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 19:49:52 +08:00
OoO
849e189b60 feat(p45): UI/UX 升級 ewoooc_base.html + sidebar AI 觀測 7 項 + 新增總覽頁
All checks were successful
CD Pipeline / deploy (push) Successful in 2m37s
統帥質疑:「那六頁的視覺方格 UI/UX 搞好了嗎?還有新增頁面嗎?」
回答:沒有,從 Phase 38 開始一直推遲。本 commit 補做。

I-1: 6 頁 base.html → ewoooc_base.html
- host_health / ai_calls_dashboard / budget / promotion_review /
  quality_trend / ppt_audit_history 全改
- {% extends "base.html" %} → {% extends "ewoooc_base.html" %}
- {% block content %} → {% block ewooo_content %}
- 自動繼承:sidebar 240px / topbar 64px / fonts (Inter+JetBrains+Noto Sans TC)
  / ewoooc-tokens.css / ewoooc-shell.css / search box / 米色背景

I-2: _ewoooc_shell.html 加「AI 觀測」nav group
- 7 個項目:觀測台總覽 / 主機健康 / AI 呼叫 / 預算控管 /
  RAG 晉升審核 / 反饋趨勢 / PPT 視覺審核
- 對應 active_page='obs_*',正確高亮
- 編號 07-13(系統管理改 14)

I-3: 新增頁面 /observability/ + /observability/overview
- routes/admin_observability_routes.py::observability_overview
- 單頁聚合 8 表跨 JOIN 的 KPI:
  • 三主機 24h 在線率(host_health_probes,per host card)
  • AI 呼叫 24h(ai_calls:total/tokens/cost/error rate/RAG hit/cache hit)
  • 當月成本累計
  • 預算告警(ratio ≥ alert_pct 自動列表)
  • AIOps 7d(incidents + heal_logs:自癒成功率)
  • MCP 24h(mcp_calls:tool 呼叫 + cache 率 + cost)
  • RAG 學習 30d(learning_episodes:待審 + 晉升率)
  • PPT 視覺審核 7d(ppt_audit_results:通過率)
  • 6 大子頁入口卡(含一行說明)
- 對應 Phase 44 daily Telegram summary 的 web 版本
- 全部失敗安全(個別 query 失敗只跳過該卡,不擋整頁)

升級對應:
- UI 框架:base.html → ewoooc_base.html (sidebar + topbar + token css 已生效)
- 設計憲法:8 卡片 + 8 表跨 JOIN 全景 + 一頁式總覽
- 入口:sidebar 7 項 + 觀測台首頁
- 資料表覆蓋:4 表(Phase 38)→ 8 表(Phase 45)

注意:完整 design token 重塑(Bootstrap class → --momo-* token / 焦糖橘)
留待後續 phase;本 commit 重點是「框架升級 + 新總覽頁」。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 19:34:18 +08:00
OoO
4020b734a5 feat(p41): 觀測台戰役完整收官 — K8s 三主機化 + ppt RAG + TG inline action
All checks were successful
CD Pipeline / deploy (push) Successful in 2m34s
E-1: K8s configmap 對齊三主機級聯(清舊配置遺留)
- k8s/02-configmap.yaml:
  - 移除寫死的 OLLAMA_HOST=192.168.0.188:11434(早已過時)
  - 改注入 OLLAMA_HOST_PRIMARY/SECONDARY/FALLBACK 三個變數
  - llama3:70b → qwen3:8b(與目前 prod 一致)
- k8s/gcp/02-configmap.yaml:
  - 移除「OLLAMA_HOST=空 + AI_PROVIDER=gemini」自相矛盾
  - 改三主機級聯 + AI_PROVIDER=ollama(與 docker-compose.yml 一致)

E-2: ppt_audit 加 RAG「相似失敗修法」
- 對最近 3 筆 audit_status='failed'/'error' 跑 rag_service.query
- 從 ai_insights 召回相似案例(cosine ≥ 0.6, top 2)
- template 加「RAG 自動修法建議」card

E-3: Telegram obs_health/obs_budget 加 inline action button (L2)
- cmd:obs_health:任一主機標記異常時,inline 顯示「🩹 修 GCP-A/GCP-B/111」按鈕
- cmd:obs_heal:{label}:新 handler,在 Telegram 內直接觸發 AutoHeal
  (白名單 GCP-A/GCP-B/111,非 unhealthy 拒絕)
- cmd:obs_budget:warn 時 inline 顯示「 立即重算節流狀態」按鈕
- cmd:obs_force_throttle:新 handler,Telegram 內直接觸發 evaluate_throttle_status

最終升級對應:
- RAG 整合 4/6 → 5/6(補 ppt_audit)
- AI 自動化:Web L2×4 + Telegram L2×2 = 6 個一鍵自動化入口
- K8s 配置一致性:三套 (docker-compose / k8s/* / k8s/gcp/*) 統一
  指向 GCP-A → GCP-B → 111 三主機鏈

Phase 38+39+40+41 累計 7 commits 觀測台戰役完整收官。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 19:18:23 +08:00
OoO
65f236da2d feat(p40): 觀測台收官 — 4 頁升 L2 + RAG 根因 + 蒸餾池監控
All checks were successful
CD Pipeline / deploy (push) Successful in 2m36s
接續 Phase 39 (commit 79cf08c),本 commit 完成 Phase D 最後 4 項:

D-6: quality_trend 蒸餾池 + RAG 根因
- 新「蒸餾池狀態」card:learning_episodes 各 promotion_status 分布
  (pending / awaiting_review / approved / rejected_quality /
   rejected_hallucination / rejected_duplicate / rejected_human / expired)
- 對最差 3 名 caller (avg_score < 3 且反饋 ≥ 3) 自動 RAG 根因建議
- RAG 從 ai_insights 召回相似低品質案例

D-7: ai_calls 一鍵 Code Review (L2)
- 新 POST /observability/ai_calls/trigger_code_review
  讀 git rev-parse HEAD + diff-tree 取最新變更檔案
  在 daemon thread 跑 CodeReviewPipeline.run() (5 step Hermes→
  OpenClaw→EA→NemoTron)
- 頁面新增「觸發 Code Review Pipeline」按鈕

D-8: ppt_audit 失敗 row 一鍵 AiderHeal (L2)
- 新 POST /observability/ppt_audit/trigger_aider_heal
  接收 pptx_filename + error_msg,呼叫 services/aider_heal_executor::
  execute_code_fix 自動修 services/ppt_generator.py
  AiderHeal 修完會 git push 觸發 CD
- audit_records 表中 status='failed'/'error' 的 row 自動顯示按鈕

D-9: host_health 一鍵 AutoHeal (L2)
- 新 POST /observability/host_health/trigger_autoheal
  接收 host_label,白名單對應 OLLAMA_HOST_PRIMARY/SECONDARY/FALLBACK
  防 SSRF。已標記 unhealthy 的 host 才允許觸發
  呼叫 auto_heal_service.handle_exception(error_type='ollama_unhealthy')
  跑 ADR-013 playbook(DOCKER_RESTART / SSH_CMD / ALERT_ONLY)
- 三主機 row 中 unhealthy / down 的 host 自動顯示按鈕

升級對應:
- AI 自動化:L2 從 1 個 → 4 個(budget force_throttle / Code Review /
  AiderHeal / AutoHeal)
- DB 利用率 ~60%:新增 learning_episodes 分布查詢
- RAG 整合 4/6(promotion_review + budget + quality_trend + 待 ppt_audit)

Phase 38+39+40 累計:6 commits 完成觀測台從 raw dashboard
升級到 AI 自動化專業舞台。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 19:13:39 +08:00
OoO
0b13055466 feat(p38): host_health + ppt_audit DB 持久化(B-1 + B-2)
統帥要求:
1. 所有 6 個觀測頁的功能和數據都要完整寫入資料庫儲存
2. Ollama 切 GCP 順序 GCP-A → GCP-B → 111

盤點結果:
- 4/6 頁面已有 DB 表(ai_calls / learning_episodes / rag_query_log / ai_call_budgets)
- 2/6 頁面是即時查詢無歷史:host_health(HTTP probe)、ppt_audit(os.listdir)
- Ollama 99% 已合規,僅 1 處過時註解

修補(B-1):
- services/code_review_pipeline_service.py:207 註解更新
  「直呼內網 Ollama (192.168.0.188)」→ 「走 resolve_ollama_host 三主機級聯 ADR-027」

新增(B-2):
- migrations/029_create_host_health_probes.sql
  - 三主機健康歷史表(label/url/healthy/response_ms/error_msg)
  - 索引:probed_at / (host_label, probed_at)
  - 30 天保留(cron 清理)
- migrations/030_create_ppt_audit_results.sql
  - PPT 視覺審核結果表(status/issues_count/issues_found JSONB/confidence)
  - 索引:audited_at / pptx_filename / failed-only partial
- routes/admin_observability_routes.py:host_health_dashboard
  - 每次 probe 寫入 host_health_probes(失敗安全)
  - 新增 24h 健康趨勢卡片(uptime % / 平均 ms)
- routes/admin_observability_routes.py:ppt_audit_history
  - 從 ppt_audit_results 讀過去 7 日 audit 紀錄
  - 顯示審核時間/檔名/結果/問題數/信心度/耗時
- services/ppt_vision_service.py:check_ppt_file
  - 新增 _persist_audit_result() 跑完寫入 DB(status/issues/confidence/duration)
  - 失敗安全:DB 寫入失敗只 log warning,不擋主流程
- templates/admin/host_health.html + ppt_audit_history.html
  - 新增「24h 健康趨勢」card(host_health)
  - 新增「視覺審核歷史紀錄」card(ppt_audit)

DoD:
- 程式碼語法 ✓
- Jinja 平衡 ✓
- 失敗安全(DB 寫入或讀取失敗都不擋頁面渲染)✓

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 18:55:39 +08:00
OoO
19f1340f5c feat(p38): admin 觀測台 6 頁完整繁中化 + 加入導航選單
All checks were successful
CD Pipeline / deploy (push) Successful in 2m42s
問題:
1. 6 個 /observability/* 頁面標題與欄位英文殘留(違反設計憲法繁中要求)
2. 6 頁完全沒掛 navbar,使用者進不去(只能彼此 footer link 互連)
3. emoji 取代 Font Awesome,違反設計規範

修補:
- _navbar.html 新增「AI 觀測台」dropdown(位於 AI 助手 與 雲端匯入 之間)
  - AI 監控組:AI 呼叫總覽 / 主機健康監控 / 預算控管
  - AI 學習組:RAG 學習晉升審核 / Caller 反饋趨勢 / PPT 視覺審核歷史
- 6 個 admin/observability template 全面繁中化:
  - 標題、表格欄位、按鈕、badge 文字、JS alert 文案
  - emoji → Font Awesome icon(fa-heartbeat / fa-chart-bar / fa-wallet / fa-brain / fa-comments / fa-search 等)
  - 移除 5 處 footer 手寫 link 條(已由 navbar 取代,避免雙寫)
- routes/admin_observability_routes.py 6 個 render_template 加 active_page='obs_*'
  讓 navbar dropdown 正確高亮

完整覆蓋:host_health / ai_calls_dashboard / budget / promotion_review / quality_trend / ppt_audit_history

設計規範對齊:仍待 Phase 後續工作(ewoooc_base.html 框架升級 + --momo-* design token)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 18:49:44 +08:00
OoO
99d2f3c543 fix(p32): admin URL prefix /admin → /observability — 避開 188 nginx SPA shadow
All checks were successful
CD Pipeline / deploy (push) Successful in 2m25s
Root cause(curl 實證):
  prod 188 nginx 對 /admin/* 設 try_files → SPA index.html fallback
  → Phase 27-31 的 6 個 Flask admin 路由全被 nginx 攔截
  → 外部 GET /admin/ai_calls 回 7480 byte 靜態 HTML(同 etag = SPA shell)
  → 我之前說「6 admin 頁 prod 200」是回了 200,但 body 不是 Flask 渲染

修法:
  Blueprint url_prefix /admin → /observability
  → 6 個觀測頁實際生效在 /observability/* 不被 SPA 遮蔽
  → SPA frontend 仍擁有 /admin/* 命名空間(不破壞既有前端)

更新範圍:
  - routes/admin_observability_routes.py: url_prefix + 註解全改
  - 6 templates: 所有 href / fetch() 路徑改 /observability/
  - tests/test_admin_observability_routes.py: client.get/post 路徑改
  - 10/10 smoke tests 仍 PASS

統帥訪問新路徑:
  http://192.168.0.188/observability/ai_calls
  http://192.168.0.188/observability/host_health
  http://192.168.0.188/observability/budget
  http://192.168.0.188/observability/promotion_review
  http://192.168.0.188/observability/quality_trend
  http://192.168.0.188/observability/ppt_audit_history
2026-05-04 14:13:27 +08:00
OoO
69ccf8029b feat(p29): 預算管理頁 + PPT vision 歷史頁 — 完成 6 個 admin 觀測頁
All checks were successful
CD Pipeline / deploy (push) Successful in 2m23s
承接 Phase 27/28(48b8fda)剩 2 個前端頁:

1. /admin/budget — 預算編輯器
   - GET: ai_call_budgets × 當月 spent 即時對比 + throttle 狀態
   - POST /admin/budget/update/<id>: AJAX 編輯 budget_usd / alert_pct
   - 不需 restart 立即生效(cost_throttle hourly cron 自動讀新值)
   - ratio ≥80% 黃 / ≥110% 紅 / throttled 標 ⚠️ THROTTLED

2. /admin/ppt_audit_history — PPT 視覺審核歷史
   - 掃 reports/ 過去 7 日 .pptx 檔(檔名/大小/修改時間)
   - 顯示 PPT_VISION_ENABLED 狀態(true=daily 22:00 cron 自動跑)
   - 手動觸發 SOP 提示(SSH 188 跑單檔審核)

完工里程碑:6 個 admin 頁 + 1 個導覽
- /admin/ai_calls          (Phase 27)
- /admin/promotion_review  (Phase 27)
- /admin/quality_trend     (Phase 28)
- /admin/host_health       (Phase 28)
- /admin/budget            (Phase 29) ← 新增
- /admin/ppt_audit_history (Phase 29) ← 新增

Operation Ollama-First v5.0 — 前端互補互動系列收官
2026-05-04 13:44:08 +08:00