template.en.mdx 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  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. <hr className='ml-0 mr-0' />
  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. <hr className='ml-0 mr-0' />
  115. <Heading
  116. url='/datasets/{dataset_id}/document/create-by-file'
  117. method='POST'
  118. title='Create a Document from a File'
  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. - <code>original_document_id</code> 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. - <code>indexing_technique</code> 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. - <code>process_rule</code> 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. <hr className='ml-0 mr-0' />
  207. <Heading
  208. url='/datasets'
  209. method='POST'
  210. title='Create an Empty Knowledge Base'
  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. <hr className='ml-0 mr-0' />
  290. <Heading
  291. url='/datasets'
  292. method='GET'
  293. title='Get Knowledge Base 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="GET"
  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. <hr className='ml-0 mr-0' />
  351. <Heading
  352. url='/datasets/{dataset_id}'
  353. method='DELETE'
  354. title='Delete a Knowledge Base'
  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. <hr className='ml-0 mr-0' />
  386. <Heading
  387. url='/datasets/{dataset_id}/documents/{document_id}/update-by-text'
  388. method='POST'
  389. title='Update a Document with 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. <hr className='ml-0 mr-0' />
  479. <Heading
  480. url='/datasets/{dataset_id}/documents/{document_id}/update-by-file'
  481. method='POST'
  482. title='Update a Document with 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. <hr className='ml-0 mr-0' />
  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. <hr className='ml-0 mr-0' />
  622. <Heading
  623. url='/datasets/{dataset_id}/documents/{document_id}'
  624. method='DELETE'
  625. title='Delete a 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. <hr className='ml-0 mr-0' />
  662. <Heading
  663. url='/datasets/{dataset_id}/documents'
  664. method='GET'
  665. title='Get the Document List of a Knowledge Base'
  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. <hr className='ml-0 mr-0' />
  734. <Heading
  735. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  736. method='POST'
  737. title='Add Chunks to a Document'
  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 Q&A 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. <hr className='ml-0 mr-0' />
  817. <Heading
  818. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  819. method='GET'
  820. title='Get Chunks from a Document'
  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 (optional)
  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. <hr className='ml-0 mr-0' />
  892. <Heading
  893. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  894. method='DELETE'
  895. title='Delete a Chunk in a Document'
  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. <hr className='ml-0 mr-0' />
  936. <Heading
  937. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  938. method='POST'
  939. title='Update a Chunk in a Document '
  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, passed if the knowledge is in Q&A mode (optional)
  961. - <code>keywords</code> (list) Keyword (optional)
  962. - <code>enabled</code> (bool) False / true (optional)
  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. <hr className='ml-0 mr-0' />
  1021. <Heading
  1022. url='/datasets/{dataset_id}/retrieve'
  1023. method='POST'
  1024. title='Retrieve Chunks from a Knowledge Base'
  1025. name='#dataset_retrieval'
  1026. />
  1027. <Row>
  1028. <Col>
  1029. ### Path
  1030. <Properties>
  1031. <Property name='dataset_id' type='string' key='dataset_id'>
  1032. Knowledge ID
  1033. </Property>
  1034. </Properties>
  1035. ### Request Body
  1036. <Properties>
  1037. <Property name='query' type='string' key='query'>
  1038. Query keyword
  1039. </Property>
  1040. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1041. Retrieval model (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, required if the search mode is semantic_search or hybrid_search (optional)
  1048. - <code>reranking_mode</code> (object) Rerank model configuration, 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}/retrieve"
  1066. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \\\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}/retrieve' \
  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. <hr className='ml-0 mr-0' />
  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" />