OoO
0c2e9bbced
串接 AI 洞察向量化與漏通知入口
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:05:46 +08:00
OoO
f0e044aa48
補齊自癒稽核與 OpenClaw 記憶閉環
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:02:06 +08:00
OoO
1c2dc6cd61
補強 AI 自動化閉環與安全降級
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 22:56:00 +08:00
OoO
0875dd8fda
補強 5.5 自癒安全回看
CD Pipeline / deploy (push) Successful in 1m11s
2026-04-29 22:48:24 +08:00
OoO
779b27f676
修復 P0 告警自癒鏈與測試收集
CD Pipeline / deploy (push) Successful in 9m39s
2026-04-29 22:37:20 +08:00
OoO
4cbd775c1b
fix(aiops): 補齊 Elephant Alpha trigger context
...
CD Pipeline / deploy (push) Successful in 1m39s
部署閘門修復:補 autonomous engine 的 confidence/max decision 初始化與 _build_trigger_context,避免 scheduler autonomous monitoring 持續噴 AttributeError。
2026-04-29 21:48:41 +08:00
OoO
4d5a995718
chore: 刪除孤兒 AI service 並補齊 env 範例
...
ADR-017 Phase 3f-5:刪除未被 runtime 引用的 elephant_alpha_decision_router、telegram_ai_integration、watcher_agent;補 .env.example 的 Aider/AutoHeal/NVIDIA/OpenClaw/backup/report/PG sync 等實際讀取變數。
2026-04-29 21:46:24 +08:00
OoO
9528d6c23e
fix(stability): 補強 scheduler 例外處理與 vendor 模板路徑
...
ADR-017 Phase 3f-3:移除 scheduler 裸 except,P1 任務失敗改走 EventRouter notify_failure 同步入口;清理 docker-compose vendor 死 mount;修正 vendor_bp template_folder 指向專案 web/templates。
2026-04-29 21:39:25 +08:00
OoO
13fa165ee2
refactor(cache): 統一 cache SOT 並啟用 gunicorn preload
...
ADR-017 Phase 3f-2:新增 services/cache_manager.py,讓 sales/import/export/daily/dashboard 共用同一份 in-memory cache;cache_service 改為相容 shim;Dockerfile/docker-compose 啟用 gunicorn --preload。
2026-04-29 21:35:56 +08:00
OoO
f4149d4c05
fix(db): 補全 metadata model import 與 realtime sales ORM
...
ADR-017 Phase 3f-0
2026-04-29 21:00:46 +08:00
OoO
3971fd4020
fix(daily_sales): cache 失效改 DB fingerprint + clear_cache 加 @login_required
...
CD Pipeline / deploy (push) Successful in 1m12s
回應 critic 對 8fefea0 的 4 個 HIGH finding(debugger/web-researcher/migration-engineer 三方共識):
HIGH-3 修復:
- /api/daily_sales/clear_cache 加 @login_required,避免外部 DoS 攻擊清快取
HIGH-4 修復(核心):
- 新增 _get_data_fingerprint(engine):SELECT MAX(snapshot_date), COUNT(*) FROM daily_sales_snapshot
- _is_cache_valid 改雙閘:TTL(保險絲)+ DB fingerprint(強一致)
- 三個 cache 寫入點同步記錄 fingerprint
- 移除 services/import_service.py 的 4-worker N-POST hack(命中率僅 9.4%,
coupon collector 機率:4!/4^4 = 0.094)
- 資料寫入後指紋自動跳號,4 worker 下次 request 各自偵測失效並重載 → 強一致
附帶修:
- 統一 export/export_marketing 兩處 cache 寫入結構(補 timestamp/fingerprint),
解決 db-expert 標記的「export 端點 cache 缺 timestamp 導致主看板每次都重讀」瑕疵
未處理(留待後續):
- HIGH-2: app.py 仍有 43 處 _SALES_PROCESSED_CACHE(sales_analysis 等其他路由的獨立 cache)
待後續 P9 統一抽 services/cache_manager.py
[P7-COMPLETION]
方案: critic + debugger + web-researcher + migration-engineer 四方共識的方案 B
影響: routes/daily_sales_routes.py + services/import_service.py 兩檔
Regression: 每 request 多 1 次 SELECT MAX/COUNT(< 5ms),其餘行為等價
2026-04-29 09:10:23 +08:00
OoO
8fefea05da
fix(daily_sales): 啟用 bp 版改進邏輯 + import 後跨 worker 清 cache,根除 #24 隱形 bug
...
CD Pipeline / deploy (push) Successful in 1m6s
- 從 app.py 刪除 396 行的 /daily_sales、/daily_sales/export、/daily_sales/export_marketing
三條 @app.route(行 5911-6306),讓 routes/daily_sales_routes.py 的 daily_sales_bp
生效(first-registered wins,原 app.py 版本 shadow 了 bp)。
- bp 版改進點:_is_cache_valid() 帶 5 分鐘 TTL、/api/daily_sales/clear_cache 端點、
完整模板參數(datetime_now / active_page)。
- services/import_service.py process_daily_sales_import return True 前,
新增跨 gunicorn worker 清 daily_sales cache 邏輯:依 GUNICORN_WORKERS 次數呼叫
internal /api/daily_sales/clear_cache,避免 4 worker 各持 5 分鐘舊快取
導致「匯入 15323 筆但當日業績看不到」隱形 bug。
[P7-COMPLETION]
- 方案正確: 雙重佐證(refactor-specialist + web-researcher)確認 Flask first-registered
wins,刪 app.py 內 route 即可讓 bp 接管;helper 函式(preprocess_daily_sales_data 等)
為 dead code 但保守保留不影響執行。
- 影響完整: 全 repo grep 確認 _SALES_PROCESSED_CACHE 在 app.py 仍有 30+ 處使用
(sales_analysis 等其他路由),未動到;helper 函式無外部 caller。
- Regression 風險: 低,bp 版簽名與行為相容;新 cache 清除走 internal HTTP 帶 try/except
不影響主流程;若 GUNICORN_WORKERS 未設則默認 4 與生產一致。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-28 21:18:17 +08:00
OoO
333fc159ae
fix: CodeReview Gemini 模型從已下架 preview 換成 gemini-2.5-flash
...
CD Pipeline / deploy (push) Successful in 1m6s
services/code_review_pipeline_service.py:41 OPENCLAW_MODEL 預設值
gemini-2.5-flash-preview-05-20 已被 Google 下架(404 not found),
改為穩定 GA 版本 gemini-2.5-flash。
驗證:直接 API 測試
- gemini-2.5-flash → 200 ✅
- gemini-2.5-flash-preview-05-20 → 404 ❌
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-28 21:01:44 +08:00
ooo
c91dc273f0
refactor(p1-01f): JSON 持久化抽到 services/json_storage.py
...
CD Pipeline / deploy (push) Successful in 1m9s
- load_categories / save_categories / load_scheduler_stats 三個函數搬出
- CATEGORIES_JSON_PATH / SCHEDULER_STATS_PATH 常數同步搬移
- app.py 改 import 維持原呼叫路徑
行數變化: app.py 7,070 → 7,053 (-17)
2026-04-28 19:42:05 +08:00
ooo
d4ea555030
refactor(p1-06/07): daily_sales 純函數抽到 services/
...
CD Pipeline / deploy (push) Successful in 1m14s
- 新增 utils/df_helpers.py 放共用 find_col(避免 routes/services 雙向依賴)
- 新增 services/daily_sales_service.py 收:
* get_taiwan_holiday(date)
* prepare_calendar_data(df, selected_month)
* prepare_marketing_summary(df, ...)
- routes/daily_sales_routes.py 改為 import service,行數 949 → 713(-236)
- 行為 100% 保留,僅檔案位置搬移
2026-04-28 15:37:07 +08:00
OoO
421395eb86
config: 暫停 valentine_520 與 labor_day 爬蟲(LPN 不存在)
...
CD Pipeline / deploy (push) Failing after 1m50s
- 520 情人節主會場尚未上線(預計 5/10~5/15 momo 才會發布)
- 勞動節 momo 歷年無獨立主會場,常合併進春日/桃金日活動
- 清空兩者 lpn_code 避免共用 mothers_day LPN 灌入錯誤標籤資料
- 加註 pause_reason 與 paused_date 供後續 LPN 補回時參考
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-28 15:26:20 +08:00
OoO
b49b704e82
fix(post-3.5g): restore generate_embedding for KM dual-write (CRIT-1)
...
從 4349db2~1 撈回 OllamaService.generate_embedding,補齊被誤刪的方法。
問題:
- services/openclaw_learning_service.py:67 仍呼叫 ollama_service.generate_embedding(...)
- 4349db2 大改時把這個方法刪掉,導致每次 NemoTron 寫入學習資料時觸發
AttributeError: 'OllamaService' object has no attribute 'generate_embedding'
- pgvector KM 因此完全停寫,違反 ADR-007 雙寫鐵律
修法:
- 把 method paste 回 OllamaService 末端(line 508)
- 對齊現代 config:os 已在檔案頂部 import,移除方法內重複 import
- embedding 走 EMBEDDING_HOST(Hermes 主機,內網免認證)
- model 預設 bge-m3:latest(ADR-003 對齊)
驗證:
- AST parse OK
- grep 'def generate_embedding' 已存在
Critic finding: CRIT-1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-04-28 14:40:22 +08:00
OoO
5d0a9606d6
config: 填入 LPN 代碼並啟用三個促銷活動爬蟲 (O7ylWdZJHj8)
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-28 14:10:31 +08:00
OoO
af260c4a01
feat: 新增三個促銷活動爬蟲支援(母親節、520情人節、勞動節)
...
CD Pipeline / deploy (push) Successful in 1m12s
- 新增通用促銷活動爬蟲函式 run_promo_event_task()
- 更新 crawler_config_loader.py 新增三個活動配置
- 更新 run_scheduler.py 動態註冊促銷活動爬蟲
- 新增 API 端點 /api/run_promo_event_task
- 新增三個前端儀表板路由(/edm/mothers_day, /edm/valentine_520, /edm/labor_day)
- 更新所有儀表板頁籤列表
- 新增配置檔案 services/data/crawler_config.json
- 新增使用文件 docs/guides/promo_event_crawler_guide.md
- 更新 agent_actions.py 允許重試列表
2026-04-28 13:57:44 +08:00
OoO
1ecec162dd
fix: increase Ollama health check timeout to prevent false offline status
CD Pipeline / deploy (push) Successful in 1m18s
2026-04-28 12:35:58 +08:00
OoO
d67d309ada
fix(post-3.5e): store_conversation 簽章對齊呼叫端 (E4 P1 bug)
...
問題:3 個呼叫點傳 6 個 positional args,但定義只接 3 個,
TypeError 被 thread 內 except 吞掉,OpenClaw 答題對話沉澱靜默失敗,
違反 ADR-007 持久化鐵律(AI 學習數據必雙寫 DB+KM)。
修法(方案 A 元數據保留):
- 簽章:(user_id, user_message, bot_response)
→ (user_id, chat_id, user_message, bot_response, source='', used_sources=None)
- chat_id / source / used_sources 全部進 metadata,給未來分析用
- 呼叫點不需改動(args 已是 6 個,對齊新簽章)
驗證:AST inspect 確認 3 個呼叫點全部對齊新簽章。
Out-of-scope(暫不處理):
- 呼叫端寫死 user_id=0、chat_id=0,留給下一輪修
- 內部 store_insight 雙寫邏輯不動
錨點:services/openclaw_learning_service.py:330
呼叫點:routes/openclaw_bot_routes.py:4113, 4166, 4214
2026-04-28 12:29:48 +08:00
OoO
b766edfde2
fix: store_conversation signature, MCP model, and AI fallback message
CD Pipeline / deploy (push) Successful in 1m18s
2026-04-28 12:26:49 +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
b954cc37cf
fix(post-3.5c): nemoton dispatcher IP 殘留集中化
...
餘震 C-1:
- services/nemoton_dispatcher_service.py:287 env fallback hardcoded
192.168.0.111,違反 ADR-008 集中化原則
- 改從 config.HERMES_URL 集中讀取
Out-of-scope finding(不在本次修復範圍):
- line 286 仍寫死 "qwen2.5:7b-instruct",但實際模型是 hermes3:latest
(與 hermes_analyst_service.py:30 不一致,應由後續 PR 處理)
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
32ac92b8f0
fix: _ssh_exec signature in ElephantAlpha
CD Pipeline / deploy (push) Has been cancelled
2026-04-28 12:15:42 +08:00
OoO
3dd73dce03
fix: missing sqlalchemy text import and _ssh_exec in ElephantAlpha
CD Pipeline / deploy (push) Successful in 1m20s
2026-04-28 12:13:44 +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
OoO
30fc7609df
fix: 將預設 Ollama 模型改為 111 主機已有的 llama3.1:8b
CD Pipeline / deploy (push) Successful in 1m17s
2026-04-28 12:00:57 +08:00
OoO
4349db2015
feat: AiderHeal 支援 ssh 與 Ollama 設為首選 AI 引擎
CD Pipeline / deploy (push) Successful in 8m40s
2026-04-28 11:41:12 +08:00
OoO
213216b495
fix: 優化 Telegram Bot 自然對話體驗,移除強制選單並串接 AI 引擎
CD Pipeline / deploy (push) Successful in 1m18s
2026-04-28 11:33:02 +08:00
ogt
4a648ea6bf
refactor: fix reverse dependencies — logger_manager→utils, dashboard_service extraction
...
- Move SystemLogger implementation to utils/logger_manager.py (pure utility, no deps)
- services/logger_manager.py becomes a backward-compat re-export shim
- database/manager.py and database/vendor_manager.py now import from utils layer
- Extract get_dashboard_stats() to services/dashboard_service.py
- services/task_runner.py no longer imports from routes layer
- routes/dashboard_routes.py get_dashboard_stats() delegates to service layer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 21:28:23 +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
237d3af76f
fix: Phase 2 P0 全清零 — 14 項安全與功能修復完成
...
CD Pipeline / deploy (push) Failing after 2m59s
P0-06: google_drive_service.py — pickle.load() 改 JSON token(消除 RCE 風險)
P0-07: bot_api_routes.py:30 — BOT_API_TOKEN 移除硬編碼預設值 clawdbot_momo_2026
P0-08: auto_import_index.html — showAlert innerHTML 改 createTextNode(XSS 修復)
P0-09: abc_analysis_detail.html + dashboard.html + daily_sales.html — Jinja2 | e 轉義
P0-10: openclaw_bot_routes.py:2634 — vendor PPT 補 return ppt_path(廠商報告恢復)
P0-11: telegram_bot_service.py:177-214 — cmd_start/cmd_help 補 try/except
P0-12: app.py:689-712 — 10 個 Blueprint 補齊 register(消滅 404 路由)
P0-13: auto_heal_service.py — 實作 _write_heal_log(),AIOps 稽核閉環補完
P0-14: monitoring/prometheus.yml — 取消 alert_rules comment;新增 alert_rules.yml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 21:11:52 +08:00
ogt
f59b23f969
security: P0 修復 S1-S5 — 移除所有硬編碼密碼與 SQL Injection 漏洞
...
S1: config.py — LOGIN_PASSWORD 移除硬編碼預設值 0936223270,改 fail-fast
S2: config.py — SECRET_KEY 移除弱預設值,無值或預設值時 sys.exit(1)
S3: services/user_service.py — create_initial_admin 改讀 INITIAL_ADMIN_PASSWORD env
S4: app.py — 匯入流程 table_name 正規表達式白名單驗證,date_list 格式驗證
S5: database/manager.py — ALLOWED_SALES_TABLES frozenset 白名單,日期改參數化查詢
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 20:34:15 +08:00
ogt
b3a7909b2b
fix: add try/except guards to all unprotected Telegram handler functions
...
CD Pipeline / deploy (push) Successful in 1m29s
- Replace 2 silent `except Exception: pass` with logger.warning in handle_callback
- Wrap _handle_await_callback, _handle_main_menu_callback with top-level try/except (query.answer on error)
- Wrap _handle_complex_ai_response, _handle_simple_ai_response, _enhanced_keyword_matching, _process_await_input with top-level try/except (update.message.reply_text on error)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 19:47:49 +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
ac56139e74
fix: translate _get_query_suggestions to zh-TW + add missing promo_range await prompt
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 19:45:52 +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
05f2064346
fix: correct Gemini model name + use accessible NVIDIA NIM model
...
CD Pipeline / deploy (push) Successful in 1m17s
gemini-2.5-flash-preview-05-20 → gemini-2.5-flash (correct API name)
nvidia/llama-3.1-nemotron-ultra-253b-v1 → meta/llama-3.3-70b-instruct
(nemotron-ultra requires premium account, llama-3.3-70b confirmed accessible)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 11:03:11 +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
e4ad2432fd
fix: remove bogus SSHJumpExecutor re-export that broke telegram AI import chain
...
CD Pipeline / deploy (push) Successful in 1m43s
SSHJumpExecutor class never existed in auto_heal_service.py.
The dead import caused ImportError blocking telegram_ai_integration
from loading, which broke all natural language conversation in the bot.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 09:47:31 +08:00
ogt
4ff291b596
fix: 修復 AI 對話無法使用 + 全面繁體中文化
...
CD Pipeline / deploy (push) Successful in 1m28s
- telegram_ai_integration.py 移至 services/ 解決 ModuleNotFoundError
(momo-telegram-bot 只掛載 services/,根目錄檔案進不了容器)
- import 路徑更新為 from services.telegram_ai_integration
- 所有英文回覆字串改為繁體中文:
· 歡迎訊息、fallback 訊息、錯誤提示
· _enhanced_keyword_matching 全英文段落
· _handle_complex_ai_response / _handle_simple_ai_response
· Cancel 按鈕改「❌ 取消」、callback 改 menu:main
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 09:41:55 +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
3f7fc0aba0
[V10.4-B] Telegram 按鈕安全強化:C2/C3/H4/H6 修復
...
修復 P9-1 全景盤點所發現的四項高優先問題:
- routes/openclaw_bot_routes.py:
C3: ALLOWED_USERS/ALLOWED_GROUP 白名單 fail-closed,阻擋非授權 chat
H4: _seen_update_ids 改用 deque(maxlen=500) LRU 防記憶體洩漏
- services/telegram_bot_service.py:
C2: 新增 momo:bpa/bpr/eig 三個 callback 分支 + handler 實作
H6: callback 滑動視窗速率限制(30次/分鐘/用戶)
- services/telegram_templates.py:
修正 decision_result / ops_action_result ImportError BLOCKER
新增 _now_taipei_hhmm / _html_escape 輔助函式
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-25 01:42:58 +08:00