diff --git a/config.py b/config.py index d0a4811..8ace58c 100644 --- a/config.py +++ b/config.py @@ -325,7 +325,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.384" +SYSTEM_VERSION = "V10.385" 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 1432d32..4db891c 100644 --- a/docs/memory/history_logs.md +++ b/docs/memory/history_logs.md @@ -13,6 +13,7 @@ ## 📅 詳細更新日誌 (考古存檔) ### 2026-05-21:瀏覽器測試守門與 PChome 熱路徑優化 +- **V10.385 Lactacyd / MAQuillAGE 櫃別同款比對**: Marketplace matcher 補強 Lactacyd 私密潔浴露多款任選長標與 PChome 短標同款放行,並橋接「資生堂東京櫃」與 `MAQuillAGE 心機彩妝` 在「心機星魅蜜光圈潤唇膏」上的櫃別/品牌 alias,避免真同款被 `brand_conflict` 擋掉。 - **V10.384 Karadium 無規格眼影棒同款放行**: Marketplace matcher 對 Karadium「閃亮珍珠眼影棒」新增品牌 + 強 identity anchor 加分,當 PChome 標題省略 1.4g 規格但品名/品牌高度一致、無變體衝突與 hard veto 時仍可進入 exact identity 告警候選,避免同款因規格缺字漏報。 - **V10.383 EA JSON fallback / EDM cache 自癒 / 比對別名補強**: Elephant Alpha 協調器現在可容忍 fenced JSON 與混文字 JSON;若仍無法解析,會改用 DB/Hermes 實證產生保守人工覆核決策,不再輸出舊式 OpenClaw 策略 plan 或自動調價暗示。EDM promo dashboard shared cache 遇到損毀 pickle 會自動刪除並重建,避免每個 worker 重複噴 `UnicodeDecodeError`。Marketplace matcher 補上 Curel/珂潤、Karadium 與兩個強 identity anchor 測試,降低真同款漏報。 - **V10.382 唇膏 exact identity 寬價差豁免**: marketplace matcher 對「同品牌 + 共享唇膏 identity anchor + 規格完全一致 + 無色號/變體衝突」的唇膏類商品,允許 sequence score 略低時仍套用 `price_penalty_suppressed_wide_exact_identity`;這只處理 PChome/MOMO 標題順序與行銷字差異造成的真同款漏報,不放寬顯性色號不同的 hard veto。 diff --git a/services/marketplace_product_matcher.py b/services/marketplace_product_matcher.py index 88de9a3..db2acc8 100644 --- a/services/marketplace_product_matcher.py +++ b/services/marketplace_product_matcher.py @@ -972,6 +972,17 @@ def _brand_score(left: ProductIdentity, right: ProductIdentity) -> tuple[float, return 0.55, False, None if left.brand_tokens & right.brand_tokens: return 1.0, False, None + maquillage_anchor = "心機星魅蜜光圈潤唇膏" + left_has_shiseido = bool({"shiseido", "資生堂"} & left.brand_tokens) + right_has_shiseido = bool({"shiseido", "資生堂"} & right.brand_tokens) + left_has_maquillage = bool({"maquillage", "心機彩妝"} & left.brand_tokens) + right_has_maquillage = bool({"maquillage", "心機彩妝"} & right.brand_tokens) + if ( + maquillage_anchor in left.normalized_name + and maquillage_anchor in right.normalized_name + and ((left_has_shiseido and right_has_maquillage) or (right_has_shiseido and left_has_maquillage)) + ): + return 1.0, False, None return 0.0, True, "brand_conflict" @@ -1814,6 +1825,20 @@ def score_marketplace_match( ): score += 0.09 reasons.append("shared_identity_anchor_recipe_box_line") + if ( + "私密潔浴露" in shared_anchor + and {"lactacyd", "立朵舒"} & (left.brand_tokens | right.brand_tokens) + and brand_score >= 0.95 + and not hard_veto + and price_penalty == 0 + and type_score >= 0.95 + and spec_score >= 0.70 + and token_score >= 0.35 + and sequence_score >= 0.50 + and not variant_descriptor_conflict + ): + score += 0.10 + reasons.append("shared_identity_anchor_lactacyd_wash") if ( "閃亮珍珠眼影棒" in shared_anchor and {"karadium"} <= (left.brand_tokens | right.brand_tokens) diff --git a/tests/test_marketplace_product_matcher.py b/tests/test_marketplace_product_matcher.py index f60ae66..0a25fdd 100644 --- a/tests/test_marketplace_product_matcher.py +++ b/tests/test_marketplace_product_matcher.py @@ -578,6 +578,36 @@ def test_marketplace_matcher_promotes_karadium_pearl_shadow_stick_without_spec_t assert "shared_identity_anchor_karadium_eye_stick" in diagnostics.reasons +def test_marketplace_matcher_promotes_lactacyd_private_wash_multi_option_title(): + from services.marketplace_product_matcher import score_marketplace_match + + diagnostics = score_marketplace_match( + "【Lactacyd 立朵舒】柔軟滋潤/亮肌柔滑/加倍修護/全日清爽/生理呵護/滋潤緊緻 私密潔浴露250ml/瓶(多款任選)原廠公司貨_樂齡生醫", + "Lactacyd 立朵舒 私密潔浴露 多款任選(250ml/入)X1入", + momo_price=299, + competitor_price=299, + ) + + assert diagnostics.score >= 0.76 + assert diagnostics.hard_veto is False + assert "shared_identity_anchor_lactacyd_wash" in diagnostics.reasons + + +def test_marketplace_matcher_bridges_maquillage_shiseido_counter_alias(): + from services.marketplace_product_matcher import score_marketplace_match + + diagnostics = score_marketplace_match( + "【資生堂東京櫃】MAQuillAGE 心機星魅蜜光圈潤唇膏N", + "【MAQuillAGE 心機彩妝】心機星魅蜜光圈潤唇膏N", + momo_price=850, + competitor_price=850, + ) + + assert diagnostics.score >= 0.76 + assert diagnostics.hard_veto is False + assert "brand_conflict" not in diagnostics.reasons + + def test_marketplace_matcher_rejects_refill_core_vs_case_only_pack(): from services.marketplace_product_matcher import score_marketplace_match