V10.403 widen retryable PChome revalidation
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
OoO
2026-05-24 12:54:00 +08:00
committed by AiderHeal Bot
parent 56f787351a
commit b2dbf98c3b
4 changed files with 29 additions and 7 deletions

View File

@@ -1006,12 +1006,12 @@ class CompetitorPriceFeeder:
def _fetch_retryable_candidate_skus(self, limit: int = 80, min_score: float = 0.70) -> list:
"""
取得近門檻且非 hard veto 的候選,供 matcher 升級後重新評分。
取得近門檻候選,供 matcher 升級後重新評分。
這條路徑不重新搜尋,只用前次留下的 PChome product_id 批次查詢最新商品資料,
適合把舊 scorer 卡在 0.70~0.759 的真同款重新推進正式比價。
僅重跑明顯仍在 exact identity 軌道內、具回收價值的候選;
真正低信心與 hard veto 不再反覆空轉
僅重跑明顯有回收價值的候選;最後仍由現行 matcher 重新判斷,
不因舊 attempt_status 自動寫入正式比價
"""
if self.engine is None:
raise RuntimeError("需要注入 SQLAlchemy engine")
@@ -1064,11 +1064,22 @@ class CompetitorPriceFeeder:
AND COALESCE(cp.tags, '[]'::jsonb) ? 'identity_v2'
WHERE lm.rn = 1
AND cp.sku IS NULL
AND la.attempt_status IN ('low_score', 'refresh_low_score', 'recoverable_low_score')
AND la.attempt_status IN (
'low_score',
'refresh_low_score',
'recoverable_low_score',
'true_low_confidence',
'unit_comparable',
'refresh_unit_comparable',
'identity_veto'
)
AND la.best_competitor_product_id IS NOT NULL
AND la.best_competitor_product_id <> ''
AND COALESCE(la.best_match_score, 0) >= :min_score
AND COALESCE(la.hard_veto, false) = false
AND (
COALESCE(la.hard_veto, false) = false
OR la.attempt_status = 'identity_veto'
)
ORDER BY la.best_match_score DESC NULLS LAST, lm.momo_price DESC NULLS LAST, lm.sku
LIMIT :limit
""")