template.zh.mdx 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  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. # 知识库 API
  4. <div>
  5. ### 鉴权
  6. Dify Service API 使用 `API-Key` 进行鉴权。
  7. 建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。
  8. 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
  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='通过文本创建文档'
  20. name='#create_by_text'
  21. />
  22. <Row>
  23. <Col>
  24. 此接口基于已存在知识库,在此知识库的基础上通过文本创建新的文档
  25. ### Path
  26. <Properties>
  27. <Property name='dataset_id' type='string' key='dataset_id'>
  28. 知识库 ID
  29. </Property>
  30. </Properties>
  31. ### Request Body
  32. <Properties>
  33. <Property name='name' type='string' key='name'>
  34. 文档名称
  35. </Property>
  36. <Property name='text' type='string' key='text'>
  37. 文档内容
  38. </Property>
  39. <Property name='indexing_technique' type='string' key='indexing_technique'>
  40. 索引方式
  41. - <code>high_quality</code> 高质量:使用 embedding 模型进行嵌入,构建为向量数据库索引
  42. - <code>economy</code> 经济:使用 Keyword Table Index 的倒排索引进行构建
  43. </Property>
  44. <Property name='process_rule' type='object' key='process_rule'>
  45. 处理规则
  46. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义
  47. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  48. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  49. - <code>id</code> (string) 预处理规则的唯一标识符
  50. - 枚举:
  51. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  52. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  53. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  54. - <code>segmentation</code> (object) 分段规则
  55. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  56. - <code>max_tokens</code> 最大长度 (token) 默认为 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 --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='通过文件创建文档 '
  119. name='#create_by_file'
  120. />
  121. <Row>
  122. <Col>
  123. 此接口基于已存在知识库,在此知识库的基础上通过文件创建新的文档
  124. ### Path
  125. <Properties>
  126. <Property name='dataset_id' type='string' key='dataset_id'>
  127. 知识库 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 源文档 ID (选填)
  134. - 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制
  135. - 源文档不可为归档的文档
  136. - 当传入 <code>original_document_id</code> 时,代表文档进行更新操作,<code>process_rule</code> 为可填项目,不填默认使用源文档的分段方式
  137. - 未传入 <code>original_document_id</code> 时,代表文档进行新增操作,<code>process_rule</code> 为必填
  138. - indexing_technique 索引方式
  139. - <code>high_quality</code> 高质量:使用 embedding 模型进行嵌入,构建为向量数据库索引
  140. - <code>economy</code> 经济:使用 Keyword Table Index 的倒排索引进行构建
  141. - process_rule 处理规则
  142. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义
  143. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  144. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  145. - <code>id</code> (string) 预处理规则的唯一标识符
  146. - 枚举:
  147. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  148. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  149. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  150. - <code>segmentation</code> (object) 分段规则
  151. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  152. - <code>max_tokens</code> 最大长度 (token) 默认为 1000
  153. </Property>
  154. <Property name='file' type='multipart/form-data' key='file'>
  155. 需要上传的文件。
  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='创建空知识库'
  211. name='#create_empty_dataset'
  212. />
  213. <Row>
  214. <Col>
  215. ### Request Body
  216. <Properties>
  217. <Property name='name' type='string' key='name'>
  218. 知识库名称
  219. </Property>
  220. <Property name='permission' type='string' key='permission'>
  221. 权限
  222. - <code>only_me</code> 仅自己
  223. - <code>all_team_members</code> 所有团队成员
  224. - <code>partial_members</code> 部分团队成员
  225. </Property>
  226. </Properties>
  227. </Col>
  228. <Col sticky>
  229. <CodeGroup
  230. title="Request"
  231. tag="POST"
  232. label="/datasets"
  233. 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"}'`}
  234. >
  235. ```bash {{ title: 'cURL' }}
  236. curl --location --request POST '${props.apiBaseUrl}/datasets' \
  237. --header 'Authorization: Bearer {api_key}' \
  238. --header 'Content-Type: application/json' \
  239. --data-raw '{
  240. "name": "name",
  241. "permission": "only_me"
  242. }'
  243. ```
  244. </CodeGroup>
  245. <CodeGroup title="Response">
  246. ```json {{ title: 'Response' }}
  247. {
  248. "id": "",
  249. "name": "name",
  250. "description": null,
  251. "provider": "vendor",
  252. "permission": "only_me",
  253. "data_source_type": null,
  254. "indexing_technique": null,
  255. "app_count": 0,
  256. "document_count": 0,
  257. "word_count": 0,
  258. "created_by": "",
  259. "created_at": 1695636173,
  260. "updated_by": "",
  261. "updated_at": 1695636173,
  262. "embedding_model": null,
  263. "embedding_model_provider": null,
  264. "embedding_available": null
  265. }
  266. ```
  267. </CodeGroup>
  268. </Col>
  269. </Row>
  270. ---
  271. <Heading
  272. url='/datasets'
  273. method='GET'
  274. title='知识库列表'
  275. name='#dataset_list'
  276. />
  277. <Row>
  278. <Col>
  279. ### Query
  280. <Properties>
  281. <Property name='page' type='string' key='page'>
  282. 页码
  283. </Property>
  284. <Property name='limit' type='string' key='limit'>
  285. 返回条数,默认 20,范围 1-100
  286. </Property>
  287. </Properties>
  288. </Col>
  289. <Col sticky>
  290. <CodeGroup
  291. title="Request"
  292. tag="POST"
  293. label="/datasets"
  294. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  295. >
  296. ```bash {{ title: 'cURL' }}
  297. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  298. --header 'Authorization: Bearer {api_key}'
  299. ```
  300. </CodeGroup>
  301. <CodeGroup title="Response">
  302. ```json {{ title: 'Response' }}
  303. {
  304. "data": [
  305. {
  306. "id": "",
  307. "name": "知识库名称",
  308. "description": "描述信息",
  309. "permission": "only_me",
  310. "data_source_type": "upload_file",
  311. "indexing_technique": "",
  312. "app_count": 2,
  313. "document_count": 10,
  314. "word_count": 1200,
  315. "created_by": "",
  316. "created_at": "",
  317. "updated_by": "",
  318. "updated_at": ""
  319. },
  320. ...
  321. ],
  322. "has_more": true,
  323. "limit": 20,
  324. "total": 50,
  325. "page": 1
  326. }
  327. ```
  328. </CodeGroup>
  329. </Col>
  330. </Row>
  331. ---
  332. <Heading
  333. url='/datasets/{dataset_id}'
  334. method='DELETE'
  335. title='删除知识库'
  336. name='#delete_dataset'
  337. />
  338. <Row>
  339. <Col>
  340. ### Path
  341. <Properties>
  342. <Property name='dataset_id' type='string' key='dataset_id'>
  343. 知识库 ID
  344. </Property>
  345. </Properties>
  346. </Col>
  347. <Col sticky>
  348. <CodeGroup
  349. title="Request"
  350. tag="DELETE"
  351. label="/datasets/{dataset_id}"
  352. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  353. >
  354. ```bash {{ title: 'cURL' }}
  355. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
  356. --header 'Authorization: Bearer {api_key}'
  357. ```
  358. </CodeGroup>
  359. <CodeGroup title="Response">
  360. ```text {{ title: 'Response' }}
  361. 204 No Content
  362. ```
  363. </CodeGroup>
  364. </Col>
  365. </Row>
  366. ---
  367. <Heading
  368. url='/datasets/{dataset_id}/documents/{document_id}/update_by_text'
  369. method='POST'
  370. title='通过文本更新文档 '
  371. name='#update_by_text'
  372. />
  373. <Row>
  374. <Col>
  375. 此接口基于已存在知识库,在此知识库的基础上通过文本更新文档
  376. ### Path
  377. <Properties>
  378. <Property name='dataset_id' type='string' key='dataset_id'>
  379. 知识库 ID
  380. </Property>
  381. <Property name='document_id' type='string' key='document_id'>
  382. 文档 ID
  383. </Property>
  384. </Properties>
  385. ### Request Body
  386. <Properties>
  387. <Property name='name' type='string' key='name'>
  388. 文档名称 (选填)
  389. </Property>
  390. <Property name='text' type='string' key='text'>
  391. 文档内容(选填)
  392. </Property>
  393. <Property name='process_rule' type='object' key='process_rule'>
  394. 处理规则(选填)
  395. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义
  396. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  397. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  398. - <code>id</code> (string) 预处理规则的唯一标识符
  399. - 枚举:
  400. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  401. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  402. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  403. - <code>segmentation</code> (object) 分段规则
  404. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  405. - <code>max_tokens</code> 最大长度 (token) 默认为 1000
  406. </Property>
  407. </Properties>
  408. </Col>
  409. <Col sticky>
  410. <CodeGroup
  411. title="Request"
  412. tag="POST"
  413. label="/datasets/{dataset_id}/documents/{document_id}/update_by_text"
  414. 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"}'`}
  415. >
  416. ```bash {{ title: 'cURL' }}
  417. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update_by_text' \
  418. --header 'Authorization: Bearer {api_key}' \
  419. --header 'Content-Type: application/json' \
  420. --data-raw '{
  421. "name": "name",
  422. "text": "text"
  423. }'
  424. ```
  425. </CodeGroup>
  426. <CodeGroup title="Response">
  427. ```json {{ title: 'Response' }}
  428. {
  429. "document": {
  430. "id": "",
  431. "position": 1,
  432. "data_source_type": "upload_file",
  433. "data_source_info": {
  434. "upload_file_id": ""
  435. },
  436. "dataset_process_rule_id": "",
  437. "name": "name.txt",
  438. "created_from": "api",
  439. "created_by": "",
  440. "created_at": 1695308667,
  441. "tokens": 0,
  442. "indexing_status": "waiting",
  443. "error": null,
  444. "enabled": true,
  445. "disabled_at": null,
  446. "disabled_by": null,
  447. "archived": false,
  448. "display_status": "queuing",
  449. "word_count": 0,
  450. "hit_count": 0,
  451. "doc_form": "text_model"
  452. },
  453. "batch": ""
  454. }
  455. ```
  456. </CodeGroup>
  457. </Col>
  458. </Row>
  459. ---
  460. <Heading
  461. url='/datasets/{dataset_id}/documents/{document_id}/update_by_file'
  462. method='POST'
  463. title='通过文件更新文档 '
  464. name='#update_by_file'
  465. />
  466. <Row>
  467. <Col>
  468. 此接口基于已存在知识库,在此知识库的基础上通过文件更新文档的操作。
  469. ### Path
  470. <Properties>
  471. <Property name='dataset_id' type='string' key='dataset_id'>
  472. 知识库 ID
  473. </Property>
  474. <Property name='document_id' type='string' key='document_id'>
  475. 文档 ID
  476. </Property>
  477. </Properties>
  478. ### Request Body
  479. <Properties>
  480. <Property name='name' type='string' key='name'>
  481. 文档名称 (选填)
  482. </Property>
  483. <Property name='file' type='multipart/form-data' key='file'>
  484. 需要上传的文件
  485. </Property>
  486. <Property name='process_rule' type='object' key='process_rule'>
  487. 处理规则(选填)
  488. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义
  489. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  490. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  491. - <code>id</code> (string) 预处理规则的唯一标识符
  492. - 枚举:
  493. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  494. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  495. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  496. - <code>segmentation</code> (object) 分段规则
  497. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  498. - <code>max_tokens</code> 最大长度 (token) 默认为 1000
  499. </Property>
  500. </Properties>
  501. </Col>
  502. <Col sticky>
  503. <CodeGroup
  504. title="Request"
  505. tag="POST"
  506. label="/datasets/{dataset_id}/documents/{document_id}/update_by_file"
  507. 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"'`}
  508. >
  509. ```bash {{ title: 'cURL' }}
  510. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update_by_file' \
  511. --header 'Authorization: Bearer {api_key}' \
  512. --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' \
  513. --form 'file=@"/path/to/file"'
  514. ```
  515. </CodeGroup>
  516. <CodeGroup title="Response">
  517. ```json {{ title: 'Response' }}
  518. {
  519. "document": {
  520. "id": "",
  521. "position": 1,
  522. "data_source_type": "upload_file",
  523. "data_source_info": {
  524. "upload_file_id": ""
  525. },
  526. "dataset_process_rule_id": "",
  527. "name": "Dify.txt",
  528. "created_from": "api",
  529. "created_by": "",
  530. "created_at": 1695308667,
  531. "tokens": 0,
  532. "indexing_status": "waiting",
  533. "error": null,
  534. "enabled": true,
  535. "disabled_at": null,
  536. "disabled_by": null,
  537. "archived": false,
  538. "display_status": "queuing",
  539. "word_count": 0,
  540. "hit_count": 0,
  541. "doc_form": "text_model"
  542. },
  543. "batch": "20230921150427533684"
  544. }
  545. ```
  546. </CodeGroup>
  547. </Col>
  548. </Row>
  549. ---
  550. <Heading
  551. url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
  552. method='GET'
  553. title='获取文档嵌入状态(进度)'
  554. name='#indexing_status'
  555. />
  556. <Row>
  557. <Col>
  558. ### Path
  559. <Properties>
  560. <Property name='dataset_id' type='string' key='dataset_id'>
  561. 知识库 ID
  562. </Property>
  563. <Property name='batch' type='string' key='batch'>
  564. 上传文档的批次号
  565. </Property>
  566. </Properties>
  567. </Col>
  568. <Col sticky>
  569. <CodeGroup
  570. title="Request"
  571. tag="GET"
  572. label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
  573. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
  574. >
  575. ```bash {{ title: 'cURL' }}
  576. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
  577. --header 'Authorization: Bearer {api_key}' \
  578. ```
  579. </CodeGroup>
  580. <CodeGroup title="Response">
  581. ```json {{ title: 'Response' }}
  582. {
  583. "data":[{
  584. "id": "",
  585. "indexing_status": "indexing",
  586. "processing_started_at": 1681623462.0,
  587. "parsing_completed_at": 1681623462.0,
  588. "cleaning_completed_at": 1681623462.0,
  589. "splitting_completed_at": 1681623462.0,
  590. "completed_at": null,
  591. "paused_at": null,
  592. "error": null,
  593. "stopped_at": null,
  594. "completed_segments": 24,
  595. "total_segments": 100
  596. }]
  597. }
  598. ```
  599. </CodeGroup>
  600. </Col>
  601. </Row>
  602. ---
  603. <Heading
  604. url='/datasets/{dataset_id}/documents/{document_id}'
  605. method='DELETE'
  606. title='删除文档'
  607. name='#delete_document'
  608. />
  609. <Row>
  610. <Col>
  611. ### Path
  612. <Properties>
  613. <Property name='dataset_id' type='string' key='dataset_id'>
  614. 知识库 ID
  615. </Property>
  616. <Property name='document_id' type='string' key='document_id'>
  617. 文档 ID
  618. </Property>
  619. </Properties>
  620. </Col>
  621. <Col sticky>
  622. <CodeGroup
  623. title="Request"
  624. tag="DELETE"
  625. label="/datasets/{dataset_id}/documents/{document_id}"
  626. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  627. >
  628. ```bash {{ title: 'cURL' }}
  629. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  630. --header 'Authorization: Bearer {api_key}' \
  631. ```
  632. </CodeGroup>
  633. <CodeGroup title="Response">
  634. ```json {{ title: 'Response' }}
  635. {
  636. "result": "success"
  637. }
  638. ```
  639. </CodeGroup>
  640. </Col>
  641. </Row>
  642. ---
  643. <Heading
  644. url='/datasets/{dataset_id}/documents'
  645. method='GET'
  646. title='知识库文档列表'
  647. name='#dataset_document_list'
  648. />
  649. <Row>
  650. <Col>
  651. ### Path
  652. <Properties>
  653. <Property name='dataset_id' type='string' key='dataset_id'>
  654. 知识库 ID
  655. </Property>
  656. </Properties>
  657. ### Query
  658. <Properties>
  659. <Property name='keyword' type='string' key='keyword'>
  660. 搜索关键词,可选,目前仅搜索文档名称
  661. </Property>
  662. <Property name='page' type='string' key='page'>
  663. 页码,可选
  664. </Property>
  665. <Property name='limit' type='string' key='limit'>
  666. 返回条数,可选,默认 20,范围 1-100
  667. </Property>
  668. </Properties>
  669. </Col>
  670. <Col sticky>
  671. <CodeGroup
  672. title="Request"
  673. tag="GET"
  674. label="/datasets/{dataset_id}/documents"
  675. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  676. >
  677. ```bash {{ title: 'cURL' }}
  678. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  679. --header 'Authorization: Bearer {api_key}' \
  680. ```
  681. </CodeGroup>
  682. <CodeGroup title="Response">
  683. ```json {{ title: 'Response' }}
  684. {
  685. "data": [
  686. {
  687. "id": "",
  688. "position": 1,
  689. "data_source_type": "file_upload",
  690. "data_source_info": null,
  691. "dataset_process_rule_id": null,
  692. "name": "dify",
  693. "created_from": "",
  694. "created_by": "",
  695. "created_at": 1681623639,
  696. "tokens": 0,
  697. "indexing_status": "waiting",
  698. "error": null,
  699. "enabled": true,
  700. "disabled_at": null,
  701. "disabled_by": null,
  702. "archived": false
  703. },
  704. ],
  705. "has_more": false,
  706. "limit": 20,
  707. "total": 9,
  708. "page": 1
  709. }
  710. ```
  711. </CodeGroup>
  712. </Col>
  713. </Row>
  714. ---
  715. <Heading
  716. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  717. method='POST'
  718. title='新增分段'
  719. name='#create_new_segment'
  720. />
  721. <Row>
  722. <Col>
  723. ### Path
  724. <Properties>
  725. <Property name='dataset_id' type='string' key='dataset_id'>
  726. 知识库 ID
  727. </Property>
  728. <Property name='document_id' type='string' key='document_id'>
  729. 文档 ID
  730. </Property>
  731. </Properties>
  732. ### Request Body
  733. <Properties>
  734. <Property name='segments' type='object list' key='segments'>
  735. - <code>content</code> (text) 文本内容/问题内容,必填
  736. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为qa模式则传值
  737. - <code>keywords</code> (list) 关键字,非必填
  738. </Property>
  739. </Properties>
  740. </Col>
  741. <Col sticky>
  742. <CodeGroup
  743. title="Request"
  744. tag="POST"
  745. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  746. 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"]}]}'`}
  747. >
  748. ```bash {{ title: 'cURL' }}
  749. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  750. --header 'Authorization: Bearer {api_key}' \
  751. --header 'Content-Type: application/json' \
  752. --data-raw '{
  753. "segments": [
  754. {
  755. "content": "1",
  756. "answer": "1",
  757. "keywords": ["a"]
  758. }
  759. ]
  760. }'
  761. ```
  762. </CodeGroup>
  763. <CodeGroup title="Response">
  764. ```json {{ title: 'Response' }}
  765. {
  766. "data": [{
  767. "id": "",
  768. "position": 1,
  769. "document_id": "",
  770. "content": "1",
  771. "answer": "1",
  772. "word_count": 25,
  773. "tokens": 0,
  774. "keywords": [
  775. "a"
  776. ],
  777. "index_node_id": "",
  778. "index_node_hash": "",
  779. "hit_count": 0,
  780. "enabled": true,
  781. "disabled_at": null,
  782. "disabled_by": null,
  783. "status": "completed",
  784. "created_by": "",
  785. "created_at": 1695312007,
  786. "indexing_at": 1695312007,
  787. "completed_at": 1695312007,
  788. "error": null,
  789. "stopped_at": null
  790. }],
  791. "doc_form": "text_model"
  792. }
  793. ```
  794. </CodeGroup>
  795. </Col>
  796. </Row>
  797. ---
  798. <Heading
  799. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  800. method='GET'
  801. title='查询文档分段'
  802. name='#get_segment'
  803. />
  804. <Row>
  805. <Col>
  806. ### Path
  807. <Properties>
  808. <Property name='dataset_id' type='string' key='dataset_id'>
  809. 知识库 ID
  810. </Property>
  811. <Property name='document_id' type='string' key='document_id'>
  812. 文档 ID
  813. </Property>
  814. </Properties>
  815. ### Query
  816. <Properties>
  817. <Property name='keyword' type='string' key='keyword'>
  818. 搜索关键词,可选
  819. </Property>
  820. <Property name='status' type='string' key='status'>
  821. 搜索状态,completed
  822. </Property>
  823. </Properties>
  824. </Col>
  825. <Col sticky>
  826. <CodeGroup
  827. title="Request"
  828. tag="GET"
  829. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  830. 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'`}
  831. >
  832. ```bash {{ title: 'cURL' }}
  833. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  834. --header 'Authorization: Bearer {api_key}' \
  835. --header 'Content-Type: application/json'
  836. ```
  837. </CodeGroup>
  838. <CodeGroup title="Response">
  839. ```json {{ title: 'Response' }}
  840. {
  841. "data": [{
  842. "id": "",
  843. "position": 1,
  844. "document_id": "",
  845. "content": "1",
  846. "answer": "1",
  847. "word_count": 25,
  848. "tokens": 0,
  849. "keywords": [
  850. "a"
  851. ],
  852. "index_node_id": "",
  853. "index_node_hash": "",
  854. "hit_count": 0,
  855. "enabled": true,
  856. "disabled_at": null,
  857. "disabled_by": null,
  858. "status": "completed",
  859. "created_by": "",
  860. "created_at": 1695312007,
  861. "indexing_at": 1695312007,
  862. "completed_at": 1695312007,
  863. "error": null,
  864. "stopped_at": null
  865. }],
  866. "doc_form": "text_model"
  867. }
  868. ```
  869. </CodeGroup>
  870. </Col>
  871. </Row>
  872. ---
  873. <Heading
  874. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  875. method='DELETE'
  876. title='删除文档分段'
  877. name='#delete_segment'
  878. />
  879. <Row>
  880. <Col>
  881. ### Path
  882. <Properties>
  883. <Property name='dataset_id' type='string' key='dataset_id'>
  884. 知识库 ID
  885. </Property>
  886. <Property name='document_id' type='string' key='document_id'>
  887. 文档 ID
  888. </Property>
  889. <Property name='segment_id' type='string' key='segment_id'>
  890. 文档分段ID
  891. </Property>
  892. </Properties>
  893. </Col>
  894. <Col sticky>
  895. <CodeGroup
  896. title="Request"
  897. tag="DELETE"
  898. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  899. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  900. >
  901. ```bash {{ title: 'cURL' }}
  902. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  903. --header 'Authorization: Bearer {api_key}' \
  904. --header 'Content-Type: application/json'
  905. ```
  906. </CodeGroup>
  907. <CodeGroup title="Response">
  908. ```json {{ title: 'Response' }}
  909. {
  910. "result": "success"
  911. }
  912. ```
  913. </CodeGroup>
  914. </Col>
  915. </Row>
  916. ---
  917. <Heading
  918. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  919. method='POST'
  920. title='更新文档分段'
  921. name='#update_segment'
  922. />
  923. <Row>
  924. <Col>
  925. ### POST
  926. <Properties>
  927. <Property name='dataset_id' type='string' key='dataset_id'>
  928. 知识库 ID
  929. </Property>
  930. <Property name='document_id' type='string' key='document_id'>
  931. 文档 ID
  932. </Property>
  933. <Property name='segment_id' type='string' key='segment_id'>
  934. 文档分段ID
  935. </Property>
  936. </Properties>
  937. ### Request Body
  938. <Properties>
  939. <Property name='segment' type='object' key='segment'>
  940. - <code>content</code> (text) 文本内容/问题内容,必填
  941. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为qa模式则传值
  942. - <code>keywords</code> (list) 关键字,非必填
  943. - <code>enabled</code> (bool) false/true,非必填
  944. </Property>
  945. </Properties>
  946. </Col>
  947. <Col sticky>
  948. <CodeGroup
  949. title="Request"
  950. tag="POST"
  951. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  952. 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}}'`}
  953. >
  954. ```bash {{ title: 'cURL' }}
  955. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  956. --header 'Authorization: Bearer {api_key}' \
  957. --header 'Content-Type: application/json' \
  958. --data-raw '{
  959. "segment": {
  960. "content": "1",
  961. "answer": "1",
  962. "keywords": ["a"],
  963. "enabled": false
  964. }
  965. }'
  966. ```
  967. </CodeGroup>
  968. <CodeGroup title="Response">
  969. ```json {{ title: 'Response' }}
  970. {
  971. "data": [{
  972. "id": "",
  973. "position": 1,
  974. "document_id": "",
  975. "content": "1",
  976. "answer": "1",
  977. "word_count": 25,
  978. "tokens": 0,
  979. "keywords": [
  980. "a"
  981. ],
  982. "index_node_id": "",
  983. "index_node_hash": "",
  984. "hit_count": 0,
  985. "enabled": true,
  986. "disabled_at": null,
  987. "disabled_by": null,
  988. "status": "completed",
  989. "created_by": "",
  990. "created_at": 1695312007,
  991. "indexing_at": 1695312007,
  992. "completed_at": 1695312007,
  993. "error": null,
  994. "stopped_at": null
  995. }],
  996. "doc_form": "text_model"
  997. }
  998. ```
  999. </CodeGroup>
  1000. </Col>
  1001. </Row>
  1002. ---
  1003. <Heading
  1004. url='/datasets/{dataset_id}/hit_testing'
  1005. method='POST'
  1006. title='知识库召回测试'
  1007. name='#dataset_hit_testing'
  1008. />
  1009. <Row>
  1010. <Col>
  1011. ### Path
  1012. <Properties>
  1013. <Property name='dataset_id' type='string' key='dataset_id'>
  1014. 知识库 ID
  1015. </Property>
  1016. </Properties>
  1017. ### Request Body
  1018. <Properties>
  1019. <Property name='query' type='string' key='query'>
  1020. 召回关键词
  1021. </Property>
  1022. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1023. 召回参数(选填,如不填,按照默认方式召回)
  1024. - <code>search_method</code> (text) 检索方法:以下三个关键字之一,必填
  1025. - <code>keyword_search</code> 关键字检索
  1026. - <code>semantic_search</code> 语义检索
  1027. - <code>full_text_search</code> 全文检索
  1028. - <code>hybrid_search</code> 混合检索
  1029. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为semantic_search模式或者hybrid_search则传值
  1030. - <code>reranking_mode</code> (object) Rerank模型配置,非必填,如果启用了 reranking 则传值
  1031. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  1032. - <code>reranking_model_name</code> (string) Rerank 模型名称
  1033. - <code>weights</code> (double) 混合检索模式下语意检索的权重设置
  1034. - <code>top_k</code> (integer) 返回结果数量,非必填
  1035. - <code>score_threshold_enabled</code> (bool) 是否开启Score阈值
  1036. - <code>score_threshold</code> (double) Score阈值
  1037. </Property>
  1038. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1039. 未启用字段
  1040. </Property>
  1041. </Properties>
  1042. </Col>
  1043. <Col sticky>
  1044. <CodeGroup
  1045. title="Request"
  1046. tag="POST"
  1047. label="/datasets/{dataset_id}/hit_testing"
  1048. 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 '{
  1049. "query": "test",
  1050. "retrieval_model": {
  1051. "search_method": "keyword_search",
  1052. "reranking_enable": false,
  1053. "reranking_mode": null,
  1054. "reranking_model": {
  1055. "reranking_provider_name": "",
  1056. "reranking_model_name": ""
  1057. },
  1058. "weights": null,
  1059. "top_k": 1,
  1060. "score_threshold_enabled": false,
  1061. "score_threshold": null
  1062. }
  1063. }'`}
  1064. >
  1065. ```bash {{ title: 'cURL' }}
  1066. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/hit_testing' \
  1067. --header 'Authorization: Bearer {api_key}' \
  1068. --header 'Content-Type: application/json' \
  1069. --data-raw '{
  1070. "query": "test",
  1071. "retrieval_model": {
  1072. "search_method": "keyword_search",
  1073. "reranking_enable": false,
  1074. "reranking_mode": null,
  1075. "reranking_model": {
  1076. "reranking_provider_name": "",
  1077. "reranking_model_name": ""
  1078. },
  1079. "weights": null,
  1080. "top_k": 2,
  1081. "score_threshold_enabled": false,
  1082. "score_threshold": null
  1083. }
  1084. }'
  1085. ```
  1086. </CodeGroup>
  1087. <CodeGroup title="Response">
  1088. ```json {{ title: 'Response' }}
  1089. {
  1090. "query": {
  1091. "content": "test"
  1092. },
  1093. "records": [
  1094. {
  1095. "segment": {
  1096. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1097. "position": 1,
  1098. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1099. "content": "Operation guide",
  1100. "answer": null,
  1101. "word_count": 847,
  1102. "tokens": 280,
  1103. "keywords": [
  1104. "install",
  1105. "java",
  1106. "base",
  1107. "scripts",
  1108. "jdk",
  1109. "manual",
  1110. "internal",
  1111. "opens",
  1112. "add",
  1113. "vmoptions"
  1114. ],
  1115. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1116. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1117. "hit_count": 0,
  1118. "enabled": true,
  1119. "disabled_at": null,
  1120. "disabled_by": null,
  1121. "status": "completed",
  1122. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1123. "created_at": 1728734540,
  1124. "indexing_at": 1728734552,
  1125. "completed_at": 1728734584,
  1126. "error": null,
  1127. "stopped_at": null,
  1128. "document": {
  1129. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1130. "data_source_type": "upload_file",
  1131. "name": "readme.txt",
  1132. "doc_type": null
  1133. }
  1134. },
  1135. "score": 3.730463140527718e-05,
  1136. "tsne_position": null
  1137. }
  1138. ]
  1139. }
  1140. ```
  1141. </CodeGroup>
  1142. </Col>
  1143. </Row>
  1144. ---
  1145. <Row>
  1146. <Col>
  1147. ### 错误信息
  1148. <Properties>
  1149. <Property name='code' type='string' key='code'>
  1150. 返回的错误代码
  1151. </Property>
  1152. </Properties>
  1153. <Properties>
  1154. <Property name='status' type='number' key='status'>
  1155. 返回的错误状态
  1156. </Property>
  1157. </Properties>
  1158. <Properties>
  1159. <Property name='message' type='string' key='message'>
  1160. 返回的错误信息
  1161. </Property>
  1162. </Properties>
  1163. </Col>
  1164. <Col>
  1165. <CodeGroup title="Example">
  1166. ```json {{ title: 'Response' }}
  1167. {
  1168. "code": "no_file_uploaded",
  1169. "message": "Please upload your file.",
  1170. "status": 400
  1171. }
  1172. ```
  1173. </CodeGroup>
  1174. </Col>
  1175. </Row>
  1176. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  1177. <thead style={{ background: '#f9fafc' }}>
  1178. <tr>
  1179. <th className="p-2 border border-slate-300">code</th>
  1180. <th className="p-2 border border-slate-300">status</th>
  1181. <th className="p-2 border border-slate-300">message</th>
  1182. </tr>
  1183. </thead>
  1184. <tbody>
  1185. <tr>
  1186. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  1187. <td className="p-2 border border-slate-300">400</td>
  1188. <td className="p-2 border border-slate-300">Please upload your file.</td>
  1189. </tr>
  1190. <tr>
  1191. <td className="p-2 border border-slate-300">too_many_files</td>
  1192. <td className="p-2 border border-slate-300">400</td>
  1193. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  1194. </tr>
  1195. <tr>
  1196. <td className="p-2 border border-slate-300">file_too_large</td>
  1197. <td className="p-2 border border-slate-300">413</td>
  1198. <td className="p-2 border border-slate-300">File size exceeded.</td>
  1199. </tr>
  1200. <tr>
  1201. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  1202. <td className="p-2 border border-slate-300">415</td>
  1203. <td className="p-2 border border-slate-300">File type not allowed.</td>
  1204. </tr>
  1205. <tr>
  1206. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  1207. <td className="p-2 border border-slate-300">400</td>
  1208. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  1209. </tr>
  1210. <tr>
  1211. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  1212. <td className="p-2 border border-slate-300">400</td>
  1213. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  1214. </tr>
  1215. <tr>
  1216. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  1217. <td className="p-2 border border-slate-300">403</td>
  1218. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  1219. </tr>
  1220. <tr>
  1221. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  1222. <td className="p-2 border border-slate-300">409</td>
  1223. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  1224. </tr>
  1225. <tr>
  1226. <td className="p-2 border border-slate-300">invalid_action</td>
  1227. <td className="p-2 border border-slate-300">400</td>
  1228. <td className="p-2 border border-slate-300">Invalid action.</td>
  1229. </tr>
  1230. <tr>
  1231. <td className="p-2 border border-slate-300">document_already_finished</td>
  1232. <td className="p-2 border border-slate-300">400</td>
  1233. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  1234. </tr>
  1235. <tr>
  1236. <td className="p-2 border border-slate-300">document_indexing</td>
  1237. <td className="p-2 border border-slate-300">400</td>
  1238. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  1239. </tr>
  1240. <tr>
  1241. <td className="p-2 border border-slate-300">invalid_metadata</td>
  1242. <td className="p-2 border border-slate-300">400</td>
  1243. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  1244. </tr>
  1245. </tbody>
  1246. </table>
  1247. <div className="pb-4" />