Package com.bytedesk.ai.service
Class KnowledgeBaseSearchHelper
java.lang.Object
com.bytedesk.ai.service.KnowledgeBaseSearchHelper
知识库检索与结果重排辅助类:
- 封装全文/向量检索及来源构造
- 提供聚合/去重/重排/TopK 能力
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ChunkElasticServiceprivate ChunkVectorServiceprivate FaqElasticServiceprivate FaqVectorServiceprivate TextElasticServiceprivate TextVectorServiceprivate WebpageElasticServiceprivate WebpageVectorService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteFulltextSearchWithSources(String query, String kbUid, List<FaqProtobuf> searchResultList, List<RobotContent.SourceReference> sourceReferences) 执行全文搜索并填充结果与来源引用voidexecuteVectorSearchWithSources(String query, String kbUid, List<FaqProtobuf> searchResultList, List<RobotContent.SourceReference> sourceReferences) 执行向量搜索并填充结果与来源引用private StringgetContentSummary(String content, int maxLength) 简单内容摘要rerankMergeTopK(SearchResultWithSources raw, RobotProtobuf robot) 聚合/去重/重排并TopK输出protected List<FaqProtobuf>searchKnowledgeBase(String query, RobotProtobuf robot) protected SearchResultWithSourcessearchKnowledgeBaseWithSources(String query, RobotProtobuf robot) 搜索知识库并收集源引用信息
-
Field Details
-
faqElasticService
-
textElasticService
-
chunkElasticService
-
webpageElasticService
-
faqVectorService
-
textVectorService
-
chunkVectorService
-
webpageVectorService
-
-
Constructor Details
-
KnowledgeBaseSearchHelper
public KnowledgeBaseSearchHelper()
-
-
Method Details
-
searchKnowledgeBase
-
searchKnowledgeBaseWithSources
搜索知识库并收集源引用信息- Parameters:
query- 查询内容robot- 机器人配置- Returns:
- 包含源引用信息的搜索结果
-
executeFulltextSearchWithSources
public void executeFulltextSearchWithSources(String query, String kbUid, List<FaqProtobuf> searchResultList, List<RobotContent.SourceReference> sourceReferences) 执行全文搜索并填充结果与来源引用 -
executeVectorSearchWithSources
public void executeVectorSearchWithSources(String query, String kbUid, List<FaqProtobuf> searchResultList, List<RobotContent.SourceReference> sourceReferences) 执行向量搜索并填充结果与来源引用 -
rerankMergeTopK
聚合/去重/重排并TopK输出 -
getContentSummary
简单内容摘要
-