feat(knowledge): 新增问答段落相似度阈值

为知识库问答中的段落检索增加相似度阈值过滤功能。

此前,即使相似度很低的段落也会被返回,可能导致问答结果不准确。通过新增 `qa_paragraph_threshold` 配置项,可以过滤掉低于设定阈值的段落,从而提高问答的精准度和相关性。
This commit is contained in:
tt-P607
2025-10-18 23:17:24 +08:00
parent 22ef271c89
commit 2bb7e51252
3 changed files with 5 additions and 1 deletions

View File

@@ -88,6 +88,8 @@ class QAManager:
else:
logger.info("未找到相关关系,将使用文段检索结果")
result = paragraph_search_res
if result and result[0][1] < global_config.lpmm_knowledge.qa_paragraph_threshold:
result = []
ppr_node_weights = None
# 过滤阈值