Commit Graph

127 Commits

Author SHA1 Message Date
OoO
3920701e1a feat(dashboard): optimize cache and AI pick confidence
All checks were successful
CD Pipeline / deploy (push) Successful in 2m46s
2026-05-01 16:01:52 +08:00
OoO
a5de082437 feat(dashboard): 顯示 50 品 AI 挑品清單
All checks were successful
CD Pipeline / deploy (push) Successful in 3m12s
2026-05-01 15:08:41 +08:00
OoO
ea15aa6437 refactor(vendor): 抽出廠商管理查詢服務
Some checks failed
CD Pipeline / deploy (push) Failing after 8m57s
2026-05-01 14:20:09 +08:00
OoO
fbc85fcedc refactor(vendor): 抽出缺貨 API 查詢服務
All checks were successful
CD Pipeline / deploy (push) Successful in 2m11s
2026-05-01 14:12:56 +08:00
OoO
b5de8d5d61 fix(ai): 價格調整轉人工覆核
All checks were successful
CD Pipeline / deploy (push) Successful in 2m16s
2026-05-01 14:09:54 +08:00
OoO
62f8f1d52d refactor(vendor): 抽出缺貨 V2 查詢服務
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-01 14:07:10 +08:00
OoO
8a3d50933b feat(ai): 自動補抓並重算 PChome 挑品
All checks were successful
CD Pipeline / deploy (push) Successful in 2m18s
2026-05-01 14:02:37 +08:00
OoO
043a7dc915 feat(ai): 補抓 PChome 待比對商品
All checks were successful
CD Pipeline / deploy (push) Successful in 2m20s
2026-05-01 13:40:37 +08:00
OoO
9f9e0727e7 fix(ai): 自動偵測挑品銷售欄位
All checks were successful
CD Pipeline / deploy (push) Successful in 1m50s
2026-05-01 10:18:07 +08:00
OoO
70de91f1f6 fix(ai): 修正挑品清單銷售日期查詢
All checks were successful
CD Pipeline / deploy (push) Successful in 2m14s
2026-05-01 10:12:32 +08:00
OoO
20f6b2ded2 fix(feeder): 控制 PChome 多關鍵字搜尋成本
All checks were successful
CD Pipeline / deploy (push) Successful in 2m16s
2026-05-01 10:08:24 +08:00
OoO
82d759d3b1 feat(ai): 建立 PChome 銷售挑品清單
All checks were successful
CD Pipeline / deploy (push) Successful in 2m24s
2026-05-01 10:05:16 +08:00
OoO
55855ef508 feat(frontend): 保存 PChome 競品價格歷史
All checks were successful
CD Pipeline / deploy (push) Successful in 1m39s
2026-05-01 00:53:37 +08:00
OoO
dd35306399 refactor(openclaw): 抽出選單鍵盤 builders
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 23:17:19 +08:00
OoO
d88dcc8f75 fix(devops): 清理舊端口與危險 compose 操作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m45s
2026-04-30 14:24:53 +08:00
OoO
fb9c4ad1b5 refactor(openclaw): 抽出 Telegram API helper
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-04-30 14:24:45 +08:00
OoO
89e7f2ccd2 fix(ai): 擴大 ElephantAlpha 暫時性 fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 13:59:12 +08:00
OoO
72fa166729 fix(ai): 遷移 Ollama embedding 至 api embed
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 10:24:15 +08:00
OoO
91ad98e621 feat(ai): 強化 ElephantAlpha NIM fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 1m48s
2026-04-30 09:33:39 +08:00
OoO
d5f4fd7198 加入 AI Smoke 每日摘要推播
All checks were successful
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:57:36 +08:00
OoO
10bbd55f5b 補齊 AI Smoke 趨勢管理
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:54:23 +08:00
OoO
81159b5b3d 保存 AI Smoke 趨勢紀錄
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 23:50:44 +08:00
OoO
cde8b0cd3e 新增 AI 自動化 Smoke Dashboard
All checks were successful
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:46:48 +08:00
OoO
e6a1c9d09f 補齊 AI 自動化可觀測性指標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:41:03 +08:00
OoO
162a76b8f9 落地 L2 安全記憶動作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
2026-04-29 23:29:45 +08:00
OoO
5b25f55340 補齊 EventRouter 失敗通知回放
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:26:02 +08:00
OoO
d4865983d8 補強 ElephantAlpha 執行與通知閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:14:09 +08:00
OoO
78eebfbcfc 加入告警去重與洞察向量回補
All checks were successful
CD Pipeline / deploy (push) Successful in 1m19s
2026-04-29 23:10:27 +08:00
OoO
0c2e9bbced 串接 AI 洞察向量化與漏通知入口
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:05:46 +08:00
OoO
f0e044aa48 補齊自癒稽核與 OpenClaw 記憶閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:02:06 +08:00
OoO
1c2dc6cd61 補強 AI 自動化閉環與安全降級
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 22:56:00 +08:00
OoO
0875dd8fda 補強 5.5 自癒安全回看
All checks were successful
CD Pipeline / deploy (push) Successful in 1m11s
2026-04-29 22:48:24 +08:00
OoO
779b27f676 修復 P0 告警自癒鏈與測試收集
All checks were successful
CD Pipeline / deploy (push) Successful in 9m39s
2026-04-29 22:37:20 +08:00
OoO
4cbd775c1b fix(aiops): 補齊 Elephant Alpha trigger context
All checks were successful
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
All checks were successful
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
All checks were successful
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
All checks were successful
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
All checks were successful
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/
All checks were successful
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 不存在)
Some checks failed
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)
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-28 14:10:31 +08:00
OoO
af260c4a01 feat: 新增三個促銷活動爬蟲支援(母親節、520情人節、勞動節)
All checks were successful
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
All checks were successful
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
All checks were successful
CD Pipeline / deploy (push) Successful in 1m18s
2026-04-28 12:26:49 +08:00