feat: 增强FAQ搜索功能,支持指定搜索字段(标准问题/相似问法/答案)

This commit is contained in:
wizardchen
2025-12-24 13:11:54 +08:00
parent e45b82e9be
commit 0bbd1450cc
10 changed files with 36 additions and 14 deletions
+2
View File
@@ -19,6 +19,7 @@ type ChunkRepository interface {
// ListPagedChunksByKnowledgeID lists paged chunks by knowledge id.
// When tagID is non-empty, results are filtered by tag_id.
// sortOrder: "asc" for time ascending (updated_at ASC), default is time descending (updated_at DESC)
// searchField: specifies which field to search in (for FAQ: "standard_question", "similar_questions", "answers", "" for all)
ListPagedChunksByKnowledgeID(
ctx context.Context,
tenantID uint64,
@@ -27,6 +28,7 @@ type ChunkRepository interface {
chunkType []types.ChunkType,
tagID string,
keyword string,
searchField string,
sortOrder string,
) ([]*types.Chunk, int64, error)
ListChunkByParentID(ctx context.Context, tenantID uint64, parentID string) ([]*types.Chunk, error)
+2
View File
@@ -74,6 +74,7 @@ type KnowledgeService interface {
UpdateImageInfo(ctx context.Context, knowledgeID string, chunkID string, imageInfo string) error
// ListFAQEntries lists FAQ entries under a FAQ knowledge base.
// When tagID is non-empty, results are filtered by tag_id on FAQ chunks.
// searchField: specifies which field to search in ("standard_question", "similar_questions", "answers", "" for all)
// sortOrder: "asc" for time ascending (updated_at ASC), default is time descending (updated_at DESC)
ListFAQEntries(
ctx context.Context,
@@ -81,6 +82,7 @@ type KnowledgeService interface {
page *types.Pagination,
tagID string,
keyword string,
searchField string,
sortOrder string,
) (*types.PageResult, error)
// UpsertFAQEntries imports or appends FAQ entries asynchronously.