diff --git a/config.py b/config.py index 3cbae68..4aef3e8 100644 --- a/config.py +++ b/config.py @@ -325,7 +325,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.401" +SYSTEM_VERSION = "V10.402" 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 402f6ae..32c6883 100644 --- a/docs/memory/history_logs.md +++ b/docs/memory/history_logs.md @@ -13,6 +13,7 @@ ## 📅 詳細更新日誌 (考古存檔) ### 2026-05-24:PChome 近門檻身份回收第二輪 +- **V10.402 catalog variant identity-review 回收**: marketplace matcher 新增 Johnson’s 嬰兒潤膚乳 catalog 對同香型、IM MEME 涼感定妝噴霧、SO NATURAL FIXX 定妝噴霧三條 review-only focused identity,讓同品線 catalog / variant 候選可脫離 `true_low_confidence` 但只進 `identity_review`,不直接價格告警;同版明確保留 MUJI 品牌缺漏護手霜等 brandless catalog 案例在低信心,避免品牌缺漏與多款任選同時存在時被過度救回。 - **V10.401 focused identity 邊界整理**: 將 Laundrin TOKYO 車用夾式消臭芳香劑判定抽成 `_has_laundrin_tokyo_car_freshener_alignment()`,並在 variant descriptor guard 中豁免同一條強身份線,避免 TOKYO / 車用 / 芳香劑語序差異造成誤擋。Yuskin 經典乳霜 30g 6 入組改用 `_has_exact_count_alignment()` 判斷包數,保留 6入 vs 6盒這類同數量但不同容器字詞的人工覆核路徑。 - **V10.400 氣墊粉餅補充蕊包數正規化**: marketplace matcher 針對氣墊粉餅新增保守的 `cushion_refill_pack_alignment`,只在一側明確為 `一盒兩蕊 / 2蕊`、另一側為單規格 `15g x2` 這類乘數包裝時,解除 `multi_component_conflict` 並進 `identity_review`。CLIO 羽緻無限緞光氣墊粉餅「一盒兩蕊」可被同款覆核;`2盒4蕊` 對 `15g x2` 仍維持 hard veto。同版補香氛蠟燭、TOKYO 車用消臭芳香劑、融蠟燈與有機護膚油 search identity anchors。離線 audit 759 筆 accepted 從 753 提升到 754,剩餘 5 筆 fresh veto 皆為應擋的套組/品類差異。 - **V10.399 多香味 catalog 價格告警降級**: marketplace matcher 新增 `variant_selection_review`,當一側是無明確選項的商品線、另一側列出多個具名香味/款式選項時,允許同款身份回收但只進 `identity_review`,不直接進 `price_alert_exact`。首個正式案例是 HH 女性私密衣物抗菌手洗精 200ml 對 PChome 白麝香/清新花園/寶貝粉香多香味 listing;此規則避免把多香味 catalog 價格誤當單一 variant 精準比價。 diff --git a/services/marketplace_product_matcher.py b/services/marketplace_product_matcher.py index 9dac17f..8dfbe68 100644 --- a/services/marketplace_product_matcher.py +++ b/services/marketplace_product_matcher.py @@ -362,6 +362,9 @@ SEARCH_IDENTITY_ANCHORS = ( "晨霧純精油擴香儀", "天然植物香氛精油", "爆水擦澡濕巾", + "嬰兒潤膚乳", + "我愛超磁妝定妝噴霧", + "全天候超完美定妝噴霧", "香氛蠟燭20種香味", "tokyo車用夾式消臭芳香劑", "北歐簡樸融蠟燈桌面氣氛夜燈", @@ -459,6 +462,12 @@ SEARCH_IDENTITY_ANCHORS = ( "香氛機", ) +FOCUSED_IDENTITY_REVIEW_ONLY_REASONS = { + "johnsons_baby_lotion_variant_catalog", + "im_meme_fixx_cool_setting_spray", + "so_natural_fixx_setting_spray_catalog", +} + SEARCH_BROAD_ANCHORS = { "乳霜", "面霜", @@ -1842,6 +1851,8 @@ def score_marketplace_match( hard_veto = True focused_exact_line_reason = _has_focused_low_score_exact_identity_line(left, right) + if focused_exact_line_reason in FOCUSED_IDENTITY_REVIEW_ONLY_REASONS: + reasons.append("variant_selection_review") focused_exact_price_safe = ( focused_exact_line_reason and brand_score >= 0.95 @@ -2886,6 +2897,31 @@ def _has_focused_low_score_exact_identity_line(left: ProductIdentity, right: Pro and _has_exact_count_alignment(left, right) ): return "yuskin_classic_cream_30g_6pack" + if ( + {"johnson", "johnsons", "嬌生"} & (left.brand_tokens & right.brand_tokens) + and "嬰兒" in left_text + and "嬰兒" in right_text + and "潤膚乳" in left_text + and "潤膚乳" in right_text + and _has_shared_volume(left, right, 500) + and (not left.counts or not right.counts or _has_exact_count_alignment(left, right)) + and any(option in left_text and option in right_text for option in ("牛奶", "純淨", "甜夢", "溫和", "棉柔")) + ): + return "johnsons_baby_lotion_variant_catalog" + if ( + {"im meme", "meme"} & (left.brand_tokens & right.brand_tokens) + and "我愛超磁妝定妝噴霧" in left_text + and "我愛超磁妝定妝噴霧" in right_text + and "涼感" in left_text + and "涼感" in right_text + ): + return "im_meme_fixx_cool_setting_spray" + if ( + {"so", "natural", "fixx"} <= (left.brand_tokens & right.brand_tokens) + and "全天候超完美定妝噴霧" in left_text + and "全天候超完美定妝噴霧" in right_text + ): + return "so_natural_fixx_setting_spray_catalog" if ( "gatsby" in (left.brand_tokens & right.brand_tokens) and "爆水擦澡濕巾" in left_text diff --git a/tests/test_marketplace_product_matcher.py b/tests/test_marketplace_product_matcher.py index 661b511..046c6fd 100644 --- a/tests/test_marketplace_product_matcher.py +++ b/tests/test_marketplace_product_matcher.py @@ -859,6 +859,32 @@ def test_marketplace_matcher_keeps_named_scent_catalog_in_identity_review(): assert "variant_selection_review" in diagnostics.reasons +def test_marketplace_matcher_keeps_catalog_variant_recoveries_in_identity_review(): + from services.marketplace_product_matcher import score_marketplace_match + + cases = [ + ( + "【Johnsons 嬌生】嬰兒潤膚乳500ml_嬰兒乳液(牛奶/純淨/甜夢/溫和/棉柔_任選)", + "嬌生嬰兒甜夢潤膚乳500ml", + ), + ( + "【im meme】我愛超磁妝定妝噴霧60ml(涼感/一般)", + "【I’M MEME】我愛超磁妝定妝噴霧-涼感控油", + ), + ( + "【SO NATURAL】FIXX 全天候超完美定妝噴霧 經典款/光澤款/霧面款/夏日款", + "【SO NATURAL】FIXX 全天候超完美定妝噴霧 120ml", + ), + ] + + for momo_name, competitor_name in cases: + diagnostics = score_marketplace_match(momo_name, competitor_name) + assert diagnostics.score >= 0.76 + assert diagnostics.hard_veto is False + assert diagnostics.alert_tier == "identity_review" + assert "variant_selection_review" in diagnostics.reasons + + def test_marketplace_matcher_aligns_cushion_one_box_two_refills_with_spec_times_two(): from services.marketplace_product_matcher import score_marketplace_match @@ -1126,6 +1152,26 @@ def test_marketplace_matcher_promotes_focused_low_score_exact_identity_lines(): "【Yuskin悠斯晶】A乳霜 攜帶型 6盒組(30g/盒)", "focused_exact_identity_yuskin_classic_cream_30g_6pack", ), + ( + "【Johnsons 嬌生】嬰兒潤膚乳500ml_嬰兒乳液(牛奶/純淨/甜夢/溫和/棉柔_任選)", + "嬌生嬰兒甜夢潤膚乳500ml", + "focused_exact_identity_johnsons_baby_lotion_variant_catalog", + ), + ( + "【Johnsons 嬌生】嬰兒潤膚乳500mlx3(牛奶/純淨/甜夢/溫和/棉柔任選_嬰兒乳液)", + "嬌生嬰兒 純淨潤膚乳500mlx3", + "focused_exact_identity_johnsons_baby_lotion_variant_catalog", + ), + ( + "【im meme】我愛超磁妝定妝噴霧60ml(涼感/一般)", + "【I’M MEME】我愛超磁妝定妝噴霧-涼感控油", + "focused_exact_identity_im_meme_fixx_cool_setting_spray", + ), + ( + "【SO NATURAL】FIXX 全天候超完美定妝噴霧 經典款/光澤款/霧面款/夏日款", + "【SO NATURAL】FIXX 全天候超完美定妝噴霧 120ml", + "focused_exact_identity_so_natural_fixx_setting_spray_catalog", + ), ( "【GATSBY】爆水擦澡濕巾24張入(涼感乾洗澡)", "GATSBY 爆水擦澡濕巾24張入(240g)",