writinwaters
commited on
Commit
·
935e280
1
Parent(s):
73d9acb
Publish RAGFlow's HTTP and Python API references (#3116)
Browse files### What problem does this PR solve?
### Type of change
- [x] Documentation Update
- docs/guides/develop/acquire_ragflow_api_key.md +18 -0
- docs/guides/llm_api_key_setup.md +1 -1
- docs/references/api.md +0 -553
- docs/references/faq.md +1 -1
- {api → docs/references}/http_api_reference.md +6 -2
- {api → docs/references}/python_api_reference.md +8 -3
- docs/references/ragflow_api.md +0 -881
- web/src/components/api-service/chat-overview-modal/api-content.tsx +2 -2
docs/guides/develop/acquire_ragflow_api_key.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
sidebar_position: 3
|
3 |
+
slug: /acquire_ragflow_api_key
|
4 |
+
---
|
5 |
+
|
6 |
+
# Acquire a RAGFlow API key
|
7 |
+
|
8 |
+
A key is required for the RAGFlow server to authenticate your requests via HTTP or a Python API. This documents provides instructions on obtaining a RAGFlow API key.
|
9 |
+
|
10 |
+
1. Click your avatar on the top right corner of the RAGFlow UI to access the configuration page.
|
11 |
+
2. Click **API** to switch to the **API** page.
|
12 |
+
3. Obtain a RAGFlow API key:
|
13 |
+
|
14 |
+

