This commit is contained in:
@@ -325,7 +325,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
|
||||
# ==========================================
|
||||
# 系統版本與路徑
|
||||
# ==========================================
|
||||
SYSTEM_VERSION = "V10.370"
|
||||
SYSTEM_VERSION = "V10.371"
|
||||
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
|
||||
public_url = PUBLIC_URL # 用於模板顯示
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
## 📅 詳細更新日誌 (考古存檔)
|
||||
|
||||
### 2026-05-21:瀏覽器測試守門與 PChome 熱路徑優化
|
||||
- **V10.371 品牌缺失同款放行**: marketplace matcher 新增 `brandless_exact_identity` 加分,只限「一側有品牌、一側缺品牌」但 shared identity anchor 夠長、規格/序列/中文名相似度都高且無 hard veto 的案例;覆蓋小米有品小浪智能感應自動噴香機,讓 PChome 標題省略品牌時仍可進入同款告警候選。
|
||||
- **V10.370 Gemini runtime sentinel**: AI automation smoke 新增 `Gemini 出站費用 sentinel`,每天檢查近 24h `ai_calls.provider='gemini'` 的 calls/tokens/cost/top callers;若 `GEMINI_API_HARD_DISABLED=true` 仍有 Gemini 記錄,smoke 直接升為 critical。scheduler 09:10 摘要推播前會先執行一次只讀 smoke,讓 Gemini 費用異常不再依賴人工打開 `/ai_automation_smoke` 才被發現。
|
||||
- **V10.369 Gemini 防復發測試與極端價差同款放行**: 新增靜態測試禁止 production code 在 `services.gemini_guard` / `config.py` 之外直接讀 `GEMINI_API_KEY`,並要求所有 Gemini SDK/REST 出站點必須經 `get_gemini_api_key()`;比價 matcher 針對「同品牌 + 明確 identity anchor + 規格完全一致」但競品價格極端偏低的原生露/眉筆案例抑制價格懲罰,避免真同款因價格差被錯降級,同時補回既有 hard-veto 安全斷言。
|
||||
- **V10.368 比價搜尋錨點強化**: marketplace matcher 補 LUDEYA 蜂王玫瑰外泌微臻霜、雅詩蘭黛微分子肌底原生露、Za / PERIPERA 眉筆眉彩等低信心邊界品牌的 identity anchor,並把「兩入組 / 任選色號 / 多色可選 / 櫻花輕盈版」歸為搜尋噪音,讓 MOMO → PChome 搜尋詞更聚焦於同款身份與規格,不被包裝組合或色號選項帶偏。
|
||||
|
||||
@@ -1716,6 +1716,22 @@ def score_marketplace_match(
|
||||
):
|
||||
score += 0.05
|
||||
reasons.append("shared_variant_descriptor_alignment")
|
||||
if (
|
||||
shared_anchor
|
||||
and len(shared_anchor.replace(" ", "")) >= 8
|
||||
and not hard_veto
|
||||
and price_penalty == 0
|
||||
and brand_score == 0.55
|
||||
and bool(left.brand_tokens) != bool(right.brand_tokens)
|
||||
and type_score >= 0.55
|
||||
and spec_score >= 0.55
|
||||
and token_score >= 0.80
|
||||
and sequence_score >= 0.80
|
||||
and chinese_name_score >= 0.42
|
||||
and not variant_descriptor_conflict
|
||||
):
|
||||
score += 0.09
|
||||
reasons.append("brandless_exact_identity")
|
||||
if (
|
||||
shared_anchor
|
||||
and len(shared_anchor.replace(" ", "")) >= 6
|
||||
|
||||
@@ -442,6 +442,20 @@ def test_marketplace_matcher_ignores_generic_variant_noise_for_peripera_brow_pen
|
||||
assert diagnostics.score < 0.76
|
||||
|
||||
|
||||
def test_marketplace_matcher_promotes_brandless_exact_identity_when_anchor_is_strong():
|
||||
from services.marketplace_product_matcher import score_marketplace_match
|
||||
|
||||
diagnostics = score_marketplace_match(
|
||||
"【小米有品】小浪智能感應自動噴香機(三種噴香模式 霧化噴香 芳香除臭)",
|
||||
"小浪智能感應自動噴香機 三種噴香模式 霧化噴香 芳香除臭 芳香劑 去異味",
|
||||
momo_price=539,
|
||||
competitor_price=539,
|
||||
)
|
||||
|
||||
assert diagnostics.score >= 0.76
|
||||
assert "brandless_exact_identity" in diagnostics.reasons
|
||||
|
||||
|
||||
def test_marketplace_matcher_rejects_same_count_different_unit_family():
|
||||
from services.marketplace_product_matcher import score_marketplace_match
|
||||
|
||||
|
||||
Reference in New Issue
Block a user