refactor: simplify document deletion logic and remove redundant chunk handling
This commit is contained in:
@@ -120,10 +120,6 @@ func (s *index) IndexFAQByID(ctx context.Context, faqID int64) error {
|
||||
|
||||
func (s *index) RemoveDocumentIndex(ctx context.Context, documentID int64) error {
|
||||
chunks := repositories.KnowledgeChunkRepository.FindByDocumentID(sqls.DB(), documentID)
|
||||
return s.RemoveDocumentIndexByChunks(ctx, documentID, chunks)
|
||||
}
|
||||
|
||||
func (s *index) RemoveDocumentIndexByChunks(ctx context.Context, documentID int64, chunks []models.KnowledgeChunk) error {
|
||||
if len(chunks) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user