diff --git a/apps/dataset/serializers/document_serializers.py b/apps/dataset/serializers/document_serializers.py index 8a0979c8e49..62bff658e13 100644 --- a/apps/dataset/serializers/document_serializers.py +++ b/apps/dataset/serializers/document_serializers.py @@ -578,6 +578,7 @@ def batch_sync(self, instance: Dict, with_valid=True): instance.get('id_list')) return True + @transaction.atomic def batch_delete(self, instance: Dict, with_valid=True): if with_valid: BatchSerializer(data=instance).is_valid(model=Document, raise_exception=True) @@ -585,7 +586,7 @@ def batch_delete(self, instance: Dict, with_valid=True): document_id_list = instance.get("id_list") QuerySet(Document).filter(id__in=document_id_list).delete() QuerySet(Paragraph).filter(document_id__in=document_id_list).delete() - QuerySet(Problem).filter(document_id__in=document_id_list).delete() + QuerySet(ProblemParagraphMapping).filter(document_id__in=document_id_list).delete() # 删除向量库 ListenerManagement.delete_embedding_by_document_list_signal.send(document_id_list) return True