mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
feat: add DocumentBatchCreateAPI for batch document creation
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
This commit is contained in:
parent
ee2ac7835c
commit
ba5028858c
|
|
@ -4,7 +4,7 @@ from drf_spectacular.utils import OpenApiParameter
|
|||
from common.mixins.api_mixin import APIMixin
|
||||
from common.result import DefaultResultSerializer
|
||||
from knowledge.serializers.common import BatchSerializer
|
||||
from knowledge.serializers.document import DocumentCreateRequest
|
||||
from knowledge.serializers.document import DocumentCreateRequest, DocumentInstanceSerializer
|
||||
|
||||
|
||||
class DocumentCreateAPI(APIMixin):
|
||||
|
|
@ -98,3 +98,32 @@ class DocumentBatchAPI(APIMixin):
|
|||
@staticmethod
|
||||
def get_response():
|
||||
return DefaultResultSerializer
|
||||
|
||||
|
||||
class DocumentBatchCreateAPI(APIMixin):
|
||||
@staticmethod
|
||||
def get_parameters():
|
||||
return [
|
||||
OpenApiParameter(
|
||||
name="workspace_id",
|
||||
description="工作空间id",
|
||||
type=OpenApiTypes.STR,
|
||||
location='path',
|
||||
required=True,
|
||||
),
|
||||
OpenApiParameter(
|
||||
name="knowledge_id",
|
||||
description="知识库id",
|
||||
type=OpenApiTypes.STR,
|
||||
location='path',
|
||||
required=True,
|
||||
),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def get_request():
|
||||
return DocumentInstanceSerializer(many=True)
|
||||
|
||||
@staticmethod
|
||||
def get_response():
|
||||
return DefaultResultSerializer
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from common.auth import TokenAuth
|
|||
from common.auth.authentication import has_permissions
|
||||
from common.constants.permission_constants import PermissionConstants
|
||||
from common.result import result
|
||||
from knowledge.api.document import DocumentSplitAPI, DocumentBatchAPI
|
||||
from knowledge.api.document import DocumentSplitAPI, DocumentBatchAPI, DocumentBatchCreateAPI
|
||||
from knowledge.api.knowledge import KnowledgeTreeReadAPI
|
||||
from knowledge.serializers.document import DocumentSerializers
|
||||
from knowledge.serializers.knowledge import KnowledgeSerializer
|
||||
|
|
@ -76,9 +76,9 @@ class DocumentView(APIView):
|
|||
methods=['POST'],
|
||||
description=_('Create documents in batches'),
|
||||
operation_id=_('Create documents in batches'),
|
||||
request=DocumentBatchAPI.get_request(),
|
||||
parameters=DocumentBatchAPI.get_parameters(),
|
||||
responses=DocumentBatchAPI.get_response(),
|
||||
request=DocumentBatchCreateAPI.get_request(),
|
||||
parameters=DocumentBatchCreateAPI.get_parameters(),
|
||||
responses=DocumentBatchCreateAPI.get_response(),
|
||||
tags=[_('Knowledge Base/Documentation')]
|
||||
)
|
||||
@has_permissions([
|
||||
|
|
|
|||
Loading…
Reference in New Issue