16 Commits

Author SHA1 Message Date
OoO
c55c74b999 強化 PPT 視覺 QA runtime 顯示
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s
2026-05-19 11:59:18 +08:00
OoO
c383a37f3f 補 PPT 視覺 QA stale recovery
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
2026-05-19 10:03:10 +08:00
OoO
cb0446e85f 限制 PPT 視覺 QA 投影片抽查
All checks were successful
CD Pipeline / deploy (push) Successful in 1m3s
2026-05-19 09:48:00 +08:00
OoO
abe3be2ffa 調整 PPT 視覺 QA timeout
All checks were successful
CD Pipeline / deploy (push) Successful in 1m2s
2026-05-19 09:30:58 +08:00
OoO
21cdbdb75c 修正 PPT 視覺 QA 多 worker 狀態
All checks were successful
CD Pipeline / deploy (push) Successful in 1m2s
2026-05-19 09:15:31 +08:00
OoO
583e318295 補 PPT 視覺 QA 背景狀態
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
2026-05-19 09:06:11 +08:00
OoO
60bc8bf2e2 補 PPT 視覺 QA runtime checklist
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
2026-05-19 01:24:07 +08:00
OoO
1cf1fd01b1 修正 Ollama fallback 與 PPT vision payload
All checks were successful
CD Pipeline / deploy (push) Successful in 1m30s
2026-05-18 21:32:15 +08:00
OoO
aa8c2c7148 補強 PPT 視覺 QA 補跑與全類型審核
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s
2026-05-18 20:57:34 +08:00
OoO
d2d8dbab65 強化 PPT 產線與線上預覽
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-18 15:44:11 +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
2234488378 fix: route special ollama fallbacks through cascade
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 21:41:43 +08:00
OoO
f4883b487c 保留 PPT Vision 主機標記失敗診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:51:44 +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
72a7c385d5 feat(p26): PPT 視覺審核 daily 22:00 cron — minicpm-v 自動掃當天新生 .pptx
All checks were successful
CD Pipeline / deploy (push) Successful in 2m54s
Operation Ollama-First v5.0 / Phase 26 — PPT 自我審視整合

services/ppt_vision_service.py 擴充:
- check_ppt_file(pptx_path, max_slides=5) — 整檔視覺檢查
  • LibreOffice headless 轉每張 slide 為 png
  • 對前 N 張跑 check_image
  • 彙總 issues + 平均 confidence
  • fail-safe:LibreOffice 不在 / 轉檔失敗 → 回 skip 不阻擋
- audit_recent_ppts(reports_dir, hours=24, max_files=10)
  • 掃 reports/ 過去 24h 新生 .pptx(getmtime filter)
  • 對每個檔跑 check_ppt_file
  • 彙總總 issues
- push_ppt_audit_to_telegram(summary)
  • 有 issues 才推 Telegram(避免「無問題」洗版)
  • 每檔最多 3 張 slide / 每張 2 個 issue 列出

run_scheduler.py — 每日 22:00 cron
- run_ppt_vision_audit task wrapper
- PPT_VISION_ENABLED=false 時 service 內部 skip(不打 LLM)

設計哲學:
不動既有 5 個 prs.save() 呼叫點(risk 高)→ 改寫獨立 daily cron 集中處理
零侵入 PPT 生成主流程 / 零 risk regression / feature flag OFF 預設

部署需求:
LibreOffice headless(apt install libreoffice)— 不在則 cron task 自動 skip + log

tests/test_ppt_vision_audit.py (9 tests 全綠)
- flag OFF skip / 目錄不存在 / 無 .pptx
- 舊檔(>hours)filter / LibreOffice 不在 fail-safe
- check_ppt_file flag/missing 容錯
- Telegram 推播:無 issues 不推 / 有 issues 推

regression: ppt_vision_service 既有 6 tests 全綠

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 11:16:11 +08:00
OoO
98063059c2 feat(p14-18): PPT vision + DeepSeek 直連 + caller_registry + Hermes 強化 + postmortem
All checks were successful
CD Pipeline / deploy (push) Successful in 2m50s
Operation Ollama-First v5.0 / Phase 14-18 全套(statesman 批准全部)

Phase 14 — services/ppt_vision_service.py (新檔, 200+ 行)
- minicpm-v:latest(GCP Primary 已拉 5.5GB,代替 qwen2-vl 不存在)
- check_image(image_path) → VisionResult.issues_found 視覺異常清單
- 走 resolve_ollama_host 三主機 retry + mark_unhealthy
- 繁中強制 system prompt + 結構化解析 ⚠️ marker
- feature flag PPT_VISION_ENABLED 預設 OFF

Phase 15 — services/deepseek_service.py (新檔, 170+ 行)
- DeepSeek API 直連 (api.deepseek.com/v1),OpenAI-compatible
- 取代部分 OpenRouter 路徑(直連便宜 ~30-50% + 延遲低)
- deepseek-chat ($0.014/$0.28) / deepseek-reasoner ($0.14/$2.19)
- feature flag DEEPSEEK_DIRECT_ENABLED 預設 OFF
- DeepSeekResponse 含 input_tokens/output_tokens/duration_ms

Phase 16 — services/llm_caller_registry.py (新檔, 130+ 行)
- CALLER_REGISTRY frozenset 集中管理 35+ 個 caller 名(ADR-028 白名單)
- assert_known_caller(strict=False) 整合到 ai_call_logger __init__
- 不在 registry → log warning(不 raise,保留擴展彈性)
- list_callers_by_service() 分組除錯
- 解 critic-A11 第 3 輪 L4 修補(命名分散三層)

Phase 17 — _is_low_quality_response 4 條新規則(A2 警訊深化)
- 規則 5:純英文回應(中文字元 < 30%)
- 規則 6:thinking-mode 漏洞(<think>...</think> 洩漏)
- 規則 7:重複迴圈偵測(前 50 字出現 ≥ 3 次)
- 規則 8:佔位符未填充({{var}} / [TODO] / <待填>)

Phase 18 — docs/operation_ollama_first_v5_postmortem.md (新檔)
- 戰役完整時間軸(Day 1-2)
- 3 大決策替代分析
- 4 個 critical hotfix 教訓
- Owen 三護欄落地對照
- KPI 達成度(Wave 1 提前 4 天 / Wave 2 提前 10 天)
- 統帥手動清單 + 7 條未來戰役教訓

Phase 13 補強(合併本 commit):
- ai_call_logger COST_TABLE 補 7 個新模型(qwen3:14b / qwen2.5:7b-instruct
  / qwen2.5-coder:32b / qwen2-vl:7b / deepseek-r1:14b / gemma3:4b / minicpm-v)

regression: 214 unit tests 全綠(4:02 跑完),2 skipped

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 10:19:13 +08:00