Fix: delete dataset also delete the link file entity (#20340)

This commit is contained in:
Wang Qi authored and GitHub committed 2026-09-29 11:50:53 +08:00
1 parent 71c3e5c5d7
commit 0a715d16e6
1 file changed
+1 -1
+1 -1
View File
@@ -404,7 +404,7 @@ func (d *DatasetService) deleteDataset(ctx context.Context, tenantID string, kb
return fmt.Errorf("delete dataset error for %s", kb.ID)
}
if len(fileIDs) > 0 {
if err := tx.Unscoped().Where("id IN ?", fileIDs).Delete(&entity.File{}).Error; err != nil {
if err := tx.Unscoped().Where("id IN ? AND source_type = ?", fileIDs, string(entity.FileSourceKnowledgebase)).Delete(&entity.File{}).Error; err != nil {
return fmt.Errorf("delete dataset error for %s", kb.ID)
}
}