fix: 移除功效词默认兜底,品牌方未配置则不检查
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0b3dfa3c52
commit
f392c514cd
@ -38,8 +38,7 @@ router = APIRouter(prefix="/scripts", tags=["scripts"])
|
|||||||
# 内置违禁词库(广告极限词)
|
# 内置违禁词库(广告极限词)
|
||||||
ABSOLUTE_WORDS = ["最好", "第一", "最佳", "绝对", "100%"]
|
ABSOLUTE_WORDS = ["最好", "第一", "最佳", "绝对", "100%"]
|
||||||
|
|
||||||
# 默认功效词库(品牌方未配置时的兜底)
|
# 功效词从品牌方规则库加载(category="功效词"),未配置则不检查
|
||||||
DEFAULT_EFFICACY_WORDS = ["根治", "治愈", "治疗", "药效", "疗效", "特效"]
|
|
||||||
|
|
||||||
# 广告语境关键词(用于判断是否为广告场景)
|
# 广告语境关键词(用于判断是否为广告场景)
|
||||||
AD_CONTEXT_KEYWORDS = ["产品", "购买", "销量", "品质", "推荐", "价格", "优惠", "促销"]
|
AD_CONTEXT_KEYWORDS = ["产品", "购买", "销量", "品质", "推荐", "价格", "优惠", "促销"]
|
||||||
@ -283,10 +282,8 @@ async def review_script(
|
|||||||
# 获取品牌方配置的所有规则数据
|
# 获取品牌方配置的所有规则数据
|
||||||
whitelist = await get_whitelist_for_brand(x_tenant_id, request.brand_id, db)
|
whitelist = await get_whitelist_for_brand(x_tenant_id, request.brand_id, db)
|
||||||
all_tenant_words = await get_forbidden_words_for_tenant(x_tenant_id, db)
|
all_tenant_words = await get_forbidden_words_for_tenant(x_tenant_id, db)
|
||||||
# 分离功效词和普通违禁词
|
# 分离功效词和普通违禁词(品牌方未配置功效词则不检查)
|
||||||
efficacy_words = [w["word"] for w in all_tenant_words if w.get("category") == "功效词"]
|
efficacy_words = [w["word"] for w in all_tenant_words if w.get("category") == "功效词"]
|
||||||
if not efficacy_words:
|
|
||||||
efficacy_words = list(DEFAULT_EFFICACY_WORDS)
|
|
||||||
tenant_forbidden_words = [w for w in all_tenant_words if w.get("category") != "功效词"]
|
tenant_forbidden_words = [w for w in all_tenant_words if w.get("category") != "功效词"]
|
||||||
competitors = await get_competitors_for_brand(x_tenant_id, request.brand_id, db)
|
competitors = await get_competitors_for_brand(x_tenant_id, request.brand_id, db)
|
||||||
db_platform_rules = await get_active_platform_rules(
|
db_platform_rules = await get_active_platform_rules(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user