@@ -248,11 +248,11 @@ def put(self, request: Request, workspace_id: str, knowledge_id: str):
248248 'knowledge_id' : knowledge_id , 'workspace_id' : workspace_id }
249249 ).batch_cancel (request .data ))
250250
251- class Batch (APIView ):
251+ class BatchCreate (APIView ):
252252 authentication_classes = [TokenAuth ]
253253
254254 @extend_schema (
255- methods = ['POST ' ],
255+ methods = ['PUT ' ],
256256 description = _ ('Create documents in batches' ),
257257 summary = _ ('Create documents in batches' ),
258258 operation_id = _ ('Create documents in batches' ),
@@ -265,11 +265,14 @@ class Batch(APIView):
265265 PermissionConstants .DOCUMENT_CREATE .get_workspace_permission (),
266266 PermissionConstants .DOCUMENT_EDIT .get_workspace_permission (),
267267 ])
268- def post (self , request : Request , workspace_id : str , knowledge_id : str ):
268+ def put (self , request : Request , workspace_id : str , knowledge_id : str ):
269269 return result .success (DocumentSerializers .Batch (
270270 data = {'knowledge_id' : knowledge_id , 'workspace_id' : workspace_id }
271271 ).batch_save (request .data ))
272272
273+ class BatchSync (APIView ):
274+ authentication_classes = [TokenAuth ]
275+
273276 @extend_schema (
274277 methods = ['PUT' ],
275278 description = _ ('Batch sync documents' ),
@@ -289,8 +292,11 @@ def put(self, request: Request, workspace_id: str, knowledge_id: str):
289292 data = {'knowledge_id' : knowledge_id , 'workspace_id' : workspace_id }
290293 ).batch_sync (request .data ))
291294
295+ class BatchDelete (APIView ):
296+ authentication_classes = [TokenAuth ]
297+
292298 @extend_schema (
293- methods = ['DELETE ' ],
299+ methods = ['PUT ' ],
294300 description = _ ('Delete documents in batches' ),
295301 summary = _ ('Delete documents in batches' ),
296302 operation_id = _ ('Delete documents in batches' ),
@@ -303,7 +309,7 @@ def put(self, request: Request, workspace_id: str, knowledge_id: str):
303309 PermissionConstants .DOCUMENT_CREATE .get_workspace_permission (),
304310 PermissionConstants .DOCUMENT_EDIT .get_workspace_permission (),
305311 ])
306- def delete (self , request : Request , workspace_id : str , knowledge_id : str ):
312+ def put (self , request : Request , workspace_id : str , knowledge_id : str ):
307313 return result .success (DocumentSerializers .Batch (
308314 data = {'workspace_id' : workspace_id , 'knowledge_id' : knowledge_id }
309315 ).batch_delete (request .data ))
0 commit comments