Spaces:
Running
Running
luanpoppe
commited on
Commit
·
bca06e1
1
Parent(s):
210dcd0
feat: melhorando swagger para indicar campo recebendo arquivos PDF
Browse files- endpoint_teste/views.py +3 -2
- setup/settings.py +2 -0
endpoint_teste/views.py
CHANGED
@@ -6,7 +6,8 @@ from endpoint_teste.serializer import EndpointTesteSerializer, PDFUploadSerializ
|
|
6 |
from setup.environment import default_model
|
7 |
from drf_spectacular.utils import extend_schema
|
8 |
|
9 |
-
from rest_framework.decorators import api_view
|
|
|
10 |
from rest_framework.response import Response
|
11 |
|
12 |
from langchain_backend.main import get_llm_answer
|
@@ -60,8 +61,8 @@ def getTeste(request):
|
|
60 |
@extend_schema(
|
61 |
request=PDFUploadSerializer,
|
62 |
)
|
63 |
-
|
64 |
@api_view(["POST"])
|
|
|
65 |
def getPDF(request):
|
66 |
if request.method == "POST":
|
67 |
serializer = PDFUploadSerializer(data=request.data)
|
|
|
6 |
from setup.environment import default_model
|
7 |
from drf_spectacular.utils import extend_schema
|
8 |
|
9 |
+
from rest_framework.decorators import api_view, parser_classes
|
10 |
+
from rest_framework.parsers import MultiPartParser
|
11 |
from rest_framework.response import Response
|
12 |
|
13 |
from langchain_backend.main import get_llm_answer
|
|
|
61 |
@extend_schema(
|
62 |
request=PDFUploadSerializer,
|
63 |
)
|
|
|
64 |
@api_view(["POST"])
|
65 |
+
@parser_classes([MultiPartParser])
|
66 |
def getPDF(request):
|
67 |
if request.method == "POST":
|
68 |
serializer = PDFUploadSerializer(data=request.data)
|
setup/settings.py
CHANGED
@@ -165,6 +165,7 @@ REST_FRAMEWORK = {
|
|
165 |
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
166 |
'PAGE_SIZE': 10,
|
167 |
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
|
|
|
168 |
}
|
169 |
|
170 |
SPECTACULAR_SETTINGS = {
|
@@ -172,5 +173,6 @@ SPECTACULAR_SETTINGS = {
|
|
172 |
'DESCRIPTION': 'Your project description',
|
173 |
'VERSION': '1.0.0',
|
174 |
'SERVE_INCLUDE_SCHEMA': False,
|
|
|
175 |
# OTHER SETTINGS
|
176 |
}
|
|
|
165 |
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
166 |
'PAGE_SIZE': 10,
|
167 |
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
|
168 |
+
"DEFAULT_PARSER_CLASSES": ["rest_framework.parsers.MultiPartParser", "rest_framework.parsers.FormParser"]
|
169 |
}
|
170 |
|
171 |
SPECTACULAR_SETTINGS = {
|
|
|
173 |
'DESCRIPTION': 'Your project description',
|
174 |
'VERSION': '1.0.0',
|
175 |
'SERVE_INCLUDE_SCHEMA': False,
|
176 |
+
'COMPONENT_SPLIT_REQUEST': True
|
177 |
# OTHER SETTINGS
|
178 |
}
|