feat: show product identity in ai recommendations
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
ogt
2026-06-26 18:33:11 +08:00
parent 1dfeee0506
commit c268b5cc02
8 changed files with 226 additions and 25 deletions

View File

@@ -841,11 +841,22 @@ def test_ai_recommend_uses_v2_shell_and_runtime_category_data():
assert "ai-recommend-page" in template
assert "{% for category in product_categories[:4] %}" in template
assert "quickWebSearch({{ category|tojson }})" in template
assert "setProduct({{ category|tojson }})" in template
assert "quickWebSearch('保濕面膜')" not in template
assert "fetch('/api/ai/generate_copy'" in page_js
assert "fetch('/api/ai/web_search'" in page_js
assert "fetch('/api/ai/product_insights'" in page_js
assert "fetch('/api/ai/gemini_usage?days=30')" in page_js
assert "renderBestsellerCard" in page_js
assert "ar-product-card__img" in page_js
assert "待補圖片" in page_js
assert "商品 ID" in page_js
assert "開賣場" in page_js
assert "product_id: el.dataset.productId" in page_js
assert "Object.assign(window" in page_js
assert "setProductFromCard" in page_js
assert "商品 ID、圖片與賣場連結可一眼確認" in template
assert 'id="platformMomo" value="momo">' in template
assert "mock" not in template.lower()
assert "假商品" not in template
assert "PChome 銷售建議" in template
@@ -895,6 +906,8 @@ def test_ai_recommend_uses_v2_shell_and_runtime_category_data():
assert "@ai_bp.route('/api/ai/generate_copy'" in route_source
assert "@ai_bp.route('/api/ai/web_search'" in route_source
assert "@ai_bp.route('/api/ai/product_insights'" in route_source
assert "'product_id': p.product_id" in (ROOT / "services/pchome_crawler.py").read_text(encoding="utf-8")
assert "'product_id': p.product_id" in (ROOT / "services/momo_crawler.py").read_text(encoding="utf-8")
def test_monthly_summary_analysis_uses_v2_shell_and_real_monthly_api():