|
15 |
+
|
16 |
+
:::tip NOTE
|
17 |
+
See the [RAGFlow HTTP API reference](../../references/http_api_reference.md) or the [RAGFlow Python API reference](../../references/python_api_reference.md) for a complete reference of RAGFlow's HTTP or Python APIs.
|
18 |
+
:::
|
docs/guides/llm_api_key_setup.md
CHANGED
@@ -29,7 +29,7 @@ For now, RAGFlow supports the following online LLMs. Click the corresponding lin
|
|
29 |
- [StepFun](https://platform.stepfun.com/)
|
30 |
|
31 |
:::note
|
32 |
-
If you find your online LLM is not on the list, don't feel disheartened. The list is expanding, and you can [file a feature request](https://github.com/infiniflow/ragflow/issues/new?assignees=&labels=feature+request&projects=&template=feature_request.yml&title=%5BFeature+Request%5D%3A+) with us! Alternatively, if you have customized or locally-deployed models, you can [bind them to RAGFlow using Ollama,
|
33 |
:::
|
34 |
|
35 |
## Configure model API key
|
|
|
29 |
- [StepFun](https://platform.stepfun.com/)
|
30 |
|
31 |
:::note
|
32 |
+
If you find your online LLM is not on the list, don't feel disheartened. The list is expanding, and you can [file a feature request](https://github.com/infiniflow/ragflow/issues/new?assignees=&labels=feature+request&projects=&template=feature_request.yml&title=%5BFeature+Request%5D%3A+) with us! Alternatively, if you have customized or locally-deployed models, you can [bind them to RAGFlow using Ollama, Xinference, or LocalAI](./deploy_local_llm.mdx).
|
33 |
:::
|
34 |
|
35 |
## Configure model API key
|
docs/references/api.md
DELETED
@@ -1,553 +0,0 @@
|
|
1 |
-
---
|
2 |
-
sidebar_position: 1
|
3 |
-
slug: /api
|
4 |
-
---
|
5 |
-
|
6 |
-
# API reference
|
7 |
-
|
8 |
-
RAGFlow offers RESTful APIs for you to integrate its capabilities into third-party applications.
|
9 |
-
|
10 |
-
## Base URL
|
11 |
-
```
|
12 |
-
https://demo.ragflow.io/v1/
|
13 |
-
```
|
14 |
-
|
15 |
-
## Authorization
|
16 |
-
|
17 |
-
All of RAGFlow's RESTful APIs use API key for authorization, so keep it safe and do not expose it to the front end.
|
18 |
-
Put your API key in the request header.
|
19 |
-
|
20 |
-
```buildoutcfg
|
21 |
-
Authorization: Bearer {API_KEY}
|
22 |
-
```
|
23 |
-
|
24 |
-
:::note
|
25 |
-
In the current design, the RESTful API key you get from RAGFlow does not expire.
|
26 |
-
:::
|
27 |
-
|
28 |
-
To get your Chat API key or Agent API key:
|
29 |
-
|
30 |
-
For Chat API key:
|
31 |
-
1. In RAGFlow, click **Chat** tab in the middle top of the page.
|
32 |
-
2. Hover over the corresponding dialogue **>** **Chat Bot API** to show the chatbot API configuration page.
|
33 |
-
3. Click **API Key** **>** **Create new key** to create your API key.
|
34 |
-
4. Copy and keep your API key safe.
|
35 |
-
|
36 |
-
For Agent API key:
|
37 |
-
1. In RAGFlow, click **Agent** tab in the middle top of the page.
|
38 |
-
2. Click your agent **>** ** Chat Bot API** to show the chatbot API configuration page.
|
39 |
-
3. Click **API Key** **>** **Create new key** to create your API key.
|
40 |
-
4. Copy and keep your API key safe.
|
41 |
-
|
42 |
-
## Create conversation
|
43 |
-
|
44 |
-
This method creates (news) a conversation for a specific user.
|
45 |
-
|
46 |
-
### Request
|
47 |
-
|
48 |
-
#### Request URI
|
49 |
-
|
50 |
-
| Method | Request URI |
|
51 |
-
|----------|-------------------------------------------------------------|
|
52 |
-
| GET | `/api/new_conversation` |
|
53 |
-
|
54 |
-
:::note
|
55 |
-
You are *required* to save the `data.id` value returned in the response data, which is the session ID for all upcoming conversations.
|
56 |
-
:::
|
57 |
-
|
58 |
-
#### Request parameter
|
59 |
-
|
60 |
-
| Name | Type | Required | Description |
|
61 |
-
|----------|--------|----------|-------------------------------------------------------------|
|
62 |
-
| `user_id`| string | Yes | The unique identifier assigned to each user. `user_id` must be less than 32 characters and cannot be empty. The following character sets are supported: <br />- 26 lowercase English letters (a-z)<br />- 26 uppercase English letters (A-Z)<br />- 10 digits (0-9)<br />- "_", "-", "." |
|
63 |
-
|
64 |
-
### Response
|
65 |
-
|
66 |
-
```json
|
67 |
-
{
|
68 |
-
"data": {
|
69 |
-
"create_date": "Fri, 12 Apr 2024 17:26:21 GMT",
|
70 |
-
"create_time": 1712913981857,
|
71 |
-
"dialog_id": "4f0a2e4cb9af11ee9ba20aef05f5e94f",
|
72 |
-
"duration": 0.0,
|
73 |
-
"id": "b9b2e098f8ae11ee9f45fa163e197198",
|
74 |
-
"message": [
|
75 |
-
{
|
76 |
-
"content": "Hi, I'm your assistant, what can I do for you?",
|
77 |
-
"role": "assistant"
|
78 |
-
}
|
79 |
-
],
|
80 |
-
"reference": [],
|
81 |
-
"tokens": 0,
|
82 |
-
"update_date": "Fri, 12 Apr 2024 17:26:21 GMT",
|
83 |
-
"update_time": 1712913981857,
|
84 |
-
"user_id": "<USER_ID_SET_BY_THE_CALLER>"
|
85 |
-
},
|
86 |
-
"retcode": 0,
|
87 |
-
"retmsg": "success"
|
88 |
-
}
|
89 |
-
```
|
90 |
-
|
91 |
-
## Get conversation history
|
92 |
-
|
93 |
-
This method retrieves the history of a specified conversation session.
|
94 |
-
|
95 |
-
### Request
|
96 |
-
|
97 |
-
#### Request URI
|
98 |
-
|
99 |
-
| Method | Request URI |
|
100 |
-
|----------|-------------------------------------------------------------|
|
101 |
-
| GET | `/api/conversation/<id>` |
|
102 |
-
|
103 |
-
#### Request parameter
|
104 |
-
|
105 |
-
| Name | Type | Required | Description |
|
106 |
-
|----------|--------|----------|-------------------------------------------------------------|
|
107 |
-
| `id` | string | Yes | The unique identifier assigned to a conversation session. `id` must be less than 32 characters and cannot be empty. The following character sets are supported: <br />- 26 lowercase English letters (a-z)<br />- 26 uppercase English letters (A-Z)<br />- 10 digits (0-9)<br />- "_", "-", "." |
|
108 |
-
|
109 |
-
### Response
|
110 |
-
|
111 |
-
#### Response parameter
|
112 |
-
|
113 |
-
- `message`: All conversations in the specified conversation session.
|
114 |
-
- `role`: `"user"` or `"assistant"`.
|
115 |
-
- `content`: The text content of user or assistant. The citations are in a format like `##0$$`. The number in the middle, 0 in this case, indicates which part in data.reference.chunks it refers to.
|
116 |
-
|
117 |
-
- `user_id`: This is set by the caller.
|
118 |
-
- `reference`: Each reference corresponds to one of the assistant's answers in `data.message`.
|
119 |
-
- `chunks`
|
120 |
-
- `content_with_weight`: Content of the chunk.
|
121 |
-
- `doc_name`: Name of the *hit* document.
|
122 |
-
- `img_id`: The image ID of the chunk. It is an optional field only for PDF, PPTX, and images. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the image.
|
123 |
-
- `positions`: [page_number, [upleft corner(x, y)], [right bottom(x, y)]], the chunk position, only for PDF.
|
124 |
-
- `similarity`: The hybrid similarity.
|
125 |
-
- `term_similarity`: The keyword simimlarity.
|
126 |
-
- `vector_similarity`: The embedding similarity.
|
127 |
-
- `doc_aggs`:
|
128 |
-
- `doc_id`: ID of the *hit* document. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the document.
|
129 |
-
- `doc_name`: Name of the *hit* document.
|
130 |
-
- `count`: The number of *hit* chunks in this document.
|
131 |
-
|
132 |
-
```json
|
133 |
-
{
|
134 |
-
"data": {
|
135 |
-
"create_date": "Mon, 01 Apr 2024 09:28:42 GMT",
|
136 |
-
"create_time": 1711934922220,
|
137 |
-
"dialog_id": "df4a4916d7bd11eeaa650242ac180006",
|
138 |
-
"id": "2cae30fcefc711ee94140242ac180006",
|
139 |
-
"message": [
|
140 |
-
{
|
141 |
-
"content": "Hi! I'm your assistant, what can I do for you?",
|
142 |
-
"role": "assistant"
|
143 |
-
},
|
144 |
-
{
|
145 |
-
"content": "What's the vit score for GPT-4?",
|
146 |
-
"role": "user"
|
147 |
-
},
|
148 |
-
{
|
149 |
-
"content": "The ViT Score for GPT-4 in the zero-shot scenario is 0.5058, and in the few-shot scenario, it is 0.6480. ##0$$",
|
150 |
-
"role": "assistant"
|
151 |
-
}
|
152 |
-
],
|
153 |
-
"user_id": "<USER_ID_SET_BY_THE_CALLER>",
|
154 |
-
"reference": [
|
155 |
-
{
|
156 |
-
"chunks": [
|
157 |
-
{
|
158 |
-
"chunk_id": "d0bc7892c3ec4aeac071544fd56730a8",
|
159 |
-
"content_ltks": "tabl 1:openagi task-solv perform under differ set for three closed-sourc llm . boldfac denot the highest score under each learn schema . metric gpt-3.5-turbo claude-2 gpt-4 zero few zero few zero few clip score 0.0 0.0 0.0 0.2543 0.0 0.3055 bert score 0.1914 0.3820 0.2111 0.5038 0.2076 0.6307 vit score 0.2437 0.7497 0.4082 0.5416 0.5058 0.6480 overal 0.1450 0.3772 0.2064 0.4332 0.2378 0.5281",
|
160 |
-
"content_with_weight": "<table><caption>Table 1: OpenAGI task-solving performances under different settings for three closed-source LLMs. Boldface denotes the highest score under each learning schema.</caption>\n<tr><th rowspan=2 >Metrics</th><th >GPT-3.5-turbo</th><th></th><th >Claude-2</th><th >GPT-4</th></tr>\n<tr><th >Zero</th><th >Few</th><th >Zero Few</th><th >Zero Few</th></tr>\n<tr><td >CLIP Score</td><td >0.0</td><td >0.0</td><td >0.0 0.2543</td><td >0.0 0.3055</td></tr>\n<tr><td >BERT Score</td><td >0.1914</td><td >0.3820</td><td >0.2111 0.5038</td><td >0.2076 0.6307</td></tr>\n<tr><td >ViT Score</td><td >0.2437</td><td >0.7497</td><td >0.4082 0.5416</td><td >0.5058 0.6480</td></tr>\n<tr><td >Overall</td><td >0.1450</td><td >0.3772</td><td >0.2064 0.4332</td><td >0.2378 0.5281</td></tr>\n</table>",
|
161 |
-
"doc_id": "c790da40ea8911ee928e0242ac180005",
|
162 |
-
"doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
|
163 |
-
"img_id": "afab9fdad6e511eebdb20242ac180006-d0bc7892c3ec4aeac071544fd56730a8",
|
164 |
-
"important_kwd": [],
|
165 |
-
"kb_id": "afab9fdad6e511eebdb20242ac180006",
|
166 |
-
"positions": [
|
167 |
-
[
|
168 |
-
9.0,
|
169 |
-
159.9383341471354,
|
170 |
-
472.1773274739583,
|
171 |
-
223.58013916015625,
|
172 |
-
307.86692301432294
|
173 |
-
]
|
174 |
-
],
|
175 |
-
"similarity": 0.7310340654129031,
|
176 |
-
"term_similarity": 0.7671974387781668,
|
177 |
-
"vector_similarity": 0.40556370512552886
|
178 |
-
},
|
179 |
-
{
|
180 |
-
"chunk_id": "7e2345d440383b756670e1b0f43a7007",
|
181 |
-
"content_ltks": "5.5 experiment analysi the main experiment result are tabul in tab . 1 and 2 , showcas the result for closed-sourc and open-sourc llm , respect . the overal perform is calcul a the averag of cllp 8 bert and vit score . ",
|
182 |
-
"content_with_weight": "5.5 Experimental Analysis\nThe main experimental results are tabulated in Tab. 1 and 2, showcasing the results for closed-source and open-source LLMs, respectively. The overall performance is calculated as the average of CLlP\n8\nBERT and ViT scores.",
|
183 |
-
"doc_id": "c790da40ea8911ee928e0242ac180005",
|
184 |
-
"doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
|
185 |
-
"img_id": "afab9fdad6e511eebdb20242ac180006-7e2345d440383b756670e1b0f43a7007",
|
186 |
-
"important_kwd": [],
|
187 |
-
"kb_id": "afab9fdad6e511eebdb20242ac180006",
|
188 |
-
"positions": [
|
189 |
-
[
|
190 |
-
8.0,
|
191 |
-
107.3,
|
192 |
-
508.90000000000003,
|
193 |
-
686.3,
|
194 |
-
697.0
|
195 |
-
],
|
196 |
-
],
|
197 |
-
"similarity": 0.6691508616357027,
|
198 |
-
"term_similarity": 0.6999011754270821,
|
199 |
-
"vector_similarity": 0.39239803751328806
|
200 |
-
},
|
201 |
-
],
|
202 |
-
"doc_aggs": [
|
203 |
-
{
|
204 |
-
"count": 8,
|
205 |
-
"doc_id": "c790da40ea8911ee928e0242ac180005",
|
206 |
-
"doc_name": "OpenAGI When LLM Meets Domain Experts.pdf"
|
207 |
-
}
|
208 |
-
],
|
209 |
-
"total": 8
|
210 |
-
},
|
211 |
-
],
|
212 |
-
"update_date": "Tue, 02 Apr 2024 09:07:49 GMT",
|
213 |
-
"update_time": 1712020069421
|
214 |
-
},
|
215 |
-
"retcode": 0,
|
216 |
-
"retmsg": "success"
|
217 |
-
}
|
218 |
-
```
|
219 |
-
|
220 |
-
## Get answer
|
221 |
-
|
222 |
-
This method retrieves from RAGFlow Chat or RAGFlow Agent the answer to the user's latest question.
|
223 |
-
|
224 |
-
### Request
|
225 |
-
|
226 |
-
#### Request URI
|
227 |
-
|
228 |
-
| Method | Request URI |
|
229 |
-
|----------|-------------------------------------------------------------|
|
230 |
-
| POST | `/api/completion` |
|
231 |
-
|
232 |
-
#### Request parameter
|
233 |
-
|
234 |
-
| Name | Type | Required | Description |
|
235 |
-
|------------------|--------|----------|---------------|
|
236 |
-
| `conversation_id`| string | Yes | The ID of the conversation session. Call ['GET' /new_conversation](#create-conversation) to retrieve the ID.|
|
237 |
-
| `messages` | json | Yes | The latest question in a JSON form, such as `[{"role": "user", "content": "How are you doing!"}]`|
|
238 |
-
| `quote` | bool | No | Default: false|
|
239 |
-
| `stream` | bool | No | Default: true |
|
240 |
-
| `doc_ids` | string | No | Document IDs delimited by comma, like `c790da40ea8911ee928e0242ac180005,23dsf34ree928e0242ac180005`. The retrieved contents will be confined to these documents. |
|
241 |
-
|
242 |
-
### Response
|
243 |
-
|
244 |
-
- `answer`: The answer to the user's latest question.
|
245 |
-
- `reference`:
|
246 |
-
- `chunks`: The retrieved chunks that contribute to the answer.
|
247 |
-
- `content_with_weight`: Content of the chunk.
|
248 |
-
- `doc_name`: Name of the *hit* document.
|
249 |
-
- `img_id`: The image ID of the chunk. It is an optional field only for PDF, PPTX, and images. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the image.
|
250 |
-
- `positions`: [page_number, [upleft corner(x, y)], [right bottom(x, y)]], the chunk position, only for PDF.
|
251 |
-
- `similarity`: The hybrid similarity.
|
252 |
-
- `term_similarity`: The keyword simimlarity.
|
253 |
-
- `vector_similarity`: The embedding similarity.
|
254 |
-
- `doc_aggs`:
|
255 |
-
- `doc_id`: ID of the *hit* document. Call ['GET' /document/get/\<id\>](#get-document-content) to retrieve the document.
|
256 |
-
- `doc_name`: Name of the *hit* document.
|
257 |
-
- `count`: The number of *hit* chunks in this document.
|
258 |
-
|
259 |
-
```json
|
260 |
-
{
|
261 |
-
"data": {
|
262 |
-
"answer": "The ViT Score for GPT-4 in the zero-shot scenario is 0.5058, and in the few-shot scenario, it is 0.6480. ##0$$",
|
263 |
-
"reference": {
|
264 |
-
"chunks": [
|
265 |
-
{
|
266 |
-
"chunk_id": "d0bc7892c3ec4aeac071544fd56730a8",
|
267 |
-
"content_ltks": "tabl 1:openagi task-solv perform under differ set for three closed-sourc llm . boldfac denot the highest score under each learn schema . metric gpt-3.5-turbo claude-2 gpt-4 zero few zero few zero few clip score 0.0 0.0 0.0 0.2543 0.0 0.3055 bert score 0.1914 0.3820 0.2111 0.5038 0.2076 0.6307 vit score 0.2437 0.7497 0.4082 0.5416 0.5058 0.6480 overal 0.1450 0.3772 0.2064 0.4332 0.2378 0.5281",
|
268 |
-
"content_with_weight": "<table><caption>Table 1: OpenAGI task-solving performances under different settings for three closed-source LLMs. Boldface denotes the highest score under each learning schema.</caption>\n<tr><th rowspan=2 >Metrics</th><th >GPT-3.5-turbo</th><th></th><th >Claude-2</th><th >GPT-4</th></tr>\n<tr><th >Zero</th><th >Few</th><th >Zero Few</th><th >Zero Few</th></tr>\n<tr><td >CLIP Score</td><td >0.0</td><td >0.0</td><td >0.0 0.2543</td><td >0.0 0.3055</td></tr>\n<tr><td >BERT Score</td><td >0.1914</td><td >0.3820</td><td >0.2111 0.5038</td><td >0.2076 0.6307</td></tr>\n<tr><td >ViT Score</td><td >0.2437</td><td >0.7497</td><td >0.4082 0.5416</td><td >0.5058 0.6480</td></tr>\n<tr><td >Overall</td><td >0.1450</td><td >0.3772</td><td >0.2064 0.4332</td><td >0.2378 0.5281</td></tr>\n</table>",
|
269 |
-
"doc_id": "c790da40ea8911ee928e0242ac180005",
|
270 |
-
"doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
|
271 |
-
"img_id": "afab9fdad6e511eebdb20242ac180006-d0bc7892c3ec4aeac071544fd56730a8",
|
272 |
-
"important_kwd": [],
|
273 |
-
"kb_id": "afab9fdad6e511eebdb20242ac180006",
|
274 |
-
"positions": [
|
275 |
-
[
|
276 |
-
9.0,
|
277 |
-
159.9383341471354,
|
278 |
-
472.1773274739583,
|
279 |
-
223.58013916015625,
|
280 |
-
307.86692301432294
|
281 |
-
]
|
282 |
-
],
|
283 |
-
"similarity": 0.7310340654129031,
|
284 |
-
"term_similarity": 0.7671974387781668,
|
285 |
-
"vector_similarity": 0.40556370512552886
|
286 |
-
},
|
287 |
-
{
|
288 |
-
"chunk_id": "7e2345d440383b756670e1b0f43a7007",
|
289 |
-
"content_ltks": "5.5 experiment analysi the main experiment result are tabul in tab . 1 and 2 , showcas the result for closed-sourc and open-sourc llm , respect . the overal perform is calcul a the averag of cllp 8 bert and vit score . here , onli the task descript of the benchmark task are fed into llm(addit inform , such a the input prompt and llm\u2019output , is provid in fig . a.4 and a.5 in supplementari). broadli speak , closed-sourc llm demonstr superior perform on openagi task , with gpt-4 lead the pack under both zero-and few-shot scenario . in the open-sourc categori , llama-2-13b take the lead , consist post top result across variou learn schema--the perform possibl influenc by it larger model size . notabl , open-sourc llm significantli benefit from the tune method , particularli fine-tun and\u2019rltf . these method mark notic enhanc for flan-t5-larg , vicuna-7b , and llama-2-13b when compar with zero-shot and few-shot learn schema . in fact , each of these open-sourc model hit it pinnacl under the rltf approach . conclus , with rltf tune , the perform of llama-2-13b approach that of gpt-3.5 , illustr it potenti .",
|
290 |
-
"content_with_weight": "5.5 Experimental Analysis\nThe main experimental results are tabulated in Tab. 1 and 2, showcasing the results for closed-source and open-source LLMs, respectively. The overall performance is calculated as the average of CLlP\n8\nBERT and ViT scores. Here, only the task descriptions of the benchmark tasks are fed into LLMs (additional information, such as the input prompt and LLMs\u2019 outputs, is provided in Fig. A.4 and A.5 in supplementary). Broadly speaking, closed-source LLMs demonstrate superior performance on OpenAGI tasks, with GPT-4 leading the pack under both zero- and few-shot scenarios. In the open-source category, LLaMA-2-13B takes the lead, consistently posting top results across various learning schema--the performance possibly influenced by its larger model size. Notably, open-source LLMs significantly benefit from the tuning methods, particularly Fine-tuning and\u2019 RLTF. These methods mark noticeable enhancements for Flan-T5-Large, Vicuna-7B, and LLaMA-2-13B when compared with zero-shot and few-shot learning schema. In fact, each of these open-source models hits its pinnacle under the RLTF approach. Conclusively, with RLTF tuning, the performance of LLaMA-2-13B approaches that of GPT-3.5, illustrating its potential.",
|
291 |
-
"doc_id": "c790da40ea8911ee928e0242ac180005",
|
292 |
-
"doc_name": "OpenAGI When LLM Meets Domain Experts.pdf",
|
293 |
-
"img_id": "afab9fdad6e511eebdb20242ac180006-7e2345d440383b756670e1b0f43a7007",
|
294 |
-
"important_kwd": [],
|
295 |
-
"kb_id": "afab9fdad6e511eebdb20242ac180006",
|
296 |
-
"positions": [
|
297 |
-
[
|
298 |
-
8.0,
|
299 |
-
107.3,
|
300 |
-
508.90000000000003,
|
301 |
-
686.3,
|
302 |
-
697.0
|
303 |
-
]
|
304 |
-
],
|
305 |
-
"similarity": 0.6691508616357027,
|
306 |
-
"term_similarity": 0.6999011754270821,
|
307 |
-
"vector_similarity": 0.39239803751328806
|
308 |
-
}
|
309 |
-
],
|
310 |
-
"doc_aggs": {
|
311 |
-
"OpenAGI When LLM Meets Domain Experts.pdf": 4
|
312 |
-
},
|
313 |
-
"total": 8
|
314 |
-
}
|
315 |
-
},
|
316 |
-
"retcode": 0,
|
317 |
-
"retmsg": "success"
|
318 |
-
}
|
319 |
-
```
|
320 |
-
|
321 |
-
## Get document content
|
322 |
-
|
323 |
-
This method retrieves the content of a document.
|
324 |
-
|
325 |
-
### Request
|
326 |
-
|
327 |
-
#### Request URI
|
328 |
-
|
329 |
-
| Method | Request URI |
|
330 |
-
|----------|-------------------------------------------------------------|
|
331 |
-
| GET | `/document/get/<id>` |
|
332 |
-
|
333 |
-
### Response
|
334 |
-
|
335 |
-
A binary file.
|
336 |
-
|
337 |
-
## Upload file
|
338 |
-
|
339 |
-
This method uploads a specific file to a specified knowledge base.
|
340 |
-
|
341 |
-
### Request
|
342 |
-
|
343 |
-
#### Request URI
|
344 |
-
|
345 |
-
| Method | Request URI |
|
346 |
-
|----------|-------------------------------------------------------------|
|
347 |
-
| POST | `/api/document/upload` |
|
348 |
-
|
349 |
-
#### Response parameter
|
350 |
-
|
351 |
-
| Name | Type | Required | Description |
|
352 |
-
|-------------|--------|----------|---------------------------------------------------------|
|
353 |
-
| `file` | file | Yes | The file to upload. |
|
354 |
-
| `kb_name` | string | Yes | The name of the knowledge base to upload the file to. |
|
355 |
-
| `parser_id` | string | No | The parsing method (chunk template) to use. <br />- "naive": General;<br />- "qa": Q&A;<br />- "manual": Manual;<br />- "table": Table;<br />- "paper": Paper;<br />- "laws": Laws;<br />- "presentation": Presentation;<br />- "picture": Picture;<br />- "one": One. |
|
356 |
-
| `run` | string | No | 1: Automatically start file parsing. If `parser_id` is not set, RAGFlow uses the general template by default. |
|
357 |
-
|
358 |
-
|
359 |
-
### Response
|
360 |
-
|
361 |
-
```json
|
362 |
-
{
|
363 |
-
"data": {
|
364 |
-
"chunk_num": 0,
|
365 |
-
"create_date": "Thu, 25 Apr 2024 14:30:06 GMT",
|
366 |
-
"create_time": 1714026606921,
|
367 |
-
"created_by": "553ec818fd5711ee8ea63043d7ed348e",
|
368 |
-
"id": "41e9324602cd11ef9f5f3043d7ed348e",
|
369 |
-
"kb_id": "06802686c0a311ee85d6246e9694c130",
|
370 |
-
"location": "readme.txt",
|
371 |
-
"name": "readme.txt",
|
372 |
-
"parser_config": {
|
373 |
-
"field_map": {
|
374 |
-
},
|
375 |
-
"pages": [
|
376 |
-
[
|
377 |
-
0,
|
378 |
-
1000000
|
379 |
-
]
|
380 |
-
]
|
381 |
-
},
|
382 |
-
"parser_id": "general",
|
383 |
-
"process_begin_at": null,
|
384 |
-
"process_duation": 0.0,
|
385 |
-
"progress": 0.0,
|
386 |
-
"progress_msg": "",
|
387 |
-
"run": "0",
|
388 |
-
"size": 929,
|
389 |
-
"source_type": "local",
|
390 |
-
"status": "1",
|
391 |
-
"thumbnail": null,
|
392 |
-
"token_num": 0,
|
393 |
-
"type": "doc",
|
394 |
-
"update_date": "Thu, 25 Apr 2024 14:30:06 GMT",
|
395 |
-
"update_time": 1714026606921
|
396 |
-
},
|
397 |
-
"retcode": 0,
|
398 |
-
"retmsg": "success"
|
399 |
-
}
|
400 |
-
```
|
401 |
-
### Demo for Upload File(Python)
|
402 |
-
|
403 |
-
```python
|
404 |
-
# upload_to_kb.py
|
405 |
-
import requests
|
406 |
-
|
407 |
-
|
408 |
-
def upload_file_to_kb(file_path, kb_name, token='ragflow-xxxxxxxxxxxxx', parser_id='naive'):
|
409 |
-
"""
|
410 |
-
Uploads a file to a knowledge base.
|
411 |
-
|
412 |
-
Args:
|
413 |
-
- file_path: Path to the file to upload.
|
414 |
-
- kb_name: Name of the target knowledge base.
|
415 |
-
- parser_id: ID of the chosen file parser (defaults to 'naive').
|
416 |
-
- token: API token for authentication.
|
417 |
-
"""
|
418 |
-
url = 'http://127.0.0.1/v1/api/document/upload' # Replace with your actual API URL
|
419 |
-
files = {'file': open(file_path, 'rb')} # The file to upload
|
420 |
-
data = {'kb_name': kb_name, 'parser_id': parser_id, 'run': '1'} # Additional form data
|
421 |
-
headers = {'Authorization': f'Bearer {token}'} # Replace with your actual Bearer token
|
422 |
-
|
423 |
-
response = requests.post(url, files=files, data=data, headers=headers)
|
424 |
-
|
425 |
-
if response.status_code == 200:
|
426 |
-
print("File uploaded successfully:", response.json())
|
427 |
-
else:
|
428 |
-
print("Failed to upload file:", response.status_code, response.text)
|
429 |
-
|
430 |
-
file_to_upload = './ai_intro.pdf' # For example: './documents/report.pdf'
|
431 |
-
knowledge_base_name = 'AI_knowledge_base'
|
432 |
-
# Assume you have already obtained your token and set it here
|
433 |
-
token = 'ragflow-xxxxxxxxxxxxx'
|
434 |
-
|
435 |
-
# Call the function to upload the file
|
436 |
-
upload_file_to_kb(file_to_upload, knowledge_base_name, token=token)
|
437 |
-
```
|
438 |
-
## Get document chunks
|
439 |
-
|
440 |
-
This method retrieves the chunks of a specific document by `doc_name` or `doc_id`.
|
441 |
-
|
442 |
-
### Request
|
443 |
-
|
444 |
-
#### Request URI
|
445 |
-
|
446 |
-
| Method | Request URI |
|
447 |
-
|----------|-------------------------------------------------------------|
|
448 |
-
| GET | `/api/list_chunks` |
|
449 |
-
|
450 |
-
#### Request parameter
|
451 |
-
|
452 |
-
| Name | Type | Required | Description |
|
453 |
-
|------------|--------|----------|---------------------------------------------------------------------------------------------|
|
454 |
-
| `doc_name` | string | No | The name of the document in the knowledge base. It must not be empty if `doc_id` is not set.|
|
455 |
-
| `doc_id` | string | No | The ID of the document in the knowledge base. It must not be empty if `doc_name` is not set.|
|
456 |
-
|
457 |
-
|
458 |
-
### Response
|
459 |
-
|
460 |
-
```json
|
461 |
-
{
|
462 |
-
"data": [
|
463 |
-
{
|
464 |
-
"content": "Figure 14: Per-request neural-net processingof RL-Cache.\n103\n(sn)\nCPU\n 102\nGPU\n8101\n100\n8\n16 64 256 1K\n4K",
|
465 |
-
"doc_name": "RL-Cache.pdf",
|
466 |
-
"img_id": "0335167613f011ef91240242ac120006-b46c3524952f82dbe061ce9b123f2211"
|
467 |
-
},
|
468 |
-
{
|
469 |
-
"content": "4.3 ProcessingOverheadof RL-CacheACKNOWLEDGMENTSThis section evaluates how effectively our RL-Cache implemen-tation leverages modern multi-core CPUs and GPUs to keep the per-request neural-net processing overhead low. Figure 14 depictsThis researchwas supported inpart by the Regional Government of Madrid (grant P2018/TCS-4499, EdgeData-CM)andU.S. National Science Foundation (grants CNS-1763617 andCNS-1717179).REFERENCES",
|
470 |
-
"doc_name": "RL-Cache.pdf",
|
471 |
-
"img_id": "0335167613f011ef91240242ac120006-d4c12c43938eb55d2d8278eea0d7e6d7"
|
472 |
-
}
|
473 |
-
],
|
474 |
-
"retcode": 0,
|
475 |
-
"retmsg": "success"
|
476 |
-
}
|
477 |
-
```
|
478 |
-
|
479 |
-
## Get document list
|
480 |
-
|
481 |
-
This method retrieves a list of documents from a specified knowledge base.
|
482 |
-
|
483 |
-
### Request
|
484 |
-
|
485 |
-
#### Request URI
|
486 |
-
|
487 |
-
| Method | Request URI |
|
488 |
-
|----------|-------------------------------------------------------------|
|
489 |
-
| POST | `/api/list_kb_docs` |
|
490 |
-
|
491 |
-
#### Request parameter
|
492 |
-
|
493 |
-
| Name | Type | Required | Description |
|
494 |
-
|-------------|--------|----------|-----------------------------------------------------------------------|
|
495 |
-
| `kb_name` | string | Yes | The name of the knowledge base, from which you get the document list. |
|
496 |
-
| `page` | int | No | The number of pages, default:1. |
|
497 |
-
| `page_size` | int | No | The number of docs for each page, default:15. |
|
498 |
-
| `orderby` | string | No | `chunk_num`, `create_time`, or `size`, default:`create_time` |
|
499 |
-
| `desc` | bool | No | Default:True. |
|
500 |
-
| `keywords` | string | No | Keyword of the document name. |
|
501 |
-
|
502 |
-
|
503 |
-
### Response
|
504 |
-
|
505 |
-
```json
|
506 |
-
{
|
507 |
-
"data": {
|
508 |
-
"docs": [
|
509 |
-
{
|
510 |
-
"doc_id": "bad89a84168c11ef9ce40242ac120006",
|
511 |
-
"doc_name": "test.xlsx"
|
512 |
-
},
|
513 |
-
{
|
514 |
-
"doc_id": "641a9b4013f111efb53f0242ac120006",
|
515 |
-
"doc_name": "1111.pdf"
|
516 |
-
}
|
517 |
-
],
|
518 |
-
"total": 2
|
519 |
-
},
|
520 |
-
"retcode": 0,
|
521 |
-
"retmsg": "success"
|
522 |
-
}
|
523 |
-
```
|
524 |
-
|
525 |
-
## Delete documents
|
526 |
-
|
527 |
-
This method deletes documents by document ID or name.
|
528 |
-
|
529 |
-
### Request
|
530 |
-
|
531 |
-
#### Request URI
|
532 |
-
|
533 |
-
| Method | Request URI |
|
534 |
-
|----------|-------------------------------------------------------------|
|
535 |
-
| DELETE | `/api/document` |
|
536 |
-
|
537 |
-
#### Request parameter
|
538 |
-
|
539 |
-
| Name | Type | Required | Description |
|
540 |
-
|-------------|--------|----------|----------------------------|
|
541 |
-
| `doc_names` | List | No | A list of document names. It must not be empty if `doc_ids` is not set. |
|
542 |
-
| `doc_ids` | List | No | A list of document IDs. It must not be empty if `doc_names` is not set. |
|
543 |
-
|
544 |
-
|
545 |
-
### Response
|
546 |
-
|
547 |
-
```json
|
548 |
-
{
|
549 |
-
"data": true,
|
550 |
-
"retcode": 0,
|
551 |
-
"retmsg": "success"
|
552 |
-
}
|
553 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
docs/references/faq.md
CHANGED
@@ -49,7 +49,7 @@ Currently, we only support x86 CPU and Nvidia GPU.
|
|
49 |
|
50 |
### 2. Do you offer an API for integration with third-party applications?
|
51 |
|
52 |
-
The corresponding APIs are now available. See the [RAGFlow API Reference](./
|
53 |
|
54 |
### 3. Do you support stream output?
|
55 |
|
|
|
49 |
|
50 |
### 2. Do you offer an API for integration with third-party applications?
|
51 |
|
52 |
+
The corresponding APIs are now available. See the [RAGFlow HTTP API Reference](./http_api_reference.md) or the [RAGFlow Python API Reference](./python_api_reference.md) for more information.
|
53 |
|
54 |
### 3. Do you support stream output?
|
55 |
|
{api → docs/references}/http_api_reference.md
RENAMED
@@ -1,7 +1,11 @@
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
-
#
|
3 |
|
4 |
-
|
5 |
|
6 |
---
|
7 |
|
|
|
1 |
+
---
|
2 |
+
sidebar_position: 0
|
3 |
+
slug: /http_api_reference
|
4 |
+
---
|
5 |
|
6 |
+
# HTTP API Reference
|
7 |
|
8 |
+
This document provides a complete reference for RAGFlow's RESTful API. Before proceeding, please ensure you [have your RAGFlow API key ready for authentication](../guides/develop/acquire_ragflow_api_key.md).
|
9 |
|
10 |
---
|
11 |
|
{api → docs/references}/python_api_reference.md
RENAMED
@@ -1,10 +1,15 @@
|
|
1 |
-
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
4 |
|
5 |
---
|
6 |
|
7 |
-
:::tip
|
8 |
Dataset Management
|
9 |
:::
|
10 |
|
|
|
1 |
+
---
|
2 |
+
sidebar_position: 1
|
3 |
+
slug: /python_api_reference
|
4 |
+
---
|
5 |
|
6 |
+
# Python API Reference
|
7 |
+
|
8 |
+
This document offers a complete reference for RAGFlow's Python APIs. Before proceeding, please ensure you [have your RAGFlow API key ready for authentication](../guides/develop/acquire_ragflow_api_key.md).
|
9 |
|
10 |
---
|
11 |
|
12 |
+
:::tip API GROUPING
|
13 |
Dataset Management
|
14 |
:::
|
15 |
|
docs/references/ragflow_api.md
DELETED
@@ -1,881 +0,0 @@
|
|
1 |
-
---
|
2 |
-
sidebar_class_name: hidden
|
3 |
-
---
|
4 |
-
|
5 |
-
# API reference
|
6 |
-
|
7 |
-
RAGFlow offers RESTful APIs for you to integrate its capabilities into third-party applications.
|
8 |
-
|
9 |
-
## Base URL
|
10 |
-
```
|
11 |
-
http://<host_address>/v1/api/
|
12 |
-
```
|
13 |
-
|
14 |
-
## Dataset URL
|
15 |
-
```
|
16 |
-
http://<host_address>/api/v1/dataset
|
17 |
-
```
|
18 |
-
|
19 |
-
## Authorization
|
20 |
-
|
21 |
-
All of RAGFlow's RESTFul APIs use API key for authorization, so keep it safe and do not expose it to the front end.
|
22 |
-
Put your API key in the request header.
|
23 |
-
|
24 |
-
```buildoutcfg
|
25 |
-
Authorization: Bearer {API_KEY}
|
26 |
-
```
|
27 |
-
|
28 |
-
To get your API key:
|
29 |
-
|
30 |
-
1. In RAGFlow, click **Chat** tab in the middle top of the page.
|
31 |
-
2. Hover over the corresponding dialogue **>** **Chat Bot API** to show the chatbot API configuration page.
|
32 |
-
3. Click **API Key** **>** **Create new key** to create your API key.
|
33 |
-
4. Copy and keep your API key safe.
|
34 |
-
|
35 |
-
## Create dataset
|
36 |
-
|
37 |
-
This method creates (news) a dataset for a specific user.
|
38 |
-
|
39 |
-
### Request
|
40 |
-
|
41 |
-
#### Request URI
|
42 |
-
|
43 |
-
| Method | Request URI |
|
44 |
-
|--------|-------------|
|
45 |
-
| POST | `/dataset` |
|
46 |
-
|
47 |
-
:::note
|
48 |
-
You are *required* to save the `data.dataset_id` value returned in the response data, which is the session ID for all upcoming conversations.
|
49 |
-
:::
|
50 |
-
|
51 |
-
#### Request parameter
|
52 |
-
|
53 |
-
| Name | Type | Required | Description |
|
54 |
-
|----------------|--------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
55 |
-
| `dataset_name` | string | Yes | The unique identifier assigned to each newly created dataset. `dataset_name` must be less than 2 ** 10 characters and cannot be empty. The following character sets are supported: <br />- 26 lowercase English letters (a-z)<br />- 26 uppercase English letters (A-Z)<br />- 10 digits (0-9)<br />- "_", "-", "." |
|
56 |
-
|
57 |
-
### Response
|
58 |
-
|
59 |
-
```json
|
60 |
-
{
|
61 |
-
"code": 0,
|
62 |
-
"data": {
|
63 |
-
"dataset_name": "kb1",
|
64 |
-
"dataset_id": "375e8ada2d3c11ef98f93043d7ee537e"
|
65 |
-
},
|
66 |
-
"message": "success"
|
67 |
-
}
|
68 |
-
```
|
69 |
-
|
70 |
-
## Get dataset list
|
71 |
-
|
72 |
-
This method lists the created datasets for a specific user.
|
73 |
-
|
74 |
-
### Request
|
75 |
-
|
76 |
-
#### Request URI
|
77 |
-
|
78 |
-
| Method | Request URI |
|
79 |
-
|----------|-------------|
|
80 |
-
| GET | `/dataset` |
|
81 |
-
|
82 |
-
### Response
|
83 |
-
|
84 |
-
#### Response parameter
|
85 |
-
|
86 |
-
```json
|
87 |
-
{
|
88 |
-
"code": 0,
|
89 |
-
"data": [
|
90 |
-
{
|
91 |
-
"avatar": null,
|
92 |
-
"chunk_num": 0,
|
93 |
-
"create_date": "Mon, 17 Jun 2024 16:00:05 GMT",
|
94 |
-
"create_time": 1718611205876,
|
95 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
96 |
-
"description": null,
|
97 |
-
"doc_num": 0,
|
98 |
-
"embd_id": "BAAI/bge-large-zh-v1.5",
|
99 |
-
"id": "9bd6424a2c7f11ef81b83043d7ee537e",
|
100 |
-
"language": "Chinese",
|
101 |
-
"name": "dataset3(23)",
|
102 |
-
"parser_config": {
|
103 |
-
"pages": [
|
104 |
-
[
|
105 |
-
1,
|
106 |
-
1000000
|
107 |
-
]
|
108 |
-
]
|
109 |
-
},
|
110 |
-
"parser_id": "naive",
|
111 |
-
"permission": "me",
|
112 |
-
"similarity_threshold": 0.2,
|
113 |
-
"status": "1",
|
114 |
-
"tenant_id": "b48110a0286411ef994a3043d7ee537e",
|
115 |
-
"token_num": 0,
|
116 |
-
"update_date": "Mon, 17 Jun 2024 16:00:05 GMT",
|
117 |
-
"update_time": 1718611205876,
|
118 |
-
"vector_similarity_weight": 0.3
|
119 |
-
}
|
120 |
-
],
|
121 |
-
"message": "List datasets successfully!"
|
122 |
-
}
|
123 |
-
```
|
124 |
-
|
125 |
-
## Delete dataset
|
126 |
-
|
127 |
-
This method deletes a dataset for a specific user.
|
128 |
-
|
129 |
-
### Request
|
130 |
-
|
131 |
-
#### Request URI
|
132 |
-
|
133 |
-
| Method | Request URI |
|
134 |
-
|--------|-------------------------|
|
135 |
-
| DELETE | `/dataset/{dataset_id}` |
|
136 |
-
|
137 |
-
#### Request parameter
|
138 |
-
|
139 |
-
| Name | Type | Required | Description |
|
140 |
-
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
141 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
142 |
-
|
143 |
-
### Response
|
144 |
-
|
145 |
-
```json
|
146 |
-
{
|
147 |
-
"code": 0,
|
148 |
-
"message": "Remove dataset: 9cefaefc2e2611ef916b3043d7ee537e successfully"
|
149 |
-
}
|
150 |
-
```
|
151 |
-
|
152 |
-
### Get the details of the specific dataset
|
153 |
-
|
154 |
-
This method gets the details of the specific dataset.
|
155 |
-
|
156 |
-
### Request
|
157 |
-
|
158 |
-
#### Request URI
|
159 |
-
|
160 |
-
| Method | Request URI |
|
161 |
-
|----------|-------------------------|
|
162 |
-
| GET | `/dataset/{dataset_id}` |
|
163 |
-
|
164 |
-
#### Request parameter
|
165 |
-
|
166 |
-
| Name | Type | Required | Description |
|
167 |
-
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
168 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
169 |
-
|
170 |
-
### Response
|
171 |
-
|
172 |
-
```json
|
173 |
-
{
|
174 |
-
"code": 0,
|
175 |
-
"data": {
|
176 |
-
"avatar": null,
|
177 |
-
"chunk_num": 0,
|
178 |
-
"description": null,
|
179 |
-
"doc_num": 0,
|
180 |
-
"embd_id": "BAAI/bge-large-zh-v1.5",
|
181 |
-
"id": "060323022e3511efa8263043d7ee537e",
|
182 |
-
"language": "Chinese",
|
183 |
-
"name": "test(1)",
|
184 |
-
"parser_config":
|
185 |
-
{
|
186 |
-
"pages": [[1, 1000000]]
|
187 |
-
},
|
188 |
-
"parser_id": "naive",
|
189 |
-
"permission": "me",
|
190 |
-
"token_num": 0
|
191 |
-
},
|
192 |
-
"message": "success"
|
193 |
-
}
|
194 |
-
```
|
195 |
-
|
196 |
-
### Update the details of the specific dataset
|
197 |
-
|
198 |
-
This method updates the details of the specific dataset.
|
199 |
-
|
200 |
-
### Request
|
201 |
-
|
202 |
-
#### Request URI
|
203 |
-
|
204 |
-
| Method | Request URI |
|
205 |
-
|--------|-------------------------|
|
206 |
-
| PUT | `/dataset/{dataset_id}` |
|
207 |
-
|
208 |
-
#### Request parameter
|
209 |
-
|
210 |
-
You are required to input at least one parameter.
|
211 |
-
|
212 |
-
| Name | Type | Required | Description |
|
213 |
-
|----------------------|--------|----------|-----------------------------------------------------------------------|
|
214 |
-
| `name` | string | No | The name of the knowledge base, from which you get the document list. |
|
215 |
-
| `description` | string | No | The description of the knowledge base. |
|
216 |
-
| `permission` | string | No | The permission for the knowledge base, default:me. |
|
217 |
-
| `language` | string | No | The language of the knowledge base. |
|
218 |
-
| `chunk_method` | string | No | The chunk method of the knowledge base. |
|
219 |
-
| `embedding_model_id` | string | No | The embedding model id of the knowledge base. |
|
220 |
-
| `photo` | string | No | The photo of the knowledge base. |
|
221 |
-
| `layout_recognize` | bool | No | The layout recognize of the knowledge base. |
|
222 |
-
| `token_num` | int | No | The token number of the knowledge base. |
|
223 |
-
| `id` | string | No | The id of the knowledge base. |
|
224 |
-
|
225 |
-
### Response
|
226 |
-
|
227 |
-
### Successful response
|
228 |
-
|
229 |
-
```json
|
230 |
-
{
|
231 |
-
"code": 0,
|
232 |
-
"data": {
|
233 |
-
"avatar": null,
|
234 |
-
"chunk_num": 0,
|
235 |
-
"create_date": "Wed, 19 Jun 2024 20:33:34 GMT",
|
236 |
-
"create_time": 1718800414518,
|
237 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
238 |
-
"description": "new_description1",
|
239 |
-
"doc_num": 0,
|
240 |
-
"embd_id": "BAAI/bge-large-zh-v1.5",
|
241 |
-
"id": "24f9f17a2e3811ef820e3043d7ee537e",
|
242 |
-
"language": "English",
|
243 |
-
"name": "new_name",
|
244 |
-
"parser_config":
|
245 |
-
{
|
246 |
-
"pages": [[1, 1000000]]
|
247 |
-
},
|
248 |
-
"parser_id": "naive",
|
249 |
-
"permission": "me",
|
250 |
-
"similarity_threshold": 0.2,
|
251 |
-
"status": "1",
|
252 |
-
"tenant_id": "b48110a0286411ef994a3043d7ee537e",
|
253 |
-
"token_num": 0,
|
254 |
-
"update_date": "Wed, 19 Jun 2024 20:33:34 GMT",
|
255 |
-
"update_time": 1718800414529,
|
256 |
-
"vector_similarity_weight": 0.3
|
257 |
-
},
|
258 |
-
"message": "success"
|
259 |
-
}
|
260 |
-
```
|
261 |
-
|
262 |
-
### Response for the operating error
|
263 |
-
|
264 |
-
```json
|
265 |
-
{
|
266 |
-
"code": 103,
|
267 |
-
"message": "Only the owner of knowledgebase is authorized for this operation!"
|
268 |
-
}
|
269 |
-
```
|
270 |
-
|
271 |
-
### Response for no parameter
|
272 |
-
```json
|
273 |
-
{
|
274 |
-
"code": 102,
|
275 |
-
"message": "Please input at least one parameter that you want to update!"
|
276 |
-
}
|
277 |
-
```
|
278 |
-
|
279 |
-
------------------------------------------------------------------------------------------------------------------------------
|
280 |
-
|
281 |
-
## Upload documents
|
282 |
-
|
283 |
-
This method uploads documents for a specific user.
|
284 |
-
|
285 |
-
### Request
|
286 |
-
|
287 |
-
#### Request URI
|
288 |
-
|
289 |
-
| Method | Request URI |
|
290 |
-
|--------|-----------------------------------|
|
291 |
-
| POST | `/dataset/{dataset_id}/documents` |
|
292 |
-
|
293 |
-
|
294 |
-
#### Request parameter
|
295 |
-
|
296 |
-
| Name | Type | Required | Description |
|
297 |
-
|--------------|--------|----------|------------------------------------------------------------|
|
298 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
299 |
-
|
300 |
-
### Response
|
301 |
-
|
302 |
-
### Successful response
|
303 |
-
|
304 |
-
```json
|
305 |
-
{
|
306 |
-
"code": 0,
|
307 |
-
"data": [
|
308 |
-
{
|
309 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
310 |
-
"id": "859584a0379211efb1a23043d7ee537e",
|
311 |
-
"kb_id": "8591349a379211ef92213043d7ee537e",
|
312 |
-
"location": "test.txt",
|
313 |
-
"name": "test.txt",
|
314 |
-
"parser_config": {
|
315 |
-
"pages": [
|
316 |
-
[1, 1000000]
|
317 |
-
]
|
318 |
-
},
|
319 |
-
"parser_id": "naive",
|
320 |
-
"size": 0,
|
321 |
-
"thumbnail": null,
|
322 |
-
"type": "doc"
|
323 |
-
},
|
324 |
-
{
|
325 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
326 |
-
"id": "8596f18c379211efb1a23043d7ee537e",
|
327 |
-
"kb_id": "8591349a379211ef92213043d7ee537e",
|
328 |
-
"location": "test1.txt",
|
329 |
-
"name": "test1.txt",
|
330 |
-
"parser_config": {
|
331 |
-
"pages": [
|
332 |
-
[1, 1000000]
|
333 |
-
]
|
334 |
-
},
|
335 |
-
"parser_id": "naive",
|
336 |
-
"size": 0,
|
337 |
-
"thumbnail": null,
|
338 |
-
"type": "doc"
|
339 |
-
}
|
340 |
-
],
|
341 |
-
"message": "success"
|
342 |
-
}
|
343 |
-
```
|
344 |
-
|
345 |
-
### Response for nonexistent files
|
346 |
-
|
347 |
-
```json
|
348 |
-
{
|
349 |
-
"code": "RetCode.DATA_ERROR",
|
350 |
-
"message": "The file test_data/imagination.txt does not exist"
|
351 |
-
}
|
352 |
-
```
|
353 |
-
|
354 |
-
### Response for nonexistent dataset
|
355 |
-
|
356 |
-
```json
|
357 |
-
{
|
358 |
-
"code": 102,
|
359 |
-
"message": "Can't find this dataset"
|
360 |
-
}
|
361 |
-
```
|
362 |
-
|
363 |
-
### Response for the number of files exceeding the limit
|
364 |
-
|
365 |
-
```json
|
366 |
-
{
|
367 |
-
"code": 102,
|
368 |
-
"message": "You try to upload 512 files, which exceeds the maximum number of uploading files: 256"
|
369 |
-
}
|
370 |
-
```
|
371 |
-
### Response for uploading without files.
|
372 |
-
|
373 |
-
```json
|
374 |
-
{
|
375 |
-
"code": 101,
|
376 |
-
"message": "None is not string."
|
377 |
-
}
|
378 |
-
```
|
379 |
-
|
380 |
-
## Delete documents
|
381 |
-
|
382 |
-
This method deletes documents for a specific user.
|
383 |
-
|
384 |
-
### Request
|
385 |
-
|
386 |
-
#### Request URI
|
387 |
-
|
388 |
-
| Method | Request URI |
|
389 |
-
|--------|-----------------------------------|
|
390 |
-
| DELETE | `/dataset/{dataset_id}/documents/{document_id}` |
|
391 |
-
|
392 |
-
|
393 |
-
#### Request parameter
|
394 |
-
|
395 |
-
| Name | Type | Required | Description |
|
396 |
-
|---------------|--------|----------|-------------------------------------------------------------------------------------|
|
397 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
398 |
-
| `document_id` | string | Yes | The ID of the document. Call ['GET' /document](#list-documents) to retrieve the ID. |
|
399 |
-
|
400 |
-
### Response
|
401 |
-
|
402 |
-
### Successful response
|
403 |
-
|
404 |
-
```json
|
405 |
-
{
|
406 |
-
"code": 0,
|
407 |
-
"data": true,
|
408 |
-
"message": "success"
|
409 |
-
}
|
410 |
-
```
|
411 |
-
|
412 |
-
### Response for deleting a document that does not exist
|
413 |
-
|
414 |
-
```json
|
415 |
-
{
|
416 |
-
"code": 102,
|
417 |
-
"message": "Document 111 not found!"
|
418 |
-
}
|
419 |
-
```
|
420 |
-
### Response for deleting documents from a non-existent dataset
|
421 |
-
|
422 |
-
```json
|
423 |
-
{
|
424 |
-
"code": 101,
|
425 |
-
"message": "The document f7aba1ec379b11ef8e853043d7ee537e is not in the dataset: 000, but in the dataset: f7a7ccf2379b11ef83223043d7ee537e."
|
426 |
-
}
|
427 |
-
```
|
428 |
-
|
429 |
-
## List documents
|
430 |
-
|
431 |
-
This method lists documents for a specific user.
|
432 |
-
|
433 |
-
### Request
|
434 |
-
|
435 |
-
#### Request URI
|
436 |
-
|
437 |
-
| Method | Request URI |
|
438 |
-
|--------|-----------------------------------|
|
439 |
-
| GET | `/dataset/{dataset_id}/documents` |
|
440 |
-
|
441 |
-
|
442 |
-
#### Request parameter
|
443 |
-
|
444 |
-
| Name | Type | Required | Description |
|
445 |
-
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------|
|
446 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
447 |
-
| `offset` | int | No | The start of the listed documents. Default: 0 |
|
448 |
-
| `count` | int | No | The total count of the listed documents. Default: -1, meaning all the later part of documents from the start. |
|
449 |
-
| `order_by` | string | No | Default: `create_time` |
|
450 |
-
| `descend` | bool | No | The order of listing documents. Default: True |
|
451 |
-
| `keywords` | string | No | The searching keywords of listing documents. Default: "" |
|
452 |
-
|
453 |
-
### Response
|
454 |
-
|
455 |
-
### Successful Response
|
456 |
-
|
457 |
-
```json
|
458 |
-
{
|
459 |
-
"code": 0,
|
460 |
-
"data": {
|
461 |
-
"docs": [
|
462 |
-
{
|
463 |
-
"chunk_num": 0,
|
464 |
-
"create_date": "Mon, 01 Jul 2024 19:24:10 GMT",
|
465 |
-
"create_time": 1719833050046,
|
466 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
467 |
-
"id": "6fb6f588379c11ef87023043d7ee537e",
|
468 |
-
"kb_id": "6fb1c9e6379c11efa3523043d7ee537e",
|
469 |
-
"location": "empty.txt",
|
470 |
-
"name": "empty.txt",
|
471 |
-
"parser_config": {
|
472 |
-
"pages": [
|
473 |
-
[1, 1000000]
|
474 |
-
]
|
475 |
-
},
|
476 |
-
"parser_id": "naive",
|
477 |
-
"process_begin_at": null,
|
478 |
-
"process_duation": 0.0,
|
479 |
-
"progress": 0.0,
|
480 |
-
"progress_msg": "",
|
481 |
-
"run": "0",
|
482 |
-
"size": 0,
|
483 |
-
"source_type": "local",
|
484 |
-
"status": "1",
|
485 |
-
"thumbnail": null,
|
486 |
-
"token_num": 0,
|
487 |
-
"type": "doc",
|
488 |
-
"update_date": "Mon, 01 Jul 2024 19:24:10 GMT",
|
489 |
-
"update_time": 1719833050046
|
490 |
-
},
|
491 |
-
{
|
492 |
-
"chunk_num": 0,
|
493 |
-
"create_date": "Mon, 01 Jul 2024 19:24:10 GMT",
|
494 |
-
"create_time": 1719833050037,
|
495 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
496 |
-
"id": "6fb59c60379c11ef87023043d7ee537e",
|
497 |
-
"kb_id": "6fb1c9e6379c11efa3523043d7ee537e",
|
498 |
-
"location": "test.txt",
|
499 |
-
"name": "test.txt",
|
500 |
-
"parser_config": {
|
501 |
-
"pages": [
|
502 |
-
[1, 1000000]
|
503 |
-
]
|
504 |
-
},
|
505 |
-
"parser_id": "naive",
|
506 |
-
"process_begin_at": null,
|
507 |
-
"process_duation": 0.0,
|
508 |
-
"progress": 0.0,
|
509 |
-
"progress_msg": "",
|
510 |
-
"run": "0",
|
511 |
-
"size": 0,
|
512 |
-
"source_type": "local",
|
513 |
-
"status": "1",
|
514 |
-
"thumbnail": null,
|
515 |
-
"token_num": 0,
|
516 |
-
"type": "doc",
|
517 |
-
"update_date": "Mon, 01 Jul 2024 19:24:10 GMT",
|
518 |
-
"update_time": 1719833050037
|
519 |
-
}
|
520 |
-
],
|
521 |
-
"total": 2
|
522 |
-
},
|
523 |
-
"message": "success"
|
524 |
-
}
|
525 |
-
```
|
526 |
-
|
527 |
-
### Response for listing documents with IndexError
|
528 |
-
|
529 |
-
```json
|
530 |
-
{
|
531 |
-
"code": 100,
|
532 |
-
"message": "IndexError('Offset is out of the valid range.')"
|
533 |
-
}
|
534 |
-
```
|
535 |
-
## Update the details of the document
|
536 |
-
|
537 |
-
This method updates the details, including the name, enable and template type of a specific document for a specific user.
|
538 |
-
|
539 |
-
### Request
|
540 |
-
|
541 |
-
#### Request URI
|
542 |
-
|
543 |
-
| Method | Request URI |
|
544 |
-
|--------|-------------------------------------------------|
|
545 |
-
| PUT | `/dataset/{dataset_id}/documents/{document_id}` |
|
546 |
-
|
547 |
-
|
548 |
-
#### Request parameter
|
549 |
-
|
550 |
-
| Name | Type | Required | Description |
|
551 |
-
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------|
|
552 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
553 |
-
| `document_id` | string | Yes | The ID of the document. Call ['GET' /document](#list-documents) to retrieve the ID. |
|
554 |
-
|
555 |
-
### Response
|
556 |
-
|
557 |
-
### Successful Response
|
558 |
-
|
559 |
-
```json
|
560 |
-
{
|
561 |
-
"code": 0,
|
562 |
-
"data": {
|
563 |
-
"chunk_num": 0,
|
564 |
-
"create_date": "Mon, 15 Jul 2024 16:55:03 GMT",
|
565 |
-
"create_time": 1721033703914,
|
566 |
-
"created_by": "b48110a0286411ef994a3043d7ee537e",
|
567 |
-
"id": "ed30167a428711efab193043d7ee537e",
|
568 |
-
"kb_id": "ed2d8770428711efaf583043d7ee537e",
|
569 |
-
"location": "test.txt",
|
570 |
-
"name": "new_name.txt",
|
571 |
-
"parser_config": {
|
572 |
-
"pages": [
|
573 |
-
[1, 1000000]
|
574 |
-
]
|
575 |
-
},
|
576 |
-
"parser_id": "naive",
|
577 |
-
"process_begin_at": null,
|
578 |
-
"process_duration": 0.0,
|
579 |
-
"progress": 0.0,
|
580 |
-
"progress_msg": "",
|
581 |
-
"run": "0",
|
582 |
-
"size": 14,
|
583 |
-
"source_type": "local",
|
584 |
-
"status": "1",
|
585 |
-
"thumbnail": null,
|
586 |
-
"token_num": 0,
|
587 |
-
"type": "doc",
|
588 |
-
"update_date": "Mon, 15 Jul 2024 16:55:03 GMT",
|
589 |
-
"update_time": 1721033703934
|
590 |
-
},
|
591 |
-
"message": "Success"
|
592 |
-
}
|
593 |
-
```
|
594 |
-
|
595 |
-
### Response for updating a document which does not exist.
|
596 |
-
|
597 |
-
```json
|
598 |
-
{
|
599 |
-
"code": 101,
|
600 |
-
"message": "This document weird_doc_id cannot be found!"
|
601 |
-
}
|
602 |
-
```
|
603 |
-
|
604 |
-
### Response for updating a document without giving parameters.
|
605 |
-
```json
|
606 |
-
{
|
607 |
-
"code": 102,
|
608 |
-
"message": "Please input at least one parameter that you want to update!"
|
609 |
-
}
|
610 |
-
```
|
611 |
-
|
612 |
-
### Response for updating a document in the nonexistent dataset.
|
613 |
-
```json
|
614 |
-
{
|
615 |
-
"code": 102,
|
616 |
-
"message": "This dataset fake_dataset_id cannot be found!"
|
617 |
-
}
|
618 |
-
```
|
619 |
-
|
620 |
-
### Response for updating a document with an extension name that differs from its original.
|
621 |
-
```json
|
622 |
-
{
|
623 |
-
"code": 101,
|
624 |
-
"data": false,
|
625 |
-
"message": "The extension of file cannot be changed"
|
626 |
-
}
|
627 |
-
```
|
628 |
-
|
629 |
-
### Response for updating a document with a duplicate name.
|
630 |
-
```json
|
631 |
-
{
|
632 |
-
"code": 101,
|
633 |
-
"message": "Duplicated document name in the same dataset."
|
634 |
-
}
|
635 |
-
```
|
636 |
-
|
637 |
-
### Response for updating a document's illegal parameter.
|
638 |
-
```json
|
639 |
-
{
|
640 |
-
"code": 101,
|
641 |
-
"message": "illegal_parameter is an illegal parameter."
|
642 |
-
}
|
643 |
-
```
|
644 |
-
|
645 |
-
### Response for updating a document's name without its name value.
|
646 |
-
```json
|
647 |
-
{
|
648 |
-
"code": 102,
|
649 |
-
"message": "There is no new name."
|
650 |
-
}
|
651 |
-
```
|
652 |
-
|
653 |
-
### Response for updating a document's with giving illegal enable's value.
|
654 |
-
```json
|
655 |
-
{
|
656 |
-
"code": 102,
|
657 |
-
"message": "Illegal value '?' for 'enable' field."
|
658 |
-
}
|
659 |
-
```
|
660 |
-
|
661 |
-
## Download the document
|
662 |
-
|
663 |
-
This method downloads a specific document for a specific user.
|
664 |
-
|
665 |
-
### Request
|
666 |
-
|
667 |
-
#### Request URI
|
668 |
-
|
669 |
-
| Method | Request URI |
|
670 |
-
|--------|-------------------------------------------------|
|
671 |
-
| GET | `/dataset/{dataset_id}/documents/{document_id}` |
|
672 |
-
|
673 |
-
|
674 |
-
#### Request parameter
|
675 |
-
|
676 |
-
| Name | Type | Required | Description |
|
677 |
-
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------|
|
678 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
679 |
-
| `document_id` | string | Yes | The ID of the document. Call ['GET' /document](#list-documents) to retrieve the ID. |
|
680 |
-
|
681 |
-
### Response
|
682 |
-
|
683 |
-
### Successful Response
|
684 |
-
|
685 |
-
```json
|
686 |
-
{
|
687 |
-
"code": "0",
|
688 |
-
"data": "b'test\\ntest\\ntest'"
|
689 |
-
}
|
690 |
-
```
|
691 |
-
|
692 |
-
### Response for downloading a document which does not exist.
|
693 |
-
|
694 |
-
```json
|
695 |
-
{
|
696 |
-
"code": 101,
|
697 |
-
"message": "This document 'imagination.txt' cannot be found!"
|
698 |
-
}
|
699 |
-
```
|
700 |
-
|
701 |
-
### Response for downloading a document in the nonexistent dataset.
|
702 |
-
```json
|
703 |
-
{
|
704 |
-
"code": 102,
|
705 |
-
"message": "This dataset 'imagination' cannot be found!"
|
706 |
-
}
|
707 |
-
```
|
708 |
-
|
709 |
-
### Response for downloading an empty document.
|
710 |
-
```json
|
711 |
-
{
|
712 |
-
"code": 102,
|
713 |
-
"message": "This file is empty."
|
714 |
-
}
|
715 |
-
```
|
716 |
-
|
717 |
-
## Start parsing a document
|
718 |
-
|
719 |
-
This method enables a specific document to start parsing for a specific user.
|
720 |
-
|
721 |
-
### Request
|
722 |
-
|
723 |
-
#### Request URI
|
724 |
-
|
725 |
-
| Method | Request URI |
|
726 |
-
|--------|--------------------------------------------------------|
|
727 |
-
| POST | `/dataset/{dataset_id}/documents/{document_id}/status` |
|
728 |
-
|
729 |
-
|
730 |
-
#### Request parameter
|
731 |
-
|
732 |
-
| Name | Type | Required | Description |
|
733 |
-
|--------------|--------|----------|------------------------------------------------------------------------------------------------------------|
|
734 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
735 |
-
| `document_id` | string | Yes | The ID of the document. Call ['GET' /document](#list-documents) to retrieve the ID. |
|
736 |
-
|
737 |
-
### Response
|
738 |
-
|
739 |
-
### Successful Response
|
740 |
-
|
741 |
-
```json
|
742 |
-
{
|
743 |
-
"code": 0,
|
744 |
-
"message": ""
|
745 |
-
}
|
746 |
-
```
|
747 |
-
|
748 |
-
### Response for parsing a document which does not exist.
|
749 |
-
|
750 |
-
```json
|
751 |
-
{
|
752 |
-
"code": 101,
|
753 |
-
"message": "This document 'imagination.txt' cannot be found!"
|
754 |
-
}
|
755 |
-
```
|
756 |
-
|
757 |
-
### Response for parsing a document in the nonexistent dataset.
|
758 |
-
```json
|
759 |
-
{
|
760 |
-
"code": 102,
|
761 |
-
"message": "This dataset 'imagination' cannot be found!"
|
762 |
-
}
|
763 |
-
```
|
764 |
-
|
765 |
-
### Response for parsing an empty document.
|
766 |
-
```json
|
767 |
-
{
|
768 |
-
"code": 0,
|
769 |
-
"message": "Empty data in the document: empty.txt;"
|
770 |
-
}
|
771 |
-
```
|
772 |
-
|
773 |
-
## Start parsing multiple documents
|
774 |
-
|
775 |
-
This method enables multiple documents, including all documents in the specific dataset or specified documents, to start parsing for a specific user.
|
776 |
-
|
777 |
-
### Request
|
778 |
-
|
779 |
-
#### Request URI
|
780 |
-
|
781 |
-
| Method | Request URI |
|
782 |
-
|--------|-------------------------------------------------------|
|
783 |
-
| POST | `/dataset/{dataset_id}/documents/status` |
|
784 |
-
|
785 |
-
|
786 |
-
#### Request parameter
|
787 |
-
|
788 |
-
| Name | Type | Required | Description |
|
789 |
-
|--------------|--------|----------|-----------------------------------------------------------------------------------------------------------------------------------|
|
790 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
791 |
-
| `document_id` | string | Yes | The ID of the document. Call ['GET' /document](#list-documents) to retrieve the ID. |
|
792 |
-
| `doc_ids` | list | No | The document IDs of the documents that the user would like to parse. Default: None, means all documents in the specified dataset. |
|
793 |
-
### Response
|
794 |
-
|
795 |
-
### Successful Response
|
796 |
-
|
797 |
-
```json
|
798 |
-
{
|
799 |
-
"code": 0,
|
800 |
-
"data": true,
|
801 |
-
"message": ""
|
802 |
-
}
|
803 |
-
```
|
804 |
-
|
805 |
-
### Response for parsing documents which does not exist.
|
806 |
-
|
807 |
-
```json
|
808 |
-
{
|
809 |
-
"code": 101,
|
810 |
-
"message": "This document 'imagination.txt' cannot be found!"
|
811 |
-
}
|
812 |
-
```
|
813 |
-
|
814 |
-
### Response for parsing documents in the nonexistent dataset.
|
815 |
-
```json
|
816 |
-
{
|
817 |
-
"code": 102,
|
818 |
-
"message": "This dataset 'imagination' cannot be found!"
|
819 |
-
}
|
820 |
-
```
|
821 |
-
|
822 |
-
### Response for parsing documents, one of which is empty.
|
823 |
-
```json
|
824 |
-
{
|
825 |
-
"code": 0,
|
826 |
-
"data": true,
|
827 |
-
"message": "Empty data in the document: empty.txt; "
|
828 |
-
}
|
829 |
-
```
|
830 |
-
|
831 |
-
## Show the parsing status of the document
|
832 |
-
|
833 |
-
This method shows the parsing status of the document for a specific user.
|
834 |
-
|
835 |
-
### Request
|
836 |
-
|
837 |
-
#### Request URI
|
838 |
-
|
839 |
-
| Method | Request URI |
|
840 |
-
|--------|-------------------------------------------------------|
|
841 |
-
| GET | `/dataset/{dataset_id}/documents/status` |
|
842 |
-
|
843 |
-
|
844 |
-
#### Request parameter
|
845 |
-
|
846 |
-
| Name | Type | Required | Description |
|
847 |
-
|--------------|--------|----------|-----------------------------------------------------------------------------------------------------------------------------------|
|
848 |
-
| `dataset_id` | string | Yes | The ID of the dataset. Call ['GET' /dataset](#create-dataset) to retrieve the ID. |
|
849 |
-
| `document_id` | string | Yes | The ID of the document. Call ['GET' /document](#list-documents) to retrieve the ID. |
|
850 |
-
|
851 |
-
### Response
|
852 |
-
|
853 |
-
### Successful Response
|
854 |
-
|
855 |
-
```json
|
856 |
-
{
|
857 |
-
"code": 0,
|
858 |
-
"data": {
|
859 |
-
"progress": 0.0,
|
860 |
-
"status": "RUNNING"
|
861 |
-
},
|
862 |
-
"message": "success"
|
863 |
-
}
|
864 |
-
```
|
865 |
-
|
866 |
-
### Response for showing the parsing status of a document which does not exist.
|
867 |
-
|
868 |
-
```json
|
869 |
-
{
|
870 |
-
"code": 102,
|
871 |
-
"message": "This document: 'imagination.txt' is not a valid document."
|
872 |
-
}
|
873 |
-
```
|
874 |
-
|
875 |
-
### Response for showing the parsing status of a document in the nonexistent dataset.
|
876 |
-
```json
|
877 |
-
{
|
878 |
-
"code": 102,
|
879 |
-
"message": "This dataset 'imagination' cannot be found!"
|
880 |
-
}
|
881 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/src/components/api-service/chat-overview-modal/api-content.tsx
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import HightLightMarkdown from '@/components/highlight-markdown';
|
2 |
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Button, Card, Flex, Space } from 'antd';
|
4 |
-
// import apiDoc from '../../../../../
|
5 |
-
import apiDoc from '@parent/
|
6 |
import ChatApiKeyModal from '../chat-api-key-modal';
|
7 |
import EmbedModal from '../embed-modal';
|
8 |
import { usePreviewChat, useShowEmbedModal } from '../hooks';
|
|
|
1 |
import HightLightMarkdown from '@/components/highlight-markdown';
|
2 |
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
3 |
import { Button, Card, Flex, Space } from 'antd';
|
4 |
+
// import apiDoc from '../../../../../docs/references/http_api_reference.md';
|
5 |
+
import apiDoc from '@parent/docs/references/http_api_reference.md';
|
6 |
import ChatApiKeyModal from '../chat-api-key-modal';
|
7 |
import EmbedModal from '../embed-modal';
|
8 |
import { usePreviewChat, useShowEmbedModal } from '../hooks';
|