feat: 增强知识库搜索功能,支持多知识库和指定文件ID搜索;优化SearchKnowledgeRequest结构,向后兼容单知识库ID参数
This commit is contained in:
@@ -65,12 +65,27 @@ func (c *ChatManage) Clone() *ChatManage {
|
||||
knowledgeIDs := make([]string, len(c.KnowledgeIDs))
|
||||
copy(knowledgeIDs, c.KnowledgeIDs)
|
||||
|
||||
// Deep copy search targets slice
|
||||
searchTargets := make(SearchTargets, len(c.SearchTargets))
|
||||
for i, t := range c.SearchTargets {
|
||||
if t != nil {
|
||||
kidsCopy := make([]string, len(t.KnowledgeIDs))
|
||||
copy(kidsCopy, t.KnowledgeIDs)
|
||||
searchTargets[i] = &SearchTarget{
|
||||
Type: t.Type,
|
||||
KnowledgeBaseID: t.KnowledgeBaseID,
|
||||
KnowledgeIDs: kidsCopy,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &ChatManage{
|
||||
Query: c.Query,
|
||||
RewriteQuery: c.RewriteQuery,
|
||||
SessionID: c.SessionID,
|
||||
KnowledgeBaseIDs: knowledgeBaseIDs,
|
||||
KnowledgeIDs: knowledgeIDs,
|
||||
SearchTargets: searchTargets,
|
||||
VectorThreshold: c.VectorThreshold,
|
||||
KeywordThreshold: c.KeywordThreshold,
|
||||
EmbeddingTopK: c.EmbeddingTopK,
|
||||
@@ -101,6 +116,7 @@ func (c *ChatManage) Clone() *ChatManage {
|
||||
RewritePromptUser: c.RewritePromptUser,
|
||||
EnableRewrite: c.EnableRewrite,
|
||||
EnableQueryExpansion: c.EnableQueryExpansion,
|
||||
TenantID: c.TenantID,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ type SessionService interface {
|
||||
// KnowledgeQAByEvent performs knowledge-based question answering by event
|
||||
KnowledgeQAByEvent(ctx context.Context, chatManage *types.ChatManage, eventList []types.EventType) error
|
||||
// SearchKnowledge performs knowledge-based search, without summarization
|
||||
SearchKnowledge(ctx context.Context, knowledgeBaseID, query string) ([]*types.SearchResult, error)
|
||||
// knowledgeBaseIDs: list of knowledge base IDs to search (supports multi-KB)
|
||||
// knowledgeIDs: list of specific knowledge (file) IDs to search
|
||||
SearchKnowledge(ctx context.Context, knowledgeBaseIDs []string, knowledgeIDs []string, query string) ([]*types.SearchResult, error)
|
||||
// AgentQA performs agent-based question answering with conversation history and streaming support
|
||||
// eventBus is optional - if nil, uses service's default EventBus
|
||||
AgentQA(
|
||||
|
||||
Reference in New Issue
Block a user