@@ -5,127 +5,109 @@ const API_VERSION = process.env.API_VERSION || 'v1';
5
5
const ragManagementPaths = {
6
6
[ `/api/${ API_VERSION } /rag/manage/documents` ] : {
7
7
post : {
8
+ summary : 'Create a new document in the RAG system.' ,
9
+ tags : [ 'RAG Management' ] ,
10
+ security : [ { ApiKeyAuth : [ ] } ] ,
8
11
requestBody : {
12
+ required : true ,
9
13
content : {
10
14
'multipart/form-data' : {
11
15
schema : {
16
+ type : 'object' ,
12
17
properties : {
13
18
documentId : {
19
+ type : 'string' ,
14
20
description : 'Unique identifier for the document (e.g., filename or a unique ID).' ,
15
21
example : 'my-document-123' ,
16
- type : 'string' ,
17
22
} ,
18
23
markdownFile : {
19
- description : 'The Markdown file to upload.' ,
20
- format : 'binary' ,
21
24
type : 'string' ,
25
+ format : 'binary' ,
26
+ description : 'The Markdown file to upload.' ,
22
27
} ,
23
28
} ,
24
29
required : [ 'documentId' , 'markdownFile' ] ,
25
- type : 'object' ,
26
30
} ,
27
31
} ,
28
32
} ,
29
- required : true ,
30
33
} ,
31
34
responses : {
32
35
'201' : { description : 'Document added successfully.' } ,
33
36
'400' : { description : 'Bad Request: Invalid input.' } ,
34
37
'401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
35
38
'500' : { description : 'Internal Server Error.' } ,
36
39
} ,
37
- security : [ { ApiKeyAuth : [ ] } ] ,
38
- summary : 'Create a new document in the RAG system.' ,
39
- tags : [ 'RAG Management' ] ,
40
40
} ,
41
41
} ,
42
42
[ `/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
- } ,
64
43
get : {
44
+ summary : 'Retrieve a document by its ID.' ,
45
+ tags : [ 'RAG Management' ] ,
46
+ security : [ { ApiKeyAuth : [ ] } ] ,
65
47
parameters : [
66
48
{
67
- description : 'Identifier of the document to retrieve.' ,
68
- in : 'path' ,
69
49
name : 'documentId' ,
50
+ in : 'path' ,
70
51
required : true ,
52
+ description : 'Identifier of the document to retrieve.' ,
71
53
schema : { type : 'string' } ,
72
54
} ,
73
55
] ,
74
56
responses : {
75
57
'200' : {
58
+ description : 'Successful retrieval of document content.' ,
76
59
content : {
77
60
'application/json' : {
78
61
schema : {
62
+ type : 'object' ,
79
63
properties : {
64
+ documentId : { type : 'string' } ,
80
65
content : {
81
- description : 'The full markdown content of the document.' ,
82
66
type : 'string' ,
67
+ description : 'The full markdown content of the document.' ,
83
68
} ,
84
- documentId : { type : 'string' } ,
85
69
} ,
86
- type : 'object' ,
87
70
} ,
88
71
} ,
89
72
} ,
90
- description : 'Successful retrieval of document content.' ,
91
73
} ,
92
74
'401' : { description : 'Unauthorized: API key is missing or invalid.' } ,
93
75
'404' : { description : 'Not Found: Document not found.' } ,
94
76
'500' : { description : 'Internal Server Error.' } ,
95
77
} ,
96
- security : [ { ApiKeyAuth : [ ] } ] ,
97
- summary : 'Retrieve a document by its ID.' ,
98
- tags : [ 'RAG Management' ] ,
99
78
} ,
100
79
put : {
80
+ summary : 'Update an existing document.' ,
81
+ tags : [ 'RAG Management' ] ,
82
+ security : [ { ApiKeyAuth : [ ] } ] ,
101
83
parameters : [
102
84
{
103
- description : 'Identifier of the document to update.' ,
104
- in : 'path' ,
105
85
name : 'documentId' ,
86
+ in : 'path' ,
106
87
required : true ,
88
+ description : 'Identifier of the document to update.' ,
107
89
schema : { type : 'string' } ,
108
90
} ,
109
91
] ,
110
92
requestBody : {
93
+ required : true ,
111
94
content : {
112
95
'multipart/form-data' : {
113
96
// Consistent with POST
114
97
schema : {
98
+ type : 'object' ,
115
99
properties : {
116
100
// documentId is in path, so not needed here again unless we want to allow changing it (unusual for PUT)
117
101
markdownFile : {
118
- description : 'The new Markdown file to replace the existing document.' ,
119
- format : 'binary' ,
120
102
type : 'string' ,
103
+ format : 'binary' ,
104
+ description : 'The new Markdown file to replace the existing document.' ,
121
105
} ,
122
106
} ,
123
107
required : [ 'markdownFile' ] ,
124
- type : 'object' ,
125
108
} ,
126
109
} ,
127
110
} ,
128
- required : true ,
129
111
} ,
130
112
responses : {
131
113
'200' : { description : 'Document updated successfully.' } ,
@@ -134,10 +116,59 @@ const ragManagementPaths = {
134
116
'404' : { description : 'Not Found: Document not found.' } ,
135
117
'500' : { description : 'Internal Server Error.' } ,
136
118
} ,
119
+ } ,
120
+ delete : {
121
+ summary : 'Delete a document by its ID.' ,
122
+ tags : [ 'RAG Management' ] ,
137
123
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' ,
139
145
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
+ } ,
140
169
} ,
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.
141
172
} ,
142
173
} ;
143
174
0 commit comments