template.en.mdx 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320
  1. import { CodeGroup } from '@/app/components/develop/code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '@/app/components/develop/md.tsx'
  3. # Knowledge API
  4. <div>
  5. ### Authentication
  6. Service API of Dify authenticates using an `API-Key`.
  7. It is suggested that developers store the `API-Key` in the backend instead of sharing or storing it in the client side to avoid the leakage of the `API-Key`, which may lead to property loss.
  8. All API requests should include your `API-Key` in the **`Authorization`** HTTP Header, as shown below:
  9. <CodeGroup title="Code">
  10. ```javascript
  11. Authorization: Bearer {API_KEY}
  12. ```
  13. </CodeGroup>
  14. </div>
  15. ---
  16. <Heading
  17. url='/datasets/{dataset_id}/document/create_by_text'
  18. method='POST'
  19. title='Create a document from text'
  20. name='#create_by_text'
  21. />
  22. <Row>
  23. <Col>
  24. This api is based on an existing Knowledge and creates a new document through text based on this Knowledge.
  25. ### Params
  26. <Properties>
  27. <Property name='dataset_id' type='string' key='dataset_id'>
  28. Knowledge ID
  29. </Property>
  30. </Properties>
  31. ### Request Body
  32. <Properties>
  33. <Property name='name' type='string' key='name'>
  34. Document name
  35. </Property>
  36. <Property name='text' type='string' key='text'>
  37. Document content
  38. </Property>
  39. <Property name='indexing_technique' type='string' key='indexing_technique'>
  40. Index mode
  41. - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index
  42. - <code>economy</code> Economy: Build using inverted index of Keyword Table Index
  43. </Property>
  44. <Property name='process_rule' type='object' key='process_rule'>
  45. Processing rules
  46. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom
  47. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  48. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  49. - <code>id</code> (string) Unique identifier for the preprocessing rule
  50. - enumerate
  51. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  52. - <code>remove_urls_emails</code> Delete URL, email address
  53. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  54. - <code>segmentation</code> (object) segmentation rules
  55. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  56. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  57. </Property>
  58. </Properties>
  59. </Col>
  60. <Col sticky>
  61. <CodeGroup
  62. title="Request"
  63. tag="POST"
  64. label="/datasets/{dataset_id}/document/create_by_text"
  65. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "text","text": "text","indexing_technique": "high_quality","process_rule": {"mode": "automatic"}}'`}
  66. >
  67. ```bash {{ title: 'cURL' }}
  68. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_text' \
  69. --header 'Authorization: Bearer {api_key}' \
  70. --header 'Content-Type: application/json' \
  71. --data-raw '{
  72. "name": "text",
  73. "text": "text",
  74. "indexing_technique": "high_quality",
  75. "process_rule": {
  76. "mode": "automatic"
  77. }
  78. }'
  79. ```
  80. </CodeGroup>
  81. <CodeGroup title="Response">
  82. ```json {{ title: 'Response' }}
  83. {
  84. "document": {
  85. "id": "",
  86. "position": 1,
  87. "data_source_type": "upload_file",
  88. "data_source_info": {
  89. "upload_file_id": ""
  90. },
  91. "dataset_process_rule_id": "",
  92. "name": "text.txt",
  93. "created_from": "api",
  94. "created_by": "",
  95. "created_at": 1695690280,
  96. "tokens": 0,
  97. "indexing_status": "waiting",
  98. "error": null,
  99. "enabled": true,
  100. "disabled_at": null,
  101. "disabled_by": null,
  102. "archived": false,
  103. "display_status": "queuing",
  104. "word_count": 0,
  105. "hit_count": 0,
  106. "doc_form": "text_model"
  107. },
  108. "batch": ""
  109. }
  110. ```
  111. </CodeGroup>
  112. </Col>
  113. </Row>
  114. ---
  115. <Heading
  116. url='/datasets/{dataset_id}/document/create_by_file'
  117. method='POST'
  118. title='Create documents from files'
  119. name='#create_by_file'
  120. />
  121. <Row>
  122. <Col>
  123. This api is based on an existing Knowledge and creates a new document through a file based on this Knowledge.
  124. ### Params
  125. <Properties>
  126. <Property name='dataset_id' type='string' key='dataset_id'>
  127. Knowledge ID
  128. </Property>
  129. </Properties>
  130. ### Request Body
  131. <Properties>
  132. <Property name='data' type='multipart/form-data json string' key='data'>
  133. - original_document_id Source document ID (optional)
  134. - Used to re-upload the document or modify the document cleaning and segmentation configuration. The missing information is copied from the source document
  135. - The source document cannot be an archived document
  136. - When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by default
  137. - When original_document_id is not passed in, the new operation is performed on behalf of the document, and process_rule is required
  138. - indexing_technique Index mode
  139. - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index
  140. - <code>economy</code> Economy: Build using inverted index of Keyword Table Index
  141. - process_rule Processing rules
  142. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom
  143. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  144. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  145. - <code>id</code> (string) Unique identifier for the preprocessing rule
  146. - enumerate
  147. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  148. - <code>remove_urls_emails</code> Delete URL, email address
  149. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  150. - <code>segmentation</code> (object) segmentation rules
  151. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  152. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  153. </Property>
  154. <Property name='file' type='multipart/form-data' key='file'>
  155. Files that need to be uploaded.
  156. </Property>
  157. </Properties>
  158. </Col>
  159. <Col sticky>
  160. <CodeGroup
  161. title="Request"
  162. tag="POST"
  163. label="/datasets/{dataset_id}/document/create_by_file"
  164. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
  165. >
  166. ```bash {{ title: 'cURL' }}
  167. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \
  168. --header 'Authorization: Bearer {api_key}' \
  169. --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
  170. --form 'file=@"/path/to/file"'
  171. ```
  172. </CodeGroup>
  173. <CodeGroup title="Response">
  174. ```json {{ title: 'Response' }}
  175. {
  176. "document": {
  177. "id": "",
  178. "position": 1,
  179. "data_source_type": "upload_file",
  180. "data_source_info": {
  181. "upload_file_id": ""
  182. },
  183. "dataset_process_rule_id": "",
  184. "name": "Dify.txt",
  185. "created_from": "api",
  186. "created_by": "",
  187. "created_at": 1695308667,
  188. "tokens": 0,
  189. "indexing_status": "waiting",
  190. "error": null,
  191. "enabled": true,
  192. "disabled_at": null,
  193. "disabled_by": null,
  194. "archived": false,
  195. "display_status": "queuing",
  196. "word_count": 0,
  197. "hit_count": 0,
  198. "doc_form": "text_model"
  199. },
  200. "batch": ""
  201. }
  202. ```
  203. </CodeGroup>
  204. </Col>
  205. </Row>
  206. ---
  207. <Heading
  208. url='/datasets'
  209. method='POST'
  210. title='Create an empty Knowledge'
  211. name='#create_empty_dataset'
  212. />
  213. <Row>
  214. <Col>
  215. ### Request Body
  216. <Properties>
  217. <Property name='name' type='string' key='name'>
  218. Knowledge name
  219. </Property>
  220. <Property name='description' type='string' key='description'>
  221. Knowledge description (optional)
  222. </Property>
  223. <Property name='indexing_technique' type='string' key='indexing_technique'>
  224. Index Technique (optional)
  225. - <code>high_quality</code> high_quality
  226. - <code>economy</code> economy
  227. </Property>
  228. <Property name='permission' type='string' key='permission'>
  229. Permission
  230. - <code>only_me</code> Only me
  231. - <code>all_team_members</code> All team members
  232. - <code>partial_members</code> Partial members
  233. </Property>
  234. <Property name='provider' type='string' key='provider'>
  235. Provider (optional, default: vendor)
  236. - <code>vendor</code> vendor
  237. - <code>external</code> external knowledge
  238. </Property>
  239. <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
  240. External Knowledge api id (optional)
  241. </Property>
  242. <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
  243. External Knowledge id (optional)
  244. </Property>
  245. </Properties>
  246. </Col>
  247. <Col sticky>
  248. <CodeGroup
  249. title="Request"
  250. tag="POST"
  251. label="/datasets"
  252. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name", "permission": "only_me"}'`}
  253. >
  254. ```bash {{ title: 'cURL' }}
  255. curl --location --request POST '${apiBaseUrl}/v1/datasets' \
  256. --header 'Authorization: Bearer {api_key}' \
  257. --header 'Content-Type: application/json' \
  258. --data-raw '{
  259. "name": "name",
  260. "permission": "only_me"
  261. }'
  262. ```
  263. </CodeGroup>
  264. <CodeGroup title="Response">
  265. ```json {{ title: 'Response' }}
  266. {
  267. "id": "",
  268. "name": "name",
  269. "description": null,
  270. "provider": "vendor",
  271. "permission": "only_me",
  272. "data_source_type": null,
  273. "indexing_technique": null,
  274. "app_count": 0,
  275. "document_count": 0,
  276. "word_count": 0,
  277. "created_by": "",
  278. "created_at": 1695636173,
  279. "updated_by": "",
  280. "updated_at": 1695636173,
  281. "embedding_model": null,
  282. "embedding_model_provider": null,
  283. "embedding_available": null
  284. }
  285. ```
  286. </CodeGroup>
  287. </Col>
  288. </Row>
  289. ---
  290. <Heading
  291. url='/datasets'
  292. method='GET'
  293. title='Knowledge list'
  294. name='#dataset_list'
  295. />
  296. <Row>
  297. <Col>
  298. ### Query
  299. <Properties>
  300. <Property name='page' type='string' key='page'>
  301. Page number
  302. </Property>
  303. <Property name='limit' type='string' key='limit'>
  304. Number of items returned, default 20, range 1-100
  305. </Property>
  306. </Properties>
  307. </Col>
  308. <Col sticky>
  309. <CodeGroup
  310. title="Request"
  311. tag="POST"
  312. label="/datasets"
  313. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  314. >
  315. ```bash {{ title: 'cURL' }}
  316. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  317. --header 'Authorization: Bearer {api_key}'
  318. ```
  319. </CodeGroup>
  320. <CodeGroup title="Response">
  321. ```json {{ title: 'Response' }}
  322. {
  323. "data": [
  324. {
  325. "id": "",
  326. "name": "name",
  327. "description": "desc",
  328. "permission": "only_me",
  329. "data_source_type": "upload_file",
  330. "indexing_technique": "",
  331. "app_count": 2,
  332. "document_count": 10,
  333. "word_count": 1200,
  334. "created_by": "",
  335. "created_at": "",
  336. "updated_by": "",
  337. "updated_at": ""
  338. },
  339. ...
  340. ],
  341. "has_more": true,
  342. "limit": 20,
  343. "total": 50,
  344. "page": 1
  345. }
  346. ```
  347. </CodeGroup>
  348. </Col>
  349. </Row>
  350. ---
  351. <Heading
  352. url='/datasets/{dataset_id}'
  353. method='DELETE'
  354. title='Delete knowledge'
  355. name='#delete_dataset'
  356. />
  357. <Row>
  358. <Col>
  359. ### Params
  360. <Properties>
  361. <Property name='dataset_id' type='string' key='dataset_id'>
  362. Knowledge ID
  363. </Property>
  364. </Properties>
  365. </Col>
  366. <Col sticky>
  367. <CodeGroup
  368. title="Request"
  369. tag="DELETE"
  370. label="/datasets/{dataset_id}"
  371. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  372. >
  373. ```bash {{ title: 'cURL' }}
  374. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
  375. --header 'Authorization: Bearer {api_key}'
  376. ```
  377. </CodeGroup>
  378. <CodeGroup title="Response">
  379. ```text {{ title: 'Response' }}
  380. 204 No Content
  381. ```
  382. </CodeGroup>
  383. </Col>
  384. </Row>
  385. ---
  386. <Heading
  387. url='/datasets/{dataset_id}/documents/{document_id}/update_by_text'
  388. method='POST'
  389. title='Update document via text'
  390. name='#update_by_text'
  391. />
  392. <Row>
  393. <Col>
  394. This api is based on an existing Knowledge and updates the document through text based on this Knowledge.
  395. ### Params
  396. <Properties>
  397. <Property name='dataset_id' type='string' key='dataset_id'>
  398. Knowledge ID
  399. </Property>
  400. <Property name='document_id' type='string' key='document_id'>
  401. Document ID
  402. </Property>
  403. </Properties>
  404. ### Request Body
  405. <Properties>
  406. <Property name='name' type='string' key='name'>
  407. Document name (optional)
  408. </Property>
  409. <Property name='text' type='string' key='text'>
  410. Document content (optional)
  411. </Property>
  412. <Property name='process_rule' type='object' key='process_rule'>
  413. Processing rules
  414. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom
  415. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  416. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  417. - <code>id</code> (string) Unique identifier for the preprocessing rule
  418. - enumerate
  419. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  420. - <code>remove_urls_emails</code> Delete URL, email address
  421. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  422. - <code>segmentation</code> (object) segmentation rules
  423. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  424. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  425. </Property>
  426. </Properties>
  427. </Col>
  428. <Col sticky>
  429. <CodeGroup
  430. title="Request"
  431. tag="POST"
  432. label="/datasets/{dataset_id}/documents/{document_id}/update_by_text"
  433. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update_by_text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name","text": "text"}'`}
  434. >
  435. ```bash {{ title: 'cURL' }}
  436. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update_by_text' \
  437. --header 'Authorization: Bearer {api_key}' \
  438. --header 'Content-Type: application/json' \
  439. --data-raw '{
  440. "name": "name",
  441. "text": "text"
  442. }'
  443. ```
  444. </CodeGroup>
  445. <CodeGroup title="Response">
  446. ```json {{ title: 'Response' }}
  447. {
  448. "document": {
  449. "id": "",
  450. "position": 1,
  451. "data_source_type": "upload_file",
  452. "data_source_info": {
  453. "upload_file_id": ""
  454. },
  455. "dataset_process_rule_id": "",
  456. "name": "name.txt",
  457. "created_from": "api",
  458. "created_by": "",
  459. "created_at": 1695308667,
  460. "tokens": 0,
  461. "indexing_status": "waiting",
  462. "error": null,
  463. "enabled": true,
  464. "disabled_at": null,
  465. "disabled_by": null,
  466. "archived": false,
  467. "display_status": "queuing",
  468. "word_count": 0,
  469. "hit_count": 0,
  470. "doc_form": "text_model"
  471. },
  472. "batch": ""
  473. }
  474. ```
  475. </CodeGroup>
  476. </Col>
  477. </Row>
  478. ---
  479. <Heading
  480. url='/datasets/{dataset_id}/documents/{document_id}/update_by_file'
  481. method='POST'
  482. title='Update a document from a file'
  483. name='#update_by_file'
  484. />
  485. <Row>
  486. <Col>
  487. This api is based on an existing Knowledge, and updates documents through files based on this Knowledge
  488. ### Params
  489. <Properties>
  490. <Property name='dataset_id' type='string' key='dataset_id'>
  491. Knowledge ID
  492. </Property>
  493. <Property name='document_id' type='string' key='document_id'>
  494. Document ID
  495. </Property>
  496. </Properties>
  497. ### Request Body
  498. <Properties>
  499. <Property name='name' type='string' key='name'>
  500. Document name (optional)
  501. </Property>
  502. <Property name='file' type='multipart/form-data' key='file'>
  503. Files to be uploaded
  504. </Property>
  505. <Property name='process_rule' type='object' key='process_rule'>
  506. Processing rules
  507. - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom
  508. - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty)
  509. - <code>pre_processing_rules</code> (array[object]) Preprocessing rules
  510. - <code>id</code> (string) Unique identifier for the preprocessing rule
  511. - enumerate
  512. - <code>remove_extra_spaces</code> Replace consecutive spaces, newlines, tabs
  513. - <code>remove_urls_emails</code> Delete URL, email address
  514. - <code>enabled</code> (bool) Whether to select this rule or not. If no document ID is passed in, it represents the default value.
  515. - <code>segmentation</code> (object) segmentation rules
  516. - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n
  517. - <code>max_tokens</code> Maximum length (token) defaults to 1000
  518. </Property>
  519. </Properties>
  520. </Col>
  521. <Col sticky>
  522. <CodeGroup
  523. title="Request"
  524. tag="POST"
  525. label="/datasets/{dataset_id}/documents/{document_id}/update_by_file"
  526. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update_by_file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
  527. >
  528. ```bash {{ title: 'cURL' }}
  529. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update_by_file' \
  530. --header 'Authorization: Bearer {api_key}' \
  531. --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
  532. --form 'file=@"/path/to/file"'
  533. ```
  534. </CodeGroup>
  535. <CodeGroup title="Response">
  536. ```json {{ title: 'Response' }}
  537. {
  538. "document": {
  539. "id": "",
  540. "position": 1,
  541. "data_source_type": "upload_file",
  542. "data_source_info": {
  543. "upload_file_id": ""
  544. },
  545. "dataset_process_rule_id": "",
  546. "name": "Dify.txt",
  547. "created_from": "api",
  548. "created_by": "",
  549. "created_at": 1695308667,
  550. "tokens": 0,
  551. "indexing_status": "waiting",
  552. "error": null,
  553. "enabled": true,
  554. "disabled_at": null,
  555. "disabled_by": null,
  556. "archived": false,
  557. "display_status": "queuing",
  558. "word_count": 0,
  559. "hit_count": 0,
  560. "doc_form": "text_model"
  561. },
  562. "batch": "20230921150427533684"
  563. }
  564. ```
  565. </CodeGroup>
  566. </Col>
  567. </Row>
  568. ---
  569. <Heading
  570. url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
  571. method='GET'
  572. title='Get document embedding status (progress)'
  573. name='#indexing_status'
  574. />
  575. <Row>
  576. <Col>
  577. ### Params
  578. <Properties>
  579. <Property name='dataset_id' type='string' key='dataset_id'>
  580. Knowledge ID
  581. </Property>
  582. <Property name='batch' type='string' key='batch'>
  583. Batch number of uploaded documents
  584. </Property>
  585. </Properties>
  586. </Col>
  587. <Col sticky>
  588. <CodeGroup
  589. title="Request"
  590. tag="GET"
  591. label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
  592. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
  593. >
  594. ```bash {{ title: 'cURL' }}
  595. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
  596. --header 'Authorization: Bearer {api_key}' \
  597. ```
  598. </CodeGroup>
  599. <CodeGroup title="Response">
  600. ```json {{ title: 'Response' }}
  601. {
  602. "data":[{
  603. "id": "",
  604. "indexing_status": "indexing",
  605. "processing_started_at": 1681623462.0,
  606. "parsing_completed_at": 1681623462.0,
  607. "cleaning_completed_at": 1681623462.0,
  608. "splitting_completed_at": 1681623462.0,
  609. "completed_at": null,
  610. "paused_at": null,
  611. "error": null,
  612. "stopped_at": null,
  613. "completed_segments": 24,
  614. "total_segments": 100
  615. }]
  616. }
  617. ```
  618. </CodeGroup>
  619. </Col>
  620. </Row>
  621. ---
  622. <Heading
  623. url='/datasets/{dataset_id}/documents/{document_id}'
  624. method='DELETE'
  625. title='Delete document'
  626. name='#delete_document'
  627. />
  628. <Row>
  629. <Col>
  630. ### Params
  631. <Properties>
  632. <Property name='dataset_id' type='string' key='dataset_id'>
  633. Knowledge ID
  634. </Property>
  635. <Property name='document_id' type='string' key='document_id'>
  636. Document ID
  637. </Property>
  638. </Properties>
  639. </Col>
  640. <Col sticky>
  641. <CodeGroup
  642. title="Request"
  643. tag="DELETE"
  644. label="/datasets/{dataset_id}/documents/{document_id}"
  645. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  646. >
  647. ```bash {{ title: 'cURL' }}
  648. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  649. --header 'Authorization: Bearer {api_key}' \
  650. ```
  651. </CodeGroup>
  652. <CodeGroup title="Response">
  653. ```json {{ title: 'Response' }}
  654. {
  655. "result": "success"
  656. }
  657. ```
  658. </CodeGroup>
  659. </Col>
  660. </Row>
  661. ---
  662. <Heading
  663. url='/datasets/{dataset_id}/documents'
  664. method='GET'
  665. title='Knowledge document list'
  666. name='#dataset_document_list'
  667. />
  668. <Row>
  669. <Col>
  670. ### Params
  671. <Properties>
  672. <Property name='dataset_id' type='string' key='dataset_id'>
  673. Knowledge ID
  674. </Property>
  675. </Properties>
  676. ### Query
  677. <Properties>
  678. <Property name='keyword' type='string' key='keyword'>
  679. Search keywords, currently only search document names(optional)
  680. </Property>
  681. <Property name='page' type='string' key='page'>
  682. Page number(optional)
  683. </Property>
  684. <Property name='limit' type='string' key='limit'>
  685. Number of items returned, default 20, range 1-100(optional)
  686. </Property>
  687. </Properties>
  688. </Col>
  689. <Col sticky>
  690. <CodeGroup
  691. title="Request"
  692. tag="GET"
  693. label="/datasets/{dataset_id}/documents"
  694. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  695. >
  696. ```bash {{ title: 'cURL' }}
  697. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  698. --header 'Authorization: Bearer {api_key}' \
  699. ```
  700. </CodeGroup>
  701. <CodeGroup title="Response">
  702. ```json {{ title: 'Response' }}
  703. {
  704. "data": [
  705. {
  706. "id": "",
  707. "position": 1,
  708. "data_source_type": "file_upload",
  709. "data_source_info": null,
  710. "dataset_process_rule_id": null,
  711. "name": "dify",
  712. "created_from": "",
  713. "created_by": "",
  714. "created_at": 1681623639,
  715. "tokens": 0,
  716. "indexing_status": "waiting",
  717. "error": null,
  718. "enabled": true,
  719. "disabled_at": null,
  720. "disabled_by": null,
  721. "archived": false
  722. },
  723. ],
  724. "has_more": false,
  725. "limit": 20,
  726. "total": 9,
  727. "page": 1
  728. }
  729. ```
  730. </CodeGroup>
  731. </Col>
  732. </Row>
  733. ---
  734. <Heading
  735. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  736. method='POST'
  737. title='Add segment'
  738. name='#create_new_segment'
  739. />
  740. <Row>
  741. <Col>
  742. ### Params
  743. <Properties>
  744. <Property name='dataset_id' type='string' key='dataset_id'>
  745. Knowledge ID
  746. </Property>
  747. <Property name='document_id' type='string' key='document_id'>
  748. Document ID
  749. </Property>
  750. </Properties>
  751. ### Request Body
  752. <Properties>
  753. <Property name='segments' type='object list' key='segments'>
  754. - <code>content</code> (text) Text content/question content, required
  755. - <code>answer</code> (text) Answer content, if the mode of the Knowledge is qa mode, pass the value(optional)
  756. - <code>keywords</code> (list) Keywords(optional)
  757. </Property>
  758. </Properties>
  759. </Col>
  760. <Col sticky>
  761. <CodeGroup
  762. title="Request"
  763. tag="POST"
  764. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  765. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"segments": [{"content": "1","answer": "1","keywords": ["a"]}]}'`}
  766. >
  767. ```bash {{ title: 'cURL' }}
  768. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  769. --header 'Authorization: Bearer {api_key}' \
  770. --header 'Content-Type: application/json' \
  771. --data-raw '{
  772. "segments": [
  773. {
  774. "content": "1",
  775. "answer": "1",
  776. "keywords": ["a"]
  777. }
  778. ]
  779. }'
  780. ```
  781. </CodeGroup>
  782. <CodeGroup title="Response">
  783. ```json {{ title: 'Response' }}
  784. {
  785. "data": [{
  786. "id": "",
  787. "position": 1,
  788. "document_id": "",
  789. "content": "1",
  790. "answer": "1",
  791. "word_count": 25,
  792. "tokens": 0,
  793. "keywords": [
  794. "a"
  795. ],
  796. "index_node_id": "",
  797. "index_node_hash": "",
  798. "hit_count": 0,
  799. "enabled": true,
  800. "disabled_at": null,
  801. "disabled_by": null,
  802. "status": "completed",
  803. "created_by": "",
  804. "created_at": 1695312007,
  805. "indexing_at": 1695312007,
  806. "completed_at": 1695312007,
  807. "error": null,
  808. "stopped_at": null
  809. }],
  810. "doc_form": "text_model"
  811. }
  812. ```
  813. </CodeGroup>
  814. </Col>
  815. </Row>
  816. ---
  817. <Heading
  818. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  819. method='GET'
  820. title='get documents segments'
  821. name='#get_segment'
  822. />
  823. <Row>
  824. <Col>
  825. ### Path
  826. <Properties>
  827. <Property name='dataset_id' type='string' key='dataset_id'>
  828. Knowledge ID
  829. </Property>
  830. <Property name='document_id' type='string' key='document_id'>
  831. Document ID
  832. </Property>
  833. </Properties>
  834. ### Query
  835. <Properties>
  836. <Property name='keyword' type='string' key='keyword'>
  837. keyword,choosable
  838. </Property>
  839. <Property name='status' type='string' key='status'>
  840. Search status,completed
  841. </Property>
  842. </Properties>
  843. </Col>
  844. <Col sticky>
  845. <CodeGroup
  846. title="Request"
  847. tag="GET"
  848. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  849. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  850. >
  851. ```bash {{ title: 'cURL' }}
  852. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  853. --header 'Authorization: Bearer {api_key}' \
  854. --header 'Content-Type: application/json'
  855. ```
  856. </CodeGroup>
  857. <CodeGroup title="Response">
  858. ```json {{ title: 'Response' }}
  859. {
  860. "data": [{
  861. "id": "",
  862. "position": 1,
  863. "document_id": "",
  864. "content": "1",
  865. "answer": "1",
  866. "word_count": 25,
  867. "tokens": 0,
  868. "keywords": [
  869. "a"
  870. ],
  871. "index_node_id": "",
  872. "index_node_hash": "",
  873. "hit_count": 0,
  874. "enabled": true,
  875. "disabled_at": null,
  876. "disabled_by": null,
  877. "status": "completed",
  878. "created_by": "",
  879. "created_at": 1695312007,
  880. "indexing_at": 1695312007,
  881. "completed_at": 1695312007,
  882. "error": null,
  883. "stopped_at": null
  884. }],
  885. "doc_form": "text_model"
  886. }
  887. ```
  888. </CodeGroup>
  889. </Col>
  890. </Row>
  891. ---
  892. <Heading
  893. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  894. method='DELETE'
  895. title='delete document segment'
  896. name='#delete_segment'
  897. />
  898. <Row>
  899. <Col>
  900. ### Path
  901. <Properties>
  902. <Property name='dataset_id' type='string' key='dataset_id'>
  903. Knowledge ID
  904. </Property>
  905. <Property name='document_id' type='string' key='document_id'>
  906. Document ID
  907. </Property>
  908. <Property name='segment_id' type='string' key='segment_id'>
  909. Document Segment ID
  910. </Property>
  911. </Properties>
  912. </Col>
  913. <Col sticky>
  914. <CodeGroup
  915. title="Request"
  916. tag="DELETE"
  917. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  918. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  919. >
  920. ```bash {{ title: 'cURL' }}
  921. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/segments/{segment_id}' \
  922. --header 'Authorization: Bearer {api_key}' \
  923. --header 'Content-Type: application/json'
  924. ```
  925. </CodeGroup>
  926. <CodeGroup title="Response">
  927. ```json {{ title: 'Response' }}
  928. {
  929. "result": "success"
  930. }
  931. ```
  932. </CodeGroup>
  933. </Col>
  934. </Row>
  935. ---
  936. <Heading
  937. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  938. method='POST'
  939. title='update document segment'
  940. name='#update_segment'
  941. />
  942. <Row>
  943. <Col>
  944. ### POST
  945. <Properties>
  946. <Property name='dataset_id' type='string' key='dataset_id'>
  947. Knowledge ID
  948. </Property>
  949. <Property name='document_id' type='string' key='document_id'>
  950. Document ID
  951. </Property>
  952. <Property name='segment_id' type='string' key='segment_id'>
  953. Document Segment ID
  954. </Property>
  955. </Properties>
  956. ### Request Body
  957. <Properties>
  958. <Property name='segment' type='object' key='segment'>
  959. - <code>content</code> (text) text content/question content,required
  960. - <code>answer</code> (text) Answer content, not required, passed if the Knowledge is in qa mode
  961. - <code>keywords</code> (list) keyword, not required
  962. - <code>enabled</code> (bool) false/true, not required
  963. </Property>
  964. </Properties>
  965. </Col>
  966. <Col sticky>
  967. <CodeGroup
  968. title="Request"
  969. tag="POST"
  970. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  971. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{\"segment\": {\"content\": \"1\",\"answer\": \"1\", \"keywords\": [\"a\"], \"enabled\": false}}'`}
  972. >
  973. ```bash {{ title: 'cURL' }}
  974. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  975. --header 'Content-Type: application/json' \
  976. --data-raw '{
  977. "segment": {
  978. "content": "1",
  979. "answer": "1",
  980. "keywords": ["a"],
  981. "enabled": false
  982. }
  983. }'
  984. ```
  985. </CodeGroup>
  986. <CodeGroup title="Response">
  987. ```json {{ title: 'Response' }}
  988. {
  989. "data": [{
  990. "id": "",
  991. "position": 1,
  992. "document_id": "",
  993. "content": "1",
  994. "answer": "1",
  995. "word_count": 25,
  996. "tokens": 0,
  997. "keywords": [
  998. "a"
  999. ],
  1000. "index_node_id": "",
  1001. "index_node_hash": "",
  1002. "hit_count": 0,
  1003. "enabled": true,
  1004. "disabled_at": null,
  1005. "disabled_by": null,
  1006. "status": "completed",
  1007. "created_by": "",
  1008. "created_at": 1695312007,
  1009. "indexing_at": 1695312007,
  1010. "completed_at": 1695312007,
  1011. "error": null,
  1012. "stopped_at": null
  1013. }],
  1014. "doc_form": "text_model"
  1015. }
  1016. ```
  1017. </CodeGroup>
  1018. </Col>
  1019. </Row>
  1020. ---
  1021. <Heading
  1022. url='/datasets/{dataset_id}/hit_testing'
  1023. method='POST'
  1024. title='Dataset hit testing'
  1025. name='#dataset_hit_testing'
  1026. />
  1027. <Row>
  1028. <Col>
  1029. ### Path
  1030. <Properties>
  1031. <Property name='dataset_id' type='string' key='dataset_id'>
  1032. Dataset ID
  1033. </Property>
  1034. </Properties>
  1035. ### Request Body
  1036. <Properties>
  1037. <Property name='query' type='string' key='query'>
  1038. retrieval keywordc
  1039. </Property>
  1040. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1041. retrieval keyword(Optional, if not filled, it will be recalled according to the default method)
  1042. - <code>search_method</code> (text) Search method: One of the following four keywords is required
  1043. - <code>keyword_search</code> Keyword search
  1044. - <code>semantic_search</code> Semantic search
  1045. - <code>full_text_search</code> Full-text search
  1046. - <code>hybrid_search</code> Hybrid search
  1047. - <code>reranking_enable</code> (bool) Whether to enable reranking, optional, required if the search mode is semantic_search or hybrid_search
  1048. - <code>reranking_mode</code> (object) Rerank model configuration, optional, required if reranking is enabled
  1049. - <code>reranking_provider_name</code> (string) Rerank model provider
  1050. - <code>reranking_model_name</code> (string) Rerank model name
  1051. - <code>weights</code> (double) Semantic search weight setting in hybrid search mode
  1052. - <code>top_k</code> (integer) Number of results to return, optional
  1053. - <code>score_threshold_enabled</code> (bool) Whether to enable score threshold
  1054. - <code>score_threshold</code> (double) Score threshold
  1055. </Property>
  1056. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1057. Unused field
  1058. </Property>
  1059. </Properties>
  1060. </Col>
  1061. <Col sticky>
  1062. <CodeGroup
  1063. title="Request"
  1064. tag="POST"
  1065. label="/datasets/{dataset_id}/hit_testing"
  1066. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/hit_testing' \\\n--header 'Authorization: Bearer {api_key}'\\\n--header 'Content-Type: application/json'\\\n--data-raw '{
  1067. "query": "test",
  1068. "retrieval_model": {
  1069. "search_method": "keyword_search",
  1070. "reranking_enable": false,
  1071. "reranking_mode": null,
  1072. "reranking_model": {
  1073. "reranking_provider_name": "",
  1074. "reranking_model_name": ""
  1075. },
  1076. "weights": null,
  1077. "top_k": 1,
  1078. "score_threshold_enabled": false,
  1079. "score_threshold": null
  1080. }
  1081. }'`}
  1082. >
  1083. ```bash {{ title: 'cURL' }}
  1084. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/hit_testing' \
  1085. --header 'Authorization: Bearer {api_key}' \
  1086. --header 'Content-Type: application/json' \
  1087. --data-raw '{
  1088. "query": "test",
  1089. "retrieval_model": {
  1090. "search_method": "keyword_search",
  1091. "reranking_enable": false,
  1092. "reranking_mode": null,
  1093. "reranking_model": {
  1094. "reranking_provider_name": "",
  1095. "reranking_model_name": ""
  1096. },
  1097. "weights": null,
  1098. "top_k": 2,
  1099. "score_threshold_enabled": false,
  1100. "score_threshold": null
  1101. }
  1102. }'
  1103. ```
  1104. </CodeGroup>
  1105. <CodeGroup title="Response">
  1106. ```json {{ title: 'Response' }}
  1107. {
  1108. "query": {
  1109. "content": "test"
  1110. },
  1111. "records": [
  1112. {
  1113. "segment": {
  1114. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1115. "position": 1,
  1116. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1117. "content": "Operation guide",
  1118. "answer": null,
  1119. "word_count": 847,
  1120. "tokens": 280,
  1121. "keywords": [
  1122. "install",
  1123. "java",
  1124. "base",
  1125. "scripts",
  1126. "jdk",
  1127. "manual",
  1128. "internal",
  1129. "opens",
  1130. "add",
  1131. "vmoptions"
  1132. ],
  1133. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1134. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1135. "hit_count": 0,
  1136. "enabled": true,
  1137. "disabled_at": null,
  1138. "disabled_by": null,
  1139. "status": "completed",
  1140. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1141. "created_at": 1728734540,
  1142. "indexing_at": 1728734552,
  1143. "completed_at": 1728734584,
  1144. "error": null,
  1145. "stopped_at": null,
  1146. "document": {
  1147. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1148. "data_source_type": "upload_file",
  1149. "name": "readme.txt",
  1150. "doc_type": null
  1151. }
  1152. },
  1153. "score": 3.730463140527718e-05,
  1154. "tsne_position": null
  1155. }
  1156. ]
  1157. }
  1158. ```
  1159. </CodeGroup>
  1160. </Col>
  1161. </Row>
  1162. ---
  1163. <Row>
  1164. <Col>
  1165. ### Error message
  1166. <Properties>
  1167. <Property name='code' type='string' key='code'>
  1168. Error code
  1169. </Property>
  1170. </Properties>
  1171. <Properties>
  1172. <Property name='status' type='number' key='status'>
  1173. Error status
  1174. </Property>
  1175. </Properties>
  1176. <Properties>
  1177. <Property name='message' type='string' key='message'>
  1178. Error message
  1179. </Property>
  1180. </Properties>
  1181. </Col>
  1182. <Col>
  1183. <CodeGroup title="Example">
  1184. ```json {{ title: 'Response' }}
  1185. {
  1186. "code": "no_file_uploaded",
  1187. "message": "Please upload your file.",
  1188. "status": 400
  1189. }
  1190. ```
  1191. </CodeGroup>
  1192. </Col>
  1193. </Row>
  1194. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  1195. <thead style={{ background: '#f9fafc' }}>
  1196. <tr>
  1197. <th className="p-2 border border-slate-300">code</th>
  1198. <th className="p-2 border border-slate-300">status</th>
  1199. <th className="p-2 border border-slate-300">message</th>
  1200. </tr>
  1201. </thead>
  1202. <tbody>
  1203. <tr>
  1204. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  1205. <td className="p-2 border border-slate-300">400</td>
  1206. <td className="p-2 border border-slate-300">Please upload your file.</td>
  1207. </tr>
  1208. <tr>
  1209. <td className="p-2 border border-slate-300">too_many_files</td>
  1210. <td className="p-2 border border-slate-300">400</td>
  1211. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  1212. </tr>
  1213. <tr>
  1214. <td className="p-2 border border-slate-300">file_too_large</td>
  1215. <td className="p-2 border border-slate-300">413</td>
  1216. <td className="p-2 border border-slate-300">File size exceeded.</td>
  1217. </tr>
  1218. <tr>
  1219. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  1220. <td className="p-2 border border-slate-300">415</td>
  1221. <td className="p-2 border border-slate-300">File type not allowed.</td>
  1222. </tr>
  1223. <tr>
  1224. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  1225. <td className="p-2 border border-slate-300">400</td>
  1226. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  1227. </tr>
  1228. <tr>
  1229. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  1230. <td className="p-2 border border-slate-300">400</td>
  1231. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  1232. </tr>
  1233. <tr>
  1234. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  1235. <td className="p-2 border border-slate-300">403</td>
  1236. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  1237. </tr>
  1238. <tr>
  1239. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  1240. <td className="p-2 border border-slate-300">409</td>
  1241. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  1242. </tr>
  1243. <tr>
  1244. <td className="p-2 border border-slate-300">invalid_action</td>
  1245. <td className="p-2 border border-slate-300">400</td>
  1246. <td className="p-2 border border-slate-300">Invalid action.</td>
  1247. </tr>
  1248. <tr>
  1249. <td className="p-2 border border-slate-300">document_already_finished</td>
  1250. <td className="p-2 border border-slate-300">400</td>
  1251. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  1252. </tr>
  1253. <tr>
  1254. <td className="p-2 border border-slate-300">document_indexing</td>
  1255. <td className="p-2 border border-slate-300">400</td>
  1256. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  1257. </tr>
  1258. <tr>
  1259. <td className="p-2 border border-slate-300">invalid_metadata</td>
  1260. <td className="p-2 border border-slate-300">400</td>
  1261. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  1262. </tr>
  1263. </tbody>
  1264. </table>
  1265. <div className="pb-4" />