diff --git a/server/endpoints/api/document/index.js b/server/endpoints/api/document/index.js index faa6b85e4899e2cb0c8d6d6811d3202e6367eede..cd08a6f3e3fc12ee373260463693422a664f081a 100644 --- a/server/endpoints/api/document/index.js +++ b/server/endpoints/api/document/index.js @@ -129,44 +129,43 @@ function apiDocumentEndpoints(app) { [validApiKey, handleAPIFileUpload], async (request, response) => { /* - #swagger.tags = ['Documents'] - #swagger.description = 'Upload a new file to a specific folder in AnythingLLM to be parsed and prepared for embedding. If the folder does not exist, it will be created.' - #swagger.parameters['folderName'] = { - in: 'path', - description: 'Target folder path (defaults to "custom-documents" if not provided)', - required: true, - type: 'string', - example: 'my-folder' - } - #swagger.requestBody = { - description: 'File to be uploaded.', - required: true, - content: { - "multipart/form-data": { - schema: { - type: 'object', - required: ['file'], - properties: { - file: { - type: 'string', - format: 'binary', - description: 'The file to upload' + #swagger.tags = ['Documents'] + #swagger.description = 'Upload a new file to a specific folder in AnythingLLM to be parsed and prepared for embedding. If the folder does not exist, it will be created.' + #swagger.parameters['folderName'] = { + in: 'path', + description: 'Target folder path (defaults to \"custom-documents\" if not provided)', + required: true, + type: 'string', + example: 'my-folder' + } + #swagger.requestBody = { + description: 'File to be uploaded.', + required: true, + content: { + "multipart/form-data": { + schema: { + type: 'object', + required: ['file'], + properties: { + file: { + type: 'string', + format: 'binary', + description: 'The file to upload' + } } } } } } - } - #swagger.responses[200] = { - content: { - "application/json": { - schema: { - type: 'object', - example: { - success: true, - error: null, - documents: [ - { + #swagger.responses[200] = { + content: { + "application/json": { + schema: { + type: 'object', + example: { + success: true, + error: null, + documents: [{ "location": "custom-documents/anythingllm.txt-6e8be64c-c162-4b43-9997-b068c0071e8b.json", "name": "anythingllm.txt-6e8be64c-c162-4b43-9997-b068c0071e8b.json", "url": "file:///Users/tim/Documents/anything-llm/collector/hotdir/anythingllm.txt", @@ -178,33 +177,32 @@ function apiDocumentEndpoints(app) { "published": "1/16/2024, 3:07:00 PM", "wordCount": 93, "token_count_estimate": 115 - } - ] + }] + } } } } } - } - #swagger.responses[403] = { - schema: { - "$ref": "#/definitions/InvalidAPIKey" + #swagger.responses[403] = { + schema: { + "$ref": "#/definitions/InvalidAPIKey" + } } - } - #swagger.responses[500] = { - description: "Internal Server Error", - content: { - "application/json": { - schema: { - type: 'object', - example: { - success: false, - error: "Document processing API is not online. Document will not be processed automatically." + #swagger.responses[500] = { + description: "Internal Server Error", + content: { + "application/json": { + schema: { + type: 'object', + example: { + success: false, + error: "Document processing API is not online. Document will not be processed automatically." + } } } } } - } - */ + */ try { const { originalname } = request.file; let folder = request.params?.folderName || "custom-documents"; diff --git a/server/swagger/openapi.json b/server/swagger/openapi.json index e7b3582d36163fe81ef42728da95cf57de3e64c4..0eaf3dd8671ca31703971ab7b0aabdab838b1d4f 100644 --- a/server/swagger/openapi.json +++ b/server/swagger/openapi.json @@ -930,7 +930,9 @@ "required": true, "schema": { "type": "string" - } + }, + "description": "Target folder path (defaults to 'custom-documents' if not provided)", + "example": "my-folder" } ], "responses": {