🚚(backend) create skeleton endpoint ai

Create a skeleton endpoint for the AI to
rewrite the text sent in the request.
We send as well the action to be performed
on the text by the AI.
This commit is contained in:
Anthony LC
2024-09-12 11:36:55 +02:00
parent 97fa5b8532
commit 36c0b3dda2
+15
View File
@@ -367,6 +367,21 @@ class DocumentViewSet(
pass
return drf_response.Response(serializer.data)
@decorators.action(detail=True, methods=["post"], url_path="ai")
def ai(self, request, *args, **kwargs):
"""
Return the document's versions but only those created after the user got access
to the document
"""
if not request.user.is_authenticated:
raise exceptions.PermissionDenied("Authentication required.")
action = request.data.get("action")
text = request.data.get("text")
return drf_response.Response(text.upper())
@decorators.action(detail=True, methods=["get"], url_path="versions")
def versions_list(self, request, *args, **kwargs):