fix(auto_reply): 修正核心词覆盖阈值计算
问题:当只有1个核心词时,min_core_hits = max(2, 1) = 2
要求覆盖≥2个核心词,导致'公告'类单词查询被误拒绝
根因:max(2,...)硬编码最低2个,但当core_kw只有1个元素时
无法覆盖2个,永远失败
修复:改为max(1,...),确保阈值合理
- core_kw={公告}(1个) → min=1 → 通过
- core_kw={草原,近期,公告}(3个) → min=2 → 仍需覆盖≥2个
关联:之前添加'最近'到non_core_kw使'公告'类查询核心词只剩1个,
暴露了这个隐藏bug
This commit is contained in:
+4
-1
@@ -240,7 +240,10 @@ class AutoReply:
|
|||||||
# sdf1.md只含"草原"(1/3)→ 拒绝
|
# sdf1.md只含"草原"(1/3)→ 拒绝
|
||||||
# index.md含"近期"+"公告"(2/3)→ 通过
|
# index.md含"近期"+"公告"(2/3)→ 通过
|
||||||
if len(core_kw) >= 2:
|
if len(core_kw) >= 2:
|
||||||
min_core_hits = max(2, (len(core_kw) + 1) // 2)
|
# ⭐ 修复:阈值改为max(1,...),避免只有1个核心词时仍要求≥2个命中
|
||||||
|
# 例:"服务器最近有哪些公告啊?" 核心词={'公告'}(1个)
|
||||||
|
# heading含'公告'(1/1)→ 通过(原max(2,...)要求≥2,会拒绝)
|
||||||
|
min_core_hits = max(1, (len(core_kw) + 1) // 2)
|
||||||
if core_hits < min_core_hits:
|
if core_hits < min_core_hits:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"多关键词覆盖不足跳过(防牛头不对马嘴): query={query[:40]!r} "
|
f"多关键词覆盖不足跳过(防牛头不对马嘴): query={query[:40]!r} "
|
||||||
|
|||||||
Reference in New Issue
Block a user