feat: 支持FAQ两级优先级标签过滤
添加FAQ搜索支持两级优先级标签过滤功能,新增first_priority_tag_ids和second_priority_tag_ids字段,更新各检索器实现以支持按标签ID过滤,优化搜索结果排序确保优先级标签结果优先展示。
This commit is contained in:
@@ -35,5 +35,6 @@ type IndexInfo struct {
|
||||
KnowledgeID string // ID of the knowledge
|
||||
KnowledgeBaseID string // ID of the knowledge base
|
||||
KnowledgeType string // Type of the knowledge (e.g., "faq", "manual")
|
||||
TagID string // Tag ID for categorization (used for FAQ priority filtering)
|
||||
IsEnabled bool // Whether the chunk is enabled for retrieval
|
||||
}
|
||||
|
||||
@@ -223,9 +223,11 @@ type FAQBatchUpsertPayload struct {
|
||||
|
||||
// FAQSearchRequest FAQ检索请求参数
|
||||
type FAQSearchRequest struct {
|
||||
QueryText string `json:"query_text" binding:"required"`
|
||||
VectorThreshold float64 `json:"vector_threshold"`
|
||||
MatchCount int `json:"match_count"`
|
||||
QueryText string `json:"query_text" binding:"required"`
|
||||
VectorThreshold float64 `json:"vector_threshold"`
|
||||
MatchCount int `json:"match_count"`
|
||||
FirstPriorityTagIDs []string `json:"first_priority_tag_ids"` // 第一优先级标签ID列表,限定命中范围,优先级最高
|
||||
SecondPriorityTagIDs []string `json:"second_priority_tag_ids"` // 第二优先级标签ID列表,限定命中范围,优先级低于第一优先级
|
||||
}
|
||||
|
||||
// UntaggedTagID is the special tag ID representing uncategorized entries
|
||||
|
||||
@@ -32,6 +32,8 @@ type RetrieveParams struct {
|
||||
KnowledgeBaseIDs []string
|
||||
// Knowledge IDs
|
||||
KnowledgeIDs []string
|
||||
// Tag IDs for filtering (used for FAQ priority filtering)
|
||||
TagIDs []string
|
||||
// Excluded knowledge IDs
|
||||
ExcludeKnowledgeIDs []string
|
||||
// Excluded chunk IDs
|
||||
@@ -72,6 +74,8 @@ type IndexWithScore struct {
|
||||
KnowledgeID string
|
||||
// Knowledge base ID
|
||||
KnowledgeBaseID string
|
||||
// Tag ID
|
||||
TagID string
|
||||
// Score
|
||||
Score float64
|
||||
// Match type
|
||||
|
||||
@@ -98,6 +98,7 @@ type SearchParams struct {
|
||||
DisableKeywordsMatch bool `json:"disable_keywords_match"`
|
||||
DisableVectorMatch bool `json:"disable_vector_match"`
|
||||
KnowledgeIDs []string `json:"knowledge_ids"`
|
||||
TagIDs []string `json:"tag_ids"` // Tag IDs for filtering (used for FAQ priority filtering)
|
||||
}
|
||||
|
||||
// Value implements the driver.Valuer interface, used to convert SearchResult to database value
|
||||
|
||||
Reference in New Issue
Block a user