diff --git a/auto_reply.py b/auto_reply.py index 59cb45f..354ef4a 100644 --- a/auto_reply.py +++ b/auto_reply.py @@ -573,7 +573,14 @@ class AutoReply: # ⭐ 修复:阈值改为max(1,...),避免只有1个核心词时仍要求≥2个命中 # 例:"服务器最近有哪些公告啊?" 核心词={'公告'}(1个) # heading含'公告'(1/1)→ 通过(原max(2,...)要求≥2,会拒绝) - min_core_hits = max(1, (len(core_kw) + 1) // 2) + # ⭐ Task #1739: has_ht=True时放宽阈值(原50%过严) + # 例:"版号"查询→核心词={'版本号','登录','问问','定义'}(4个) + # 文档"## 0. 版本号区分:"只命中1个,但heading完全相关 + # 修复:当has_ht=True(标题已含核心词)时,只要求1个命中即可 + if has_ht: + min_core_hits = 1 + else: + min_core_hits = max(1, (len(core_kw) + 1) // 2) if core_hits < min_core_hits: logger.debug( f"多关键词覆盖不足跳过(防牛头不对马嘴): query={query[:40]!r} "