Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Document removal fix from prompt studio (#251)

Rahul Johny632adfe7080b
diff --git a/backend/prompt_studio/prompt_studio_core/views.py b/backend/prompt_studio/prompt_studio_core/views.py
index 6624cf8d6..0ce3619be 100644
--- a/backend/prompt_studio/prompt_studio_core/views.py
+++ b/backend/prompt_studio/prompt_studio_core/views.py
@@ -449,11 +449,13 @@ class PromptStudioCoreView(viewsets.ModelViewSet):
return Response({"data": documents})
@action(detail=True, methods=["delete"])
- def delete_for_ide(self, request: HttpRequest, pk: Any = None) -> Response:
+ def delete_for_ide(self, request: HttpRequest, pk: uuid) -> Response:
custom_tool = self.get_object()
- serializer = FileInfoIdeSerializer(data=request.GET)
+ serializer = FileInfoIdeSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
- document_id: str = serializer.validated_data.get("document_id")
+ document_id: str = serializer.validated_data.get(
+ ToolStudioPromptKeys.DOCUMENT_ID
+ )
document: DocumentManager = DocumentManager.objects.get(pk=document_id)
file_name: str = document.document_name
file_path = FileManagerHelper.handle_sub_directory_for_tenants(
diff --git a/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx b/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx
index 19f5fc7eb..e4a26a013 100644
--- a/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx
+++ b/frontend/src/components/custom-tools/manage-docs-modal/ManageDocsModal.jsx
@@ -478,9 +478,17 @@ function ManageDocsModal({
};
const handleDelete = (docId) => {
+ const body = {
+ document_id: docId,
+ };
const requestOptions = {
- method: "GET",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/file/delete?document_id=${docId}&tool_id=${details?.tool_id}`,
+ method: "DELETE",
+ url: `/api/v1/unstract/${sessionDetails?.orgId}/prompt-studio/file/${details?.tool_id}`,
+ headers: {
+ "X-CSRFToken": sessionDetails?.csrfToken,
+ "Content-Type": "application/json",
+ },
+ data: body,
};
axiosPrivate(requestOptions)