修复KB搜索牛头不对马嘴:动作查询要求标题和正文都含核心词

This commit is contained in:
youpaishidifu
2026-08-12 12:00:21 +08:00
parent 1738daffec
commit 091cac6781
+3 -3
View File
@@ -133,11 +133,11 @@ class AutoReply:
has_ht = bool(q_mean & ht_tokens)
has_body = bool(q_mean & body_tokens)
# 动作/配置类查询:不能只命中标题,正文必须也含核心词
# 动作/配置类查询:标题和正文都必须含核心词,防止"牛头不对马嘴"误匹配
action_kw = {"怎么", "如何", "使用", "配置", "修改", "设置", "安装", "用法", "操作"}
if (q_mean & action_kw) and not has_body:
if (q_mean & action_kw) and not (has_ht and has_body):
logger.debug(
f"动作查询正文相关性不足: query={query[:40]!r} "
f"动作查询相关性不足: query={query[:40]!r} "
f"heading_hit={has_ht} body_hit={has_body}"
)
return False