Merge remote-tracking branch 'wizard/master'

This commit is contained in:
wizardchen
2025-11-21 10:35:27 +08:00
32 changed files with 2078 additions and 757 deletions
+2
View File
@@ -37,6 +37,8 @@ type ChunkRepository interface {
DeleteChunksByKnowledgeID(ctx context.Context, tenantID uint, knowledgeID string) error
// DeleteByKnowledgeList deletes all chunks for a knowledge list
DeleteByKnowledgeList(ctx context.Context, tenantID uint, knowledgeIDs []string) error
// CountChunksByKnowledgeBaseID counts the number of chunks in a knowledge base.
CountChunksByKnowledgeBaseID(ctx context.Context, tenantID uint, kbID string) (int64, error)
}
// ChunkService defines the interface for chunk service operations
+2
View File
@@ -102,4 +102,6 @@ type KnowledgeRepository interface {
// AminusB returns the difference set of A and B.
AminusB(ctx context.Context, Atenant uint, A string, Btenant uint, B string) ([]string, error)
UpdateKnowledgeColumn(ctx context.Context, id string, column string, value interface{}) error
// CountKnowledgeByKnowledgeBaseID counts the number of knowledge items in a knowledge base.
CountKnowledgeByKnowledgeBaseID(ctx context.Context, tenantID uint, kbID string) (int64, error)
}
+4
View File
@@ -69,6 +69,10 @@ type KnowledgeBase struct {
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
// Deletion time of the knowledge base
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
// Knowledge count (not stored in database, calculated on query)
KnowledgeCount int64 `yaml:"knowledge_count" json:"knowledge_count" gorm:"-"`
// Chunk count (not stored in database, calculated on query)
ChunkCount int64 `yaml:"chunk_count" json:"chunk_count" gorm:"-"`
}
// KnowledgeBaseConfig represents the knowledge base configuration