diff --git a/TODO_NEXT_STEPS.txt b/TODO_NEXT_STEPS.txt index 119942d..1ddd58b 100644 --- a/TODO_NEXT_STEPS.txt +++ b/TODO_NEXT_STEPS.txt @@ -4,6 +4,7 @@ ================================================================================ 【已完成】 + - V10.331 強化 PChome 比價 matcher 邊界:正式端 pilot 先刷新 30 筆過期 identity_v2、補抓 15 筆高價未配對 SKU,確認 structured diagnostics 開始寫入;針對「同品牌、同核心多組件、無任何否決理由、價格正常」但因規格文字不完整卡在 0.74x 的候選,新增 strong_component_line_match 窄門補分,避免 Gennies 類完整套組被誤留在低信心,同時維持雙入組對單品、容量衝突、不同品牌與補充瓶硬否決。 - V10.330 補市場情報 candidate queue review AI summary Telegram dispatch report run receipt:新增 read-only report run receipt builder、POST endpoint、UI 按鈕與 deployment readiness smoke target,在 report run readiness 後審核人工/獨立 job 產出的 report receipt、artifact path/hash、必要章節、summary hash 與 runtime boundary;API/UI 不讀 approval/Telegram token、不呼叫 LLM、不補產報表、不派送 Telegram、不開 DB、不寫檔、不更新 review_state、不掛 scheduler。 - V10.329 優化 `/growth_analysis` 冷快取策略:source fingerprint 未變時,成長分析共享快取由 30 分鐘延長為 6 小時有效;每日匯入仍會主動清除快取,避免資料更新後沿用舊圖表,同時降低正式端重啟或冷 worker 重新掃 `realtime_sales_monthly` 的 14 秒級等待。 - V10.328 強化 MOMO/PChome 核心比價準確性第一波:補高頻品牌 alias、中文商品線 bigram 訊號、保健/包裝同義單位與買送件數解析,搜尋詞改為品牌/核心/主規格三層;PChome 比對嘗試與正式快照補存 URL、圖片、庫存與結構化 diagnostics,商品列表用 tone 分流顯示尚未搜尋、低信心、身份否決、單位價與過期狀態,不再把不同問題全部壓成灰色待比對;同步持久化首頁 / PChome coverage 熱路徑索引,避免重開機後慢查詢回歸。 diff --git a/config.py b/config.py index f4dfd7a..db95015 100644 --- a/config.py +++ b/config.py @@ -320,7 +320,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.330" +SYSTEM_VERSION = "V10.331" LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log') public_url = PUBLIC_URL # 用於模板顯示 diff --git a/docs/memory/history_logs.md b/docs/memory/history_logs.md index 1548d29..39b4dee 100644 --- a/docs/memory/history_logs.md +++ b/docs/memory/history_logs.md @@ -15,6 +15,7 @@ ### 2026-05-20:重開機後首頁熱路徑索引持久化 - **Dashboard / PChome 慢查詢修復**: 主機重開機後 `https://mo.wooo.work/` 首頁可用但多次逾時,實際瓶頸集中在首頁與 PChome coverage 查詢掃描 `products`、`price_records`、`competitor_match_attempts`。線上先補三個索引讓首頁恢復 200,並新增 `migrations/040_dashboard_hot_path_indexes.sql` 將修復持久化到 fresh restore / DB rebuild 流程。 - **Growth Analysis 冷快取修復**: `/growth_analysis` 在 `monthly_summary_analysis` 落後時會改掃 `realtime_sales_monthly` 聚合,冷計算約 14 秒;修正為 source fingerprint 未變時延長共享快取有效期,匯入流程仍主動清除快取,避免資料未變卻反覆掃大表。 +- **PChome backfill pilot**: V10.328 diagnostics 欄位上線後先跑小批次,刷新過期 identity_v2 30 筆(11 筆成功更新)、高價未配對 15 筆全被低信心/單位價擋下;樣本確認多數 hard veto 正確,另補 `strong_component_line_match` 處理 Gennies 類同品牌完整多組件套組。 ### 2026-04-29:ADR-017 Phase 3f 模組化收尾啟動 - **DB metadata 救急**: `database/manager.py` 改為顯式載入 permission / AI / autoheal / import / vendor / realtime_sales ORM,PostgreSQL 初始化透過 process-local guard + advisory lock 執行 `Base.metadata.create_all()`,避免新環境漏表與一般流量重複碰 DDL。 diff --git a/services/marketplace_product_matcher.py b/services/marketplace_product_matcher.py index d43790f..48d783d 100644 --- a/services/marketplace_product_matcher.py +++ b/services/marketplace_product_matcher.py @@ -961,6 +961,18 @@ def score_marketplace_match( ): score += 0.07 reasons.append("strong_product_line_match") + if ( + brand_score >= 0.95 + and not hard_veto + and not reasons + and price_penalty == 0 + and type_score >= 0.95 + and token_score >= 0.82 + and spec_score >= 0.40 + and chinese_name_score >= 0.65 + ): + score += 0.04 + reasons.append("strong_component_line_match") if hard_veto: score = min(score, 0.74 if comparison_mode == "unit_comparable" else 0.32) score = max(0.0, min(1.0, score)) diff --git a/tests/test_marketplace_product_matcher.py b/tests/test_marketplace_product_matcher.py index adbac6b..590f530 100644 --- a/tests/test_marketplace_product_matcher.py +++ b/tests/test_marketplace_product_matcher.py @@ -321,6 +321,22 @@ def test_marketplace_matcher_normalizes_buy_get_pack_evidence(): assert "count_conflict" not in diagnostics.reasons +def test_marketplace_matcher_accepts_strong_multi_component_line_without_full_specs(): + from services.marketplace_product_matcher import score_marketplace_match + + diagnostics = score_marketplace_match( + "【Gennies 奇妮】COSVITAL乳頭霜50ml+滋潤彈力霜100ml+修復彈力霜100ml(金燦極緻法國頂級孕期產後保養組)", + "Gennies奇妮 COSVITAL 金燦極緻法國頂級保養(乳頭霜+滋潤彈力霜+修復彈力霜)(801062+801081+801082)", + momo_price=6980, + competitor_price=6980, + ) + + assert diagnostics.score >= 0.76 + assert diagnostics.hard_veto is False + assert diagnostics.comparison_mode == "exact_identity" + assert "strong_component_line_match" in diagnostics.reasons + + def test_marketplace_search_terms_prefer_readable_brand_core_spec(): from services.marketplace_product_matcher import build_search_terms