Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
liqiang-fit2cloud committed Mar 21, 2024
2 parents bf3d06e + 13643bf commit 41151cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/dataset/serializers/document_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,15 @@ 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)
self.is_valid(raise_exception=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
Expand Down

0 comments on commit 41151cb

Please sign in to comment.