@@ -5,127 +5,109 @@ const API_VERSION = process.env.API_VERSION || 'v1';
55const ragManagementPaths = {
66 [ `/api/${ API_VERSION } /rag/manage/documents` ] : {
77 post : {
8+ summary : 'Create a new document in the RAG system.' ,
9+ tags : [ 'RAG Management' ] ,
10+ security : [ { ApiKeyAuth : [ ] } ] ,
811 requestBody : {
12+ required : true ,
913 content : {
1014 'multipart/form-data' : {
1115 schema : {
16+ type : 'object' ,
1217 properties : {
1318 documentId : {
19+ type : 'string' ,
1420 description : 'Unique identifier for the document (e.g., filename or a unique ID).' ,
1521 example : 'my-document-123' ,
16- type : 'string' ,
1722 } ,
1823 markdownFile : {
19- description : 'The Markdown file to upload.' ,
20- format : 'binary' ,
2124 type : 'string' ,
25+ format : 'binary' ,
26+ description : 'The Markdown file to upload.' ,
2227 } ,
2328 } ,
2429 required : [ 'documentId' , 'markdownFile' ] ,
25- type : 'object' ,
2630 } ,
2731 } ,
2832 } ,
29- required : true ,
3033 } ,
3134 responses : {
3235 '201' : { description : 'Document added successfully.' } ,
3336 '400' : { description : 'Bad Request: Invalid input.' } ,
3437 '401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
3538 '500' : { description : 'Internal Server Error.' } ,
3639 } ,
37- security : [ { ApiKeyAuth : [ ] } ] ,
38- summary : 'Create a new document in the RAG system.' ,
39- tags : [ 'RAG Management' ] ,
4040 } ,
4141 } ,
4242 [ `/api/${ API_VERSION } /rag/manage/documents/{documentId}` ] : {
43- delete : {
44- parameters : [
45- {
46- description : 'Identifier of the document to delete.' ,
47- in : 'path' ,
48- name : 'documentId' ,
49- required : true ,
50- schema : { type : 'string' } ,
51- } ,
52- ] ,
53- responses : {
54- '200' : { description : 'Document deleted successfully.' } ,
55- // "204": { description: "Document deleted successfully (No Content)." }, // Alternative
56- '401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
57- '404' : { description : 'Not Found: Document not found (or already deleted).' } ,
58- '500' : { description : 'Internal Server Error.' } ,
59- } ,
60- security : [ { ApiKeyAuth : [ ] } ] ,
61- summary : 'Delete a document by its ID.' ,
62- tags : [ 'RAG Management' ] ,
63- } ,
6443 get : {
44+ summary : 'Retrieve a document by its ID.' ,
45+ tags : [ 'RAG Management' ] ,
46+ security : [ { ApiKeyAuth : [ ] } ] ,
6547 parameters : [
6648 {
67- description : 'Identifier of the document to retrieve.' ,
68- in : 'path' ,
6949 name : 'documentId' ,
50+ in : 'path' ,
7051 required : true ,
52+ description : 'Identifier of the document to retrieve.' ,
7153 schema : { type : 'string' } ,
7254 } ,
7355 ] ,
7456 responses : {
7557 '200' : {
58+ description : 'Successful retrieval of document content.' ,
7659 content : {
7760 'application/json' : {
7861 schema : {
62+ type : 'object' ,
7963 properties : {
64+ documentId : { type : 'string' } ,
8065 content : {
81- description : 'The full markdown content of the document.' ,
8266 type : 'string' ,
67+ description : 'The full markdown content of the document.' ,
8368 } ,
84- documentId : { type : 'string' } ,
8569 } ,
86- type : 'object' ,
8770 } ,
8871 } ,
8972 } ,
90- description : 'Successful retrieval of document content.' ,
9173 } ,
9274 '401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
9375 '404' : { description : 'Not Found: Document not found.' } ,
9476 '500' : { description : 'Internal Server Error.' } ,
9577 } ,
96- security : [ { ApiKeyAuth : [ ] } ] ,
97- summary : 'Retrieve a document by its ID.' ,
98- tags : [ 'RAG Management' ] ,
9978 } ,
10079 put : {
80+ summary : 'Update an existing document.' ,
81+ tags : [ 'RAG Management' ] ,
82+ security : [ { ApiKeyAuth : [ ] } ] ,
10183 parameters : [
10284 {
103- description : 'Identifier of the document to update.' ,
104- in : 'path' ,
10585 name : 'documentId' ,
86+ in : 'path' ,
10687 required : true ,
88+ description : 'Identifier of the document to update.' ,
10789 schema : { type : 'string' } ,
10890 } ,
10991 ] ,
11092 requestBody : {
93+ required : true ,
11194 content : {
11295 'multipart/form-data' : {
11396 // Consistent with POST
11497 schema : {
98+ type : 'object' ,
11599 properties : {
116100 // documentId is in path, so not needed here again unless we want to allow changing it (unusual for PUT)
117101 markdownFile : {
118- description : 'The new Markdown file to replace the existing document.' ,
119- format : 'binary' ,
120102 type : 'string' ,
103+ format : 'binary' ,
104+ description : 'The new Markdown file to replace the existing document.' ,
121105 } ,
122106 } ,
123107 required : [ 'markdownFile' ] ,
124- type : 'object' ,
125108 } ,
126109 } ,
127110 } ,
128- required : true ,
129111 } ,
130112 responses : {
131113 '200' : { description : 'Document updated successfully.' } ,
@@ -134,10 +116,59 @@ const ragManagementPaths = {
134116 '404' : { description : 'Not Found: Document not found.' } ,
135117 '500' : { description : 'Internal Server Error.' } ,
136118 } ,
119+ } ,
120+ delete : {
121+ summary : 'Delete a document by its ID.' ,
122+ tags : [ 'RAG Management' ] ,
137123 security : [ { ApiKeyAuth : [ ] } ] ,
138- summary : 'Update an existing document.' ,
124+ parameters : [
125+ {
126+ name : 'documentId' ,
127+ in : 'path' ,
128+ required : true ,
129+ description : 'Identifier of the document to delete.' ,
130+ schema : { type : 'string' } ,
131+ } ,
132+ ] ,
133+ responses : {
134+ '200' : { description : 'Document deleted successfully.' } ,
135+ // "204": { description: "Document deleted successfully (No Content)." }, // Alternative
136+ '401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
137+ '404' : { description : 'Not Found: Document not found (or already deleted).' } ,
138+ '500' : { description : 'Internal Server Error.' } ,
139+ } ,
140+ } ,
141+ } ,
142+ [ `/api/${ API_VERSION } /rag/manage/documents:all` ] : {
143+ get : {
144+ summary : 'Get all document IDs' ,
139145 tags : [ 'RAG Management' ] ,
146+ security : [ { ApiKeyAuth : [ ] } ] ,
147+ responses : {
148+ '200' : {
149+ description : 'Successful retrieval of all document IDs.' ,
150+ content : {
151+ 'application/json' : {
152+ schema : {
153+ type : 'object' ,
154+ properties : {
155+ documentIds : {
156+ type : 'array' ,
157+ items : { type : 'string' } ,
158+ example : [ 'doc-abc-123' , 'doc-def-456' ] ,
159+ } ,
160+ } ,
161+ } ,
162+ } ,
163+ } ,
164+ } ,
165+ '401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
166+ '503' : { description : 'Service Unavailable: RAG service is not ready.' } ,
167+ '500' : { description : 'Internal Server Error.' } ,
168+ } ,
140169 } ,
170+ // Note: Based on the router, a POST operation to this path also exists.
171+ // Its definition should be added here if it's different from POST /rag/manage/documents.
141172 } ,
142173} ;
143174
0 commit comments