OoO
11896c24dc
V10.518 拆分比價覆蓋與價格新鮮度
CD Pipeline / deploy (push) Successful in 1m9s
2026-05-31 23:16:06 +08:00
OoO
b73dc6df3f
V10.415 protect Hermes fallback routing
CD Pipeline / deploy (push) Successful in 1m5s
2026-05-24 14:25:22 +08:00
OoO
65d38d4632
V10.407 shorten ai runner residency
CD Pipeline / deploy (push) Successful in 1m34s
2026-05-24 13:32:35 +08:00
OoO
1272c01ec6
V10.404 gate Hermes direct price alerts
CD Pipeline / deploy (push) Successful in 1m6s
2026-05-24 13:13:00 +08:00
OoO
78b6f156ba
強化商品比價身份分級與告警路由
CD Pipeline / deploy (push) Successful in 1m9s
2026-05-21 14:04:06 +08:00
OoO
00a808518e
將 111 Ollama fallback 收斂到輕量模型
2026-05-21 12:39:23 +08:00
OoO
75390f8495
收緊 PChome 同款比對門檻
CD Pipeline / deploy (push) Successful in 1m19s
2026-05-19 15:53:09 +08:00
OoO
dafde7e1a7
強化 MOMO PChome 比價可信鏈路
CD Pipeline / deploy (push) Successful in 1m45s
2026-05-19 15:26:10 +08:00
OoO
ed29e66fde
fix: route hermes through ollama cascade
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 21:21:05 +08:00
OoO
36d0e5d5f3
標記 RAG 命中節省 LLM 呼叫
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 09:21:50 +08:00
OoO
c7d6db31f2
feat(p11): RAG 自主學習 + Promotion Gate 4 階段護欄(feature flag OFF)
...
CD Pipeline / deploy (push) Has started running
Operation Ollama-First v5.0 / Phase 11 / RAG 自主學習迴圈
services/rag_service.py (532 行)
- RAGService.query() — bge-m3 embed + cosine 0.85 threshold + top_k=5
- get_embedding_signature() — v5.0 護欄 #3 一致性檢查 (SHA1[:12])
- fire-and-forget rag_query_log INSERT (不阻塞主流程)
- feedback() — Telegram 👍 /👎 寫回 feedback_score
- RAG_ENABLED 預設 OFF(戰前行為不變)
services/learning_pipeline.py (750 行)
- Distiller — 純 Hermes 規則引擎,零 LLM 成本
Quality 規則:MCP >200 字 0.8 / LLM JSON ok 0.9 / TextRank 0.6 / 👍 1.0 / 👎 0.0
- PromotionGate — Owen v5.0 護欄 #1 鐵律
Stage 1: quality_score >= 0.7
Stage 2: 無幻覺檢測(規則引擎,零 LLM)
Stage 3: 與既有 insight 相似度 < 0.95(Stage 3 在 episode embed 後啟用)
Stage 4: weight >= 0.8 必經 Telegram 👍 /👎
- expire_stale_reviews() — 24h 無回應自動降級 weight=0.5
- hash_human_approver — Telegram username SHA1[:8] PII 保護
services/hermes_analyst_service.py — 新增 analyze() RAG-first
- RAG hit → return synthesize(不燒 LLM)
- RAG miss → 既有 LLM 路徑 + enqueue learning_episodes
services/openclaw_strategist_service.py — Q&A 入口接 RAG-first
- 不動週/月/年報(敘事報告 RAG hit 機率低)
services/telegram_templates.py
- rag_feedback_keyboard() — 👍 /👎 inline keyboard
- promotion_review_keyboard() — Stage 4 人工驗收按鈕
routes/openclaw_bot_routes.py — 3 組 callback handler
- rag_fb:{id}:{score} → rag_service.feedback()
- pg_ok:{episode_id} → PromotionGate.promote()
- pg_no:{episode_id} → PromotionGate.reject()
70 unit tests 全綠 + 全戰役 196 tests zero regression(4:17 跑完)
剩餘 limitations(Phase 12+ 補):
1. learning_episodes.embedding 寫入路徑(Stage 3 dedup 暫 skip)
2. PromotionGate worker cron 未掛
3. Telegram awaiting_review 推播未接(callback handler 已就位)
灰度開啟條件(建議 1 週後):
- ANTHROPIC_API_KEY 設定 + RAG_ENABLED=true + threshold=0.90 保守
- feedback_score >= 4 比率 > 70% → threshold 降至 0.85
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-03 23:56:12 +08:00
OoO
838267c293
feat(p1+p3): logger 接 13 caller + Q&A/Nemotron/日報 feature flag 灰度
...
Phase 1 A4 — 13 個呼叫點接 ai_call_logger(覆蓋率 11.8% → 預估 50%+)
- TOP-1 nemoton_dispatcher: nemotron_dispatch caller (NIM 配額追蹤)
- TOP-2 openclaw_strategist: 4 reports (daily/weekly/monthly/meta) + qa caller
- TOP-3 hermes_analyst: hermes_analyst + hermes_intent (順修 commit 00591c5 殘留 bug)
- TOP-4 code_review_pipeline: code_review_hermes/openclaw/elephant 三鏈 (request_id 串)
- TOP-5 openclaw_bot_routes: openclaw_bot_main/gemini/nim 三層 fallback
Phase 3 A7 — OpenClaw Q&A → qwen3:14b(feature flag OFF)
- OPENCLAW_QA_OLLAMA_FIRST 灰度開關
- 繁中強制 system prompt + Gemini fallback chain
- _is_low_quality_response 品質守門(簡體字檢測 + 拒答訊號 + 結構分數)
- 黃金集 A/B 對照測試框架(10 樣本去 PII)
Phase 3 A8 — OpenClaw 日報 → Hermes 模板(feature flag OFF)
- OPENCLAW_DAILY_HERMES_TEMPLATE 灰度開關
- _compute_daily_kpi 純 SQL + Hermes 規則引擎
- _compute_gemini_insight 精簡 200 字洞察 prompt
- templates/daily_report_v2.j2 + _SafeUndefined 缺欄位優雅降級
- scripts/compare_daily_report_versions.py 雙版本盲測
Phase 3 A9 — Nemotron NIM → qwen3:14b(feature flag OFF)
- NEMOTRON_OLLAMA_FIRST 灰度開關(A2 紅燈:deepseek-r1 假支援,改 qwen3)
- _call_qwen3_dispatch + 既有 NIM tool_calls 解析共用
- 保留 ADR-004「🟡 [降級模式]」Hermes 規則引擎兜底
H6 PII fix — chat_id 進 ai_calls.meta 改 SHA1[:8](4 處 Bot Q&A)
Code Review pipeline — N3 動態 provider tag(gcp/secondary/111)+ A4 logger 三鏈
37 unit tests 全綠(routing 15 + golden 5 + qwen3 8 + daily template 8 + nemotron 1)
Operation Ollama-First v5.0 / Phase 1 A4 + Phase 3 A7+A8+A9
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-03 23:05:38 +08:00
OoO
00591c5489
feat(ea-hitl): ADR-021 EA 升級審核 pre-fetch + 競價告警金額影響量化
...
根治 2026-05-02 統帥反映的三層 EA escalation 訊息空泛問題:
1. _escalate_to_human 對 price_drop_alert / market_opportunity /
threat_escalation 三類觸發,送 Telegram 前先 await Hermes 取具體
SKU 清單覆蓋 plan 元流程文字(5s 短超時,失敗 fallback 原 plan)
2. NemoTron 競價告警新增 _compute_business_impact helper:
過去 7 日營收流失(gap_pct>0 才算)+ 跟進競品建議價,
dispatch 主路徑 / 防線二 / Hermes rule fallback 三條全部 Python
獨裁注入,告警含「📉 NT$ X」「🎯 NT$ Y」具體金額
3. 補實 telegram_bot_service.handle_callback 的 momo:eig: prefix
handler,HITL「🛑 忽略此事件」按鈕首次有對應 audit 寫入
Critic 審查通過(5 項必修全綠):
- Critical-1: user_label HTML escape 防 Telegram username XSS
- High-1: pre-fetch 改 asyncio.wait_for(5s) 防阻塞 escalation
- High-2: 全部行缺金額時 return None 觸發 plan fallback
- Medium-2: 空 event_id callback 拒絕避免 audit 污染
- Medium-3: gap_pct≤0 時 revenue_loss_7d 強制歸 0 不誤導降價
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-03 00:03:38 +08:00
OoO
67509a4e42
fix(post-3.5c): Hermes 降級 logger 等級從 error → warning
...
Item #5:
- services/hermes_analyst_service.py:122 降級到規則引擎是預期 fallback
路徑(不是錯誤),改用 logger.warning 與同檔 :175 一致
調查範圍(已查 grep "logger.error" + "降級|hermes|fallback"):
- services/nemoton_dispatcher_service.py:486 NIM content 解析失敗 → 真錯誤,保留 error
- services/nemoton_dispatcher_service.py:564 fallback 派發單筆失敗 → 真錯誤,保留 error
- routes/openclaw_bot_routes.py:4168 無 logger.error,候選位置無此 pattern(已查,無異狀)
2026-04-28 12:15:59 +08:00
OoO
60a7917634
fix(post-3.5c): 修正 hermes_analyst_service docstring 模型名稱誤導
...
餘震 B:
- services/hermes_analyst_service.py:7 註解寫 qwen2.5:7b-instruct
但實際 line 30 HERMES_MODEL = "hermes3:latest"
- 同步修正 host 描述為「HERMES_URL(預設 192.168.0.111:11434)」
2026-04-28 12:15:59 +08:00
OoO
5340475570
fix(post-3.5c): hermes timeout 雙標統一 + 補 keep_alive
...
餘震 A — 昨天 Hermes timeout 真因(incident 核心):
- services/hermes_analyst_service.py:158 硬編碼 timeout=10,與 :406 用
HERMES_TIMEOUT=120 雙標;payload 也沒帶 keep_alive,被別模型擠下後
冷啟動 30+s 必中 timeout
- HERMES_TIMEOUT 從檔內常數提升至 config.py 集中管理(ADR-008)
- 兩個 payload (intent/batch) 都補 keep_alive=24h(ADR-012)
- intent 路徑 timeout 從 10s 改用 HERMES_TIMEOUT;keep_alive 確保熱駐留時
實測仍 < 10s,不會撐到 120s 上限
檔案:
- config.py: 新增 HERMES_TIMEOUT 常數
- services/hermes_analyst_service.py: 移除檔內 HERMES_TIMEOUT、新增
HERMES_KEEP_ALIVE、補 payload keep_alive、line 158 timeout 統一
2026-04-28 12:15:59 +08:00
OoO
bc7113bc86
fix: ElephantAlpha crash, AiderHeal Ollama host, MCP integration for Hermes/NemoTron, and MCP hallucination
CD Pipeline / deploy (push) Successful in 1m18s
2026-04-28 12:11:33 +08:00
ogt
b9fe98f591
refactor: centralize config — HERMES_URL, SSH params, validate_critical_config()
...
- config.py: add HERMES_URL (default 192.168.0.111:11434), SSH jump params, validate_critical_config()
- services/hermes_analyst_service.py: remove hardcoded HERMES_URL, import from config
- app.py: call validate_critical_config() on startup, log warnings for optional missing vars
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 21:27:47 +08:00
ogt
b4d208d34a
fix: replace raise with warning in nemotron/hermes + fix hardcoded host in footprint
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 19:46:04 +08:00
ogt
c8ceec1f5f
fix: expand rule engine keywords to catch brand/strategy/investment queries
...
CD Pipeline / deploy (push) Successful in 1m53s
'品牌','廠商','加碼','投資','策略','建議','市場','機會','成長',
'預測','比較','推薦','最佳' now trigger complex routing → Gemini
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-26 20:23:12 +08:00
ogt
388260666e
perf: reduce Hermes timeout 25s→10s — Gemini handles main response
...
CD Pipeline / deploy (push) Successful in 1m16s
Hermes on 111 GPU takes 17s+ due to concurrent load.
Intent classification is just routing hint; Gemini/NVIDIA NIM does
actual heavy analysis. 10s timeout → quick rule engine fallback → faster UX.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 11:09:24 +08:00
ogt
9d0e083504
fix: increase Hermes timeout 20s→25s (measured 17s from container to 111)
...
CD Pipeline / deploy (push) Successful in 1m22s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 11:06:15 +08:00
ogt
c299abba5d
fix: restore Hermes to 111+hermes3 + add NVIDIA NIM auto-fallback for OpenClaw
...
CD Pipeline / deploy (push) Successful in 3m0s
Hermes was wrongly redirected to 188 (CPU-only, 60s+ timeout).
111 has hermes3:latest with GPU acceleration (~10s response).
OpenClaw now auto-detects:
1. Gemini (primary, when GEMINI_API_KEY set)
2. NVIDIA NIM nemotron-ultra (auto-fallback, NVIDIA_API_KEY already set)
3. Friendly error only when both are unavailable
This implements the user-requested auto-failover pattern: always try
primary first, silently fall back, restore automatically when primary recovers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 10:31:00 +08:00
ogt
e9e0ddf54f
fix: json.dumps dict before psycopg2 insert + remove fatal raise in save_context
...
CD Pipeline / deploy (push) Successful in 1m22s
save_context/_save_action_plan passed raw Python dicts as SQL bind params,
causing psycopg2.ProgrammingError that propagated via raise and crashed the
entire AI pipeline, forcing every natural language message to keyword fallback.
Also increase Hermes intent timeout 15s→30s for qwen2.5 cold-start latency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 10:12:20 +08:00
ogt
d5c0feab5e
fix: Telegram bot 全功能修復 — 16個await按鈕/AI對話/模型遷移/DB schema
...
CD Pipeline / deploy (push) Successful in 1m35s
## Telegram Bot 功能修復
- 補全 16 個 await: 按鈕的 handler(日期選擇/目標設定/促銷追蹤等),
新增 _handle_await_callback + _process_await_input 完整狀態機
- cmd: 按鈕加入 ⏳ 即時回饋 + try/except 防 BadRequest
- handle_callback 加頂層 try/except 錯誤兜底
- 補 momo:cmd:suggestion + momo:menu:main callback handler
- 修復 _enhanced_keyword_matching context NameError
## AI 模型遷移(hermes3@111 → qwen2.5@188)
- hermes_analyst_service: URL 192.168.0.111→188, hermes3→qwen2.5:7b-instruct
- code_review_pipeline: 改用 HERMES_URL/HERMES_MODEL 常數
- elephant_alpha_orchestrator / nemoton_dispatcher: registry/footprint 同步
- aider_heal_executor: OLLAMA_API_BASE fallback 改 188
- ai_routes: footprint display 字串改 qwen2.5:7b-instruct
## ElephantAlpha 404 修復
- elephant_service: openrouter→NVIDIA NIM, nvidia/llama-3.1-nemotron-ultra-253b-v1
- ai_provider: 模型 ID 同步更新
## TELEGRAM_CHAT_ID 環境變數修正
- cicd_routes + aider_heal_executor: 優先讀 TELEGRAM_CHAT_IDS[0],
fallback TELEGRAM_CHAT_ID,修復通知靜默失敗
## AI 對話 logging 改善
- telegram_ai_integration: Hermes 降級改 WARNING,OpenClaw 失敗加 exc_info
- hermes_analyst_service: 連線失敗 log 加 host/model context
## DB Schema 修復
- migrations/019: action_plans 補齊全欄位,DROP NOT NULL action_type
- autoheal_models: ActionPlan ORM 同步為超集 schema
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 03:30:14 +08:00
ogt
5ef4151fa5
[V10.4-C] 三 AI NLP 鏈修復:Hermes/NemoTron/OpenClaw 全線串通
...
修復 P9-2 確認的自然語言對話完全失效問題:
- services/ai_orchestrator.py:
4 處裸字串 SQL 全部包裝 text(),修復 SQLAlchemy 2.x ArgumentError
- services/hermes_analyst_service.py:
新增 handle_l1() async 方法(Ollama hermes3 意圖分析 + rule-based fallback)
asyncio.get_event_loop() → get_running_loop()(Py3.12+ 相容)
- services/nemoton_dispatcher_service.py:
新增 handle_l2() async 方法(純 Python routing,不消耗 NIM 配額)
- services/openclaw_strategist_service.py:
新增 generate_strategy_response()(Gemini 2.0 Flash,無 key 時優雅降級)
- telegram_ai_integration.py:
整合 OpenClaw 為第三層(complexity >= 0.7 或 dispatch_to == "openclaw")
_format_*_response 全改為繁體中文
asyncio.get_event_loop() → get_running_loop()
_extract_date_range "to" → "至"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 01:43:20 +08:00
ogt
1b4f3a7bbe
feat: EwoooC 初始化 — 完整專案推版至 Gitea
...
CD Pipeline / deploy (push) Failing after 59s
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-19 01:21:13 +08:00