From dcdef76f060ade28b40fc31998c171c98188e87f Mon Sep 17 00:00:00 2001 From: OoO Date: Mon, 1 Jun 2026 02:23:37 +0800 Subject: [PATCH] =?UTF-8?q?V10.536=20=E8=A3=9C=E9=AB=98=E5=88=86=20true=5F?= =?UTF-8?q?low=5Fconfidence=20focused=20exact?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO_NEXT_STEPS.txt | 1 + config.py | 2 +- docs/AI_INTELLIGENCE_MODULE_SOT.md | 1 + docs/memory/history_logs.md | 1 + services/marketplace_product_matcher.py | 80 +++++++++++++++++++++++ tests/test_marketplace_product_matcher.py | 35 ++++++++++ 6 files changed, 119 insertions(+), 1 deletion(-) diff --git a/TODO_NEXT_STEPS.txt b/TODO_NEXT_STEPS.txt index aa786fa..f52e061 100644 --- a/TODO_NEXT_STEPS.txt +++ b/TODO_NEXT_STEPS.txt @@ -4,6 +4,7 @@ ================================================================================ 【已完成】 + - V10.536 補 PChome 高分 `true_low_confidence` 安全救回線:新增花美水 Relax 薰衣草潤滑凝膠 1.7g x3、St.Clare 私密呼呼慕斯 x2 / 慕斯+噴霧組、BIOPEUTIC 果酸煥膚水凝乳 20% 150ml、台塑生醫嬰兒沐浴洗髮 3 件組、Elizabeth Arden 八小時護唇膏 SPF15 3.7g x3、理膚寶水全面修復潤唇膏 7.5ml focused total-price 規則;這些都要求同品牌、同品線與同規格/同組合,仍保留色號、香味、款式敏感品的 `variant_selection_review` 防線。 - V10.535 修 ElephantAlpha 價格 trigger statement timeout:`price_drop_alert` / `market_opportunity` / DB evidence prefetch 改為先篩最近有效 PChome identity_v2,再用 `JOIN LATERAL` 查單一 SKU 最新 MOMO 價格;保留 match_score/tags/diagnostic evidence,避免 scheduler 週期性重查整張 `price_records`。 - V10.534 收緊 PChome rescore accepted gate:`no_match / price_basis=none / alert_tier=suppress` 不得再進 `rescore_accepted_current`,並新增 `--retract-unsafe-accepted` 退回舊的 unsafe accepted rows;Dashboard / daily / growth / OpenClaw 文案改為「重算待人工覆核」,避免操作員把人工覆核隊列誤解為可直接採用或可自動寫價。 - V10.533 補 ElephantAlpha legacy OpenClaw advisory 相容:`generate_dynamic_pricing_strategy` 與既有 `generate_market_strategy` / `generate_resource_optimization_strategy` 一樣只記錄為 skipped,不再觸發 `Unrecognized step` 與 circuit breaker;避免舊協調器輸出的建議型動態定價步驟被誤解為真正可執行任務。 diff --git a/config.py b/config.py index a7ba352..a07fb9b 100644 --- a/config.py +++ b/config.py @@ -402,7 +402,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.535" +SYSTEM_VERSION = "V10.536" LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log') public_url = PUBLIC_URL # 用於模板顯示 diff --git a/docs/AI_INTELLIGENCE_MODULE_SOT.md b/docs/AI_INTELLIGENCE_MODULE_SOT.md index 8fb0513..fb19b49 100644 --- a/docs/AI_INTELLIGENCE_MODULE_SOT.md +++ b/docs/AI_INTELLIGENCE_MODULE_SOT.md @@ -99,6 +99,7 @@ SQL漏斗(~300筆) - PChome 低信心操作分流:Dashboard 與 read-only `/api/pchome-review/queue` 必須把近門檻可救、證據不足、低信心舊候選拆成 `recoverable_low_score`、`true_low_confidence`、`legacy_low_score` 三個可篩選桶;廣義 `low_score` 僅作 repository/export 相容查詢,不可在 UI 中冒充單一操作分流。 - PChome coverage 的 `attempt_status` / `rescore_accepted_count` / `actionable_review_count` 口徑必須與 review queue 對齊:統計「沒有新鮮有效 identity」的商品,而不是只統計「完全沒有 identity」的商品;已過期但可重算採用的 stale identity 仍應出現在待審數字中,避免 API 與 Dashboard 漏報。 - `run_retryable_candidate_revalidation()` 的自動回刷主戰場仍限 `low_score` / `refresh_low_score` / `recoverable_low_score`;`true_low_confidence` 只有在已補 focused exact 規則的窄範圍品線、舊分數 >= 0.95、`comparison_mode='exact_identity'`、含 `strong_exact_spec_match` 且不含 commercial / variant / count / bundle / refill 等阻擋理由時,才可進入重評,不得全面打開人工審核池。 +- 高分 `true_low_confidence` 的自動救回只能用具名 focused exact 線逐批擴充;同品牌、同品線、同規格/同組合的花美水 Relax、St.Clare 私密呼呼、BIOPEUTIC 果酸、台塑生醫嬰兒沐浴洗髮、Elizabeth Arden 八小時護唇膏與理膚寶水全面修復潤唇膏可走 total-price,色號、香味、款式、即期品與 catalog selection 仍維持 review / veto。 - `/api/ai/pchome-match/backfill/status` 必須把近門檻重評池與過期 identity 救援池以只讀 `revalidation_preview` / `stale_recovery_preview` 曝光給操作員;預覽只復用正式候選 SQL 並受 limit / 60 秒快取限制,不啟動 PChome 搜尋、不呼叫 LLM、不寫 `competitor_match_attempts` / `competitor_prices`。重評 preview 必須先從最新 `competitor_match_attempts` 縮小候選,再用 `JOIN LATERAL` 取單一最新 MOMO 價;救援 preview 必須從過期 `competitor_prices` 小集合出發並用 `JOIN LATERAL` 取最新 MOMO 價,兩者都不得掃全量 `price_records`;Dashboard 只能顯示「可救援」觀測值,不得在未開啟 `PCHOME_STALE_RECOVERY_ENABLED` 時提供 recover-stale 執行按鈕;其中 `review_gated_count` 僅代表窄門 `true_low_confidence` exact 候選,不得被解讀為全量人工池可自動回刷。 - PChome re-score audit 預設必須先取每個 SKU 的最新 `competitor_match_attempts` 狀態,再套用 status / reason 篩選;舊低信心歷史候選只能透過 `--include-historical-candidates` 明確進入考古掃描,避免已入隊、已否決或已修正 SKU 被舊紀錄重新推回報表。 - production re-score `--apply-accepted` 僅可追加 `rescore_accepted_current` attempt 給人工覆核;執行後需清除 Dashboard / competitor intel cache,且必須抽查 `competitor_prices` / `competitor_price_history` 未新增正式價差。 diff --git a/docs/memory/history_logs.md b/docs/memory/history_logs.md index a775cfc..3227dbf 100644 --- a/docs/memory/history_logs.md +++ b/docs/memory/history_logs.md @@ -13,6 +13,7 @@ ## 📅 詳細更新日誌 (考古存檔) ### 2026-06-01:PChome 比價新鮮度操作閉環 +- **V10.536 高分 true_low_confidence focused exact 救回**: production 抽樣顯示剩餘未覆蓋集中在 `identity_veto` 與 `true_low_confidence`,其中部分 1.0 分樣本是同品牌、同品線、同規格/同組合,但因多件組或護唇/私密護理類型辨識保守而停在 manual review。新增花美水 Relax、St.Clare 私密呼呼、BIOPEUTIC 果酸、台塑生醫嬰兒沐浴洗髮、Elizabeth Arden 八小時護唇膏、理膚寶水全面修復潤唇膏的 focused total-price 規則;不放寬 `MIN_MATCH_SCORE`,也不移除色號/香味/款式防線。 - **V10.535 ElephantAlpha price trigger 查詢瘦身**: 正式 scheduler 日誌顯示 `price_drop_alert` trigger 對整張 `price_records` 做 `DISTINCT ON` 最新價造成 statement timeout。`price_drop_alert`、`market_opportunity` 與 EA DB evidence prefetch 改為先篩最近有效 PChome identity_v2 競品,再用 `JOIN LATERAL` 只查該 SKU 最新 MOMO 價格,保留 match_score/tags/diagnostic evidence 給 Telegram HITL,不再用全表最新價子查詢。 - **V10.534 rescore accepted gate 收緊與語意修正**: 正式 96 筆 `rescore_accepted_current` 盤點顯示多數仍是 `manual_review / identity_review`,且有 2 筆 `no_match / none / suppress` 混入。收緊 `classify_match_attempt_row()`:`no_match`、`price_basis=none`、`alert_tier=suppress` 不得 gate pass;新增 `--retract-unsafe-accepted` 可把既有 unsafe accepted 退回 `true_low_confidence`。Dashboard / daily / growth / OpenClaw 文案改成「重算待人工覆核」,明確表示仍需人工確認身份後才可寫正式價差。 - **V10.533 ElephantAlpha legacy OpenClaw advisory 相容**: 正式 scheduler 日誌出現 `Unrecognized step: agent=openclaw action=generate_dynamic_pricing_strategy`,屬於舊協調器把建議型策略文字放進 execution plan。執行器現在將 `generate_dynamic_pricing_strategy` 納入既有 OpenClaw advisory no-op 清單,只記錄 skipped,不觸發 circuit breaker,也不轉成自動調價或外部呼叫。 diff --git a/services/marketplace_product_matcher.py b/services/marketplace_product_matcher.py index 8b66844..6ca69c7 100644 --- a/services/marketplace_product_matcher.py +++ b/services/marketplace_product_matcher.py @@ -489,10 +489,12 @@ FOCUSED_IDENTITY_REVIEW_ONLY_REASONS = { FOCUSED_IDENTITY_VARIANT_REVIEW_BYPASS_REASONS = { "artmis_cranberry_private_mousse_250ml", "artmis_witch_hazel_private_mousse_250ml", + "arden_eight_hour_lip_spf15_3_7g_3pack", "baan_baby_lip_original_strawberry_catalog", "dhc_olive_lip_1_5g", "frudia_honey_blueberry_lip_10g", "laroche_posay_lip_balm_4_7ml", + "laroche_posay_repair_lip_balm_7_5ml", "lush_sakura_body_spray", "sebamed_baby_lip_4_8g_2pack", "so_natural_fixx_setting_spray_120ml_plain", @@ -523,7 +525,14 @@ FOCUSED_IDENTITY_TOTAL_PRICE_REASONS = { "3w_clinic_collagen_foundation_50ml_2pack", "hanamisui_moisture_original_gel_1_7g_3pack", "hanamisui_inclear_private_gel_1_7g_3pack", + "hanamisui_relax_lavender_gel_1_7g_3pack", "the_ordinary_caffeine_egcg_30ml", + "st_clare_private_mousse_150ml_2pack", + "st_clare_private_mousse_spray_set", + "biopeutic_plus_aha_lotion_20_150ml", + "taisu_baby_bath_shampoo_3pc", + "arden_eight_hour_lip_spf15_3_7g_3pack", + "laroche_posay_repair_lip_balm_7_5ml", "kussen_baby_butt_cream_50ml_3pack", "bone_diffuser_gift_3pack", "selection1990_half_dome_wax_lamp_white", @@ -4534,6 +4543,77 @@ def _has_focused_low_score_exact_identity_line(left: ProductIdentity, right: Pro and _has_exact_count_alignment(left, right) ): return "hanamisui_inclear_private_gel_1_7g_3pack" + if ( + "花美水" in (left.brand_tokens & right.brand_tokens) + and "relax" in left_raw + and "relax" in right_raw + and "薰衣草" in left_text + and "薰衣草" in right_text + and "潤滑凝膠" in left_text + and "潤滑凝膠" in right_text + and _has_shared_weight(left, right, 1.7) + and _has_exact_count_alignment(left, right) + ): + return "hanamisui_relax_lavender_gel_1_7g_3pack" + if ( + ("聖克萊爾" in left_text and "聖克萊爾" in right_text) + and "私密呼呼溫和潔淨慕斯" in left_text + and "私密呼呼溫和潔淨慕斯" in right_text + and _has_shared_volume(left, right, 150) + and _has_exact_count_alignment(left, right) + ): + return "st_clare_private_mousse_150ml_2pack" + if ( + ("聖克萊爾" in left_text and "聖克萊爾" in right_text) + and "私密呼呼溫和潔淨慕斯" in left_text + and "私密呼呼溫和潔淨慕斯" in right_text + and "私密呼呼舒緩護理噴霧" in left_text + and "私密呼呼舒緩護理噴霧" in right_text + and _has_shared_volume(left, right, 150) + and _has_shared_volume(left, right, 50) + ): + return "st_clare_private_mousse_spray_set" + if ( + ("biopeutic" in (left.brand_tokens & right.brand_tokens) or ("葆療美" in left_text and "葆療美" in right_text)) + and "果酸煥膚水凝乳" in left_text + and "果酸煥膚水凝乳" in right_text + and "20%" in left_raw + and "20%" in right_raw + and _has_shared_volume(left, right, 150) + ): + return "biopeutic_plus_aha_lotion_20_150ml" + if ( + "台塑生醫" in left_text + and "台塑生醫" in right_text + and "嬰兒沐浴洗髮" in left_text + and "嬰兒沐浴洗髮" in right_text + and "3件組" in left_text + and "3件組" in right_text + and "嬰兒沐浴精" in left_text + and "嬰兒沐浴精" in right_text + and "嬰幼童洗髮精" in left_text + and "嬰幼童洗髮精" in right_text + ): + return "taisu_baby_bath_shampoo_3pc" + if ( + "雅頓" in left_text + and "雅頓" in right_text + and "八小時潤澤護唇膏" in left_text + and "八小時潤澤護唇膏" in right_text + and "spf15" in left_raw + and "spf15" in right_raw + and _has_shared_weight(left, right, 3.7) + and _has_exact_count_alignment(left, right) + ): + return "arden_eight_hour_lip_spf15_3_7g_3pack" + if ( + "理膚寶水" in left_text + and "理膚寶水" in right_text + and "全面修復潤唇膏" in left_text + and "全面修復潤唇膏" in right_text + and _has_shared_volume(left, right, 7.5) + ): + return "laroche_posay_repair_lip_balm_7_5ml" if ( "ordinary" 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 c810564..4111fa3 100644 --- a/tests/test_marketplace_product_matcher.py +++ b/tests/test_marketplace_product_matcher.py @@ -546,6 +546,41 @@ def test_marketplace_matcher_promotes_focused_exact_pack_rows_to_total_price(): "【花美水】Inclear櫻克麗兒私密淨化凝膠(1.7g*3支)/盒", "focused_exact_identity_hanamisui_inclear_private_gel_1_7g_3pack", ), + ( + "【花美水】Relax薰衣草潤滑凝膠(1.7g x 3支/盒)", + "【花美水】Relax - 薰衣草潤滑凝膠(1.7g*3支入)/盒", + "focused_exact_identity_hanamisui_relax_lavender_gel_1_7g_3pack", + ), + ( + "【St.Clare 聖克萊爾】私密呼呼溫和潔淨慕斯150mlx2入", + "St.Clare聖克萊爾 私密呼呼溫和潔淨慕斯150mlx2入", + "focused_exact_identity_st_clare_private_mousse_150ml_2pack", + ), + ( + "【St.Clare 聖克萊爾】私密呼呼溫和潔淨慕斯150ml+私密呼呼舒緩護理噴霧50ml", + "St.Clare聖克萊爾 私密呼呼溫和潔淨慕斯150ml+私密呼呼舒緩護理噴霧50ml", + "focused_exact_identity_st_clare_private_mousse_spray_set", + ), + ( + "【BIOPEUTIC 葆療美】PLUS+ 果酸煥膚水凝乳20%(150ml)", + "Biopeutic葆療美 PLUS+ 果酸煥膚水凝乳20% 150ml", + "focused_exact_identity_biopeutic_plus_aha_lotion_20_150ml", + ), + ( + "【台塑生醫】嬰兒沐浴洗髮超值3件組 嬰兒沐浴精*2+嬰幼童洗髮精*1", + "台塑生醫 嬰兒沐浴洗髮超值3件組(嬰兒沐浴精*2+嬰幼童洗髮精*1)", + "focused_exact_identity_taisu_baby_bath_shampoo_3pc", + ), + ( + "【Elizabeth Arden 伊麗莎白雅頓】八小時潤澤護唇膏SPF15(3.7gX3-專櫃公司貨)", + "ARDEN 雅頓 八小時潤澤護唇膏SPF15(3.7g)X3-百貨公司貨", + "focused_exact_identity_arden_eight_hour_lip_spf15_3_7g_3pack", + ), + ( + "【理膚寶水】全面修復潤唇膏7.5ml(多重修復)", + "理膚寶水 全面修復潤唇膏 7.5ml", + "focused_exact_identity_laroche_posay_repair_lip_balm_7_5ml", + ), ( "【The Ordinary】Caffeine Solution 咖啡因 + EGCG兒茶眼部配方30ml", "The Ordinary 5%咖啡因 + EGCG兒茶眼部配方 (30ml)",