File tree Expand file tree Collapse file tree 2 files changed +34
-5
lines changed
Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 44from common .mixins .api_mixin import APIMixin
55from common .result import DefaultResultSerializer
66from knowledge .serializers .common import BatchSerializer
7- from knowledge .serializers .document import DocumentCreateRequest
7+ from knowledge .serializers .document import DocumentCreateRequest , DocumentInstanceSerializer
88
99
1010class DocumentCreateAPI (APIMixin ):
@@ -98,3 +98,32 @@ def get_request():
9898 @staticmethod
9999 def get_response ():
100100 return DefaultResultSerializer
101+
102+
103+ class DocumentBatchCreateAPI (APIMixin ):
104+ @staticmethod
105+ def get_parameters ():
106+ return [
107+ OpenApiParameter (
108+ name = "workspace_id" ,
109+ description = "工作空间id" ,
110+ type = OpenApiTypes .STR ,
111+ location = 'path' ,
112+ required = True ,
113+ ),
114+ OpenApiParameter (
115+ name = "knowledge_id" ,
116+ description = "知识库id" ,
117+ type = OpenApiTypes .STR ,
118+ location = 'path' ,
119+ required = True ,
120+ ),
121+ ]
122+
123+ @staticmethod
124+ def get_request ():
125+ return DocumentInstanceSerializer (many = True )
126+
127+ @staticmethod
128+ def get_response ():
129+ return DefaultResultSerializer
Original file line number Diff line number Diff line change 88from common .auth .authentication import has_permissions
99from common .constants .permission_constants import PermissionConstants
1010from common .result import result
11- from knowledge .api .document import DocumentSplitAPI , DocumentBatchAPI
11+ from knowledge .api .document import DocumentSplitAPI , DocumentBatchAPI , DocumentBatchCreateAPI
1212from knowledge .api .knowledge import KnowledgeTreeReadAPI
1313from knowledge .serializers .document import DocumentSerializers
1414from knowledge .serializers .knowledge import KnowledgeSerializer
@@ -76,9 +76,9 @@ class Batch(APIView):
7676 methods = ['POST' ],
7777 description = _ ('Create documents in batches' ),
7878 operation_id = _ ('Create documents in batches' ),
79- request = DocumentBatchAPI .get_request (),
80- parameters = DocumentBatchAPI .get_parameters (),
81- responses = DocumentBatchAPI .get_response (),
79+ request = DocumentBatchCreateAPI .get_request (),
80+ parameters = DocumentBatchCreateAPI .get_parameters (),
81+ responses = DocumentBatchCreateAPI .get_response (),
8282 tags = [_ ('Knowledge Base/Documentation' )]
8383 )
8484 @has_permissions ([
You can’t perform that action at this time.
0 commit comments