fix: 修复KB搜索回复内容不对和历史消息重复处理问题
问题1:回复内容不对 - protect.md的section heading包含整个section内容(含<br>和列表标记),导致下载意图加权检查误匹配 - 修复:增加检查,如果heading含<br>或列表标记,说明是复合标题,需检查下载是否出现在标题主体部分 问题2:历史消息重复处理 - 基线轮处理后seen.discard(item)从持久化集合中移除,但未重新加入_seen_messages - 修复:基线轮处理后增加self._seen_messages.add(item),确保下次轮询不再处理此消息
This commit is contained in:
+14
-2
@@ -875,8 +875,20 @@ class KnowledgeBase:
|
||||
# 修复"在哪儿能下到那登录插件啊?"被"插件设置"(body含"登录")压过,
|
||||
# 而真正的"## 4. 下载地址"section(3.93)排不进top3的问题
|
||||
# ⚠ 排除heading含"皮肤"的section(皮肤教程非插件下载)
|
||||
if (any(w in query_stripped for w in ('下载', '下到', '哪下', '怎么下'))
|
||||
and '下载' in heading_no_links and '皮肤' not in heading_no_links):
|
||||
# ⚠ 只检查真正的标题行:如果heading含<br>或列表标记,说明是复合标题,
|
||||
# 需检查"下载"是否出现在标题主体部分(<br>之前),而非列表项内容
|
||||
_download_match = False
|
||||
if any(w in query_stripped for w in ('下载', '下到', '哪下', '怎么下')):
|
||||
if '下载' in heading_no_links and '皮肤' not in heading_no_links:
|
||||
# 检查是否是纯标题(不含<br>或列表标记)
|
||||
if '<br>' not in heading and '- [' not in heading and '|-' not in heading:
|
||||
_download_match = True
|
||||
else:
|
||||
# 复合标题:检查标题主体部分(<br>或列表之前)是否含"下载"
|
||||
_title_part = re.split(r'<br>|- |\|-', heading_no_links)[0]
|
||||
if '下载' in _title_part:
|
||||
_download_match = True
|
||||
if _download_match:
|
||||
bonus += 8.0
|
||||
# ⭐ body 包含查询核心名词(如"密码")→ 巨幅 bonus
|
||||
core_nouns = {'密码', '用户管理', '领地', '商品', 'CDK', '工单', '债券', '在线'}
|
||||
|
||||
Reference in New Issue
Block a user