template.zh.mdx 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  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. <hr className='ml-0 mr-0' />
  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. <hr className='ml-0 mr-0' />
  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. - <code>original_document_id</code> 源文档 ID(选填)
  134. - 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制
  135. - 源文档不可为归档的文档
  136. - 当传入 <code>original_document_id</code> 时,代表文档进行更新操作,<code>process_rule</code> 为可填项目,不填默认使用源文档的分段方式
  137. - 未传入 <code>original_document_id</code> 时,代表文档进行新增操作,<code>process_rule</code> 为必填
  138. - <code>indexing_technique</code> 索引方式
  139. - <code>high_quality</code> 高质量:使用 embedding 模型进行嵌入,构建为向量数据库索引
  140. - <code>economy</code> 经济:使用 keyword table index 的倒排索引进行构建
  141. - <code>process_rule</code> 处理规则
  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. <hr className='ml-0 mr-0' />
  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='description' type='string' key='description'>
  221. 知识库描述(选填)
  222. </Property>
  223. <Property name='indexing_technique' type='string' key='indexing_technique'>
  224. 索引模式(选填,建议填写)
  225. - <code>high_quality</code> 高质量
  226. - <code>economy</code> 经济
  227. </Property>
  228. <Property name='permission' type='string' key='permission'>
  229. 权限(选填,默认 only_me)
  230. - <code>only_me</code> 仅自己
  231. - <code>all_team_members</code> 所有团队成员
  232. - <code>partial_members</code> 部分团队成员
  233. </Property>
  234. <Property name='provider' type='string' key='provider'>
  235. Provider(选填,默认 vendor)
  236. - <code>vendor</code> 上传文件
  237. - <code>external</code> 外部知识库
  238. </Property>
  239. <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
  240. 外部知识库 API_ID(选填)
  241. </Property>
  242. <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
  243. 外部知识库 ID(选填)
  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 '${props.apiBaseUrl}/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='知识库列表'
  294. name='#dataset_list'
  295. />
  296. <Row>
  297. <Col>
  298. ### Query
  299. <Properties>
  300. <Property name='page' type='string' key='page'>
  301. 页码
  302. </Property>
  303. <Property name='limit' type='string' key='limit'>
  304. 返回条数,默认 20,范围 1-100
  305. </Property>
  306. </Properties>
  307. </Col>
  308. <Col sticky>
  309. <CodeGroup
  310. title="Request"
  311. tag="POST"
  312. label="/datasets"
  313. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  314. >
  315. ```bash {{ title: 'cURL' }}
  316. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  317. --header 'Authorization: Bearer {api_key}'
  318. ```
  319. </CodeGroup>
  320. <CodeGroup title="Response">
  321. ```json {{ title: 'Response' }}
  322. {
  323. "data": [
  324. {
  325. "id": "",
  326. "name": "知识库名称",
  327. "description": "描述信息",
  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='删除知识库'
  355. name='#delete_dataset'
  356. />
  357. <Row>
  358. <Col>
  359. ### Path
  360. <Properties>
  361. <Property name='dataset_id' type='string' key='dataset_id'>
  362. 知识库 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='通过文本更新文档 '
  390. name='#update-by-text'
  391. />
  392. <Row>
  393. <Col>
  394. 此接口基于已存在知识库,在此知识库的基础上通过文本更新文档
  395. ### Path
  396. <Properties>
  397. <Property name='dataset_id' type='string' key='dataset_id'>
  398. 知识库 ID
  399. </Property>
  400. <Property name='document_id' type='string' key='document_id'>
  401. 文档 ID
  402. </Property>
  403. </Properties>
  404. ### Request Body
  405. <Properties>
  406. <Property name='name' type='string' key='name'>
  407. 文档名称(选填)
  408. </Property>
  409. <Property name='text' type='string' key='text'>
  410. 文档内容(选填)
  411. </Property>
  412. <Property name='process_rule' type='object' key='process_rule'>
  413. 处理规则(选填)
  414. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义
  415. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  416. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  417. - <code>id</code> (string) 预处理规则的唯一标识符
  418. - 枚举:
  419. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  420. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  421. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  422. - <code>segmentation</code> (object) 分段规则
  423. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  424. - <code>max_tokens</code> 最大长度(token)默认为 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='通过文件更新文档 '
  483. name='#update-by-file'
  484. />
  485. <Row>
  486. <Col>
  487. 此接口基于已存在知识库,在此知识库的基础上通过文件更新文档的操作。
  488. ### Path
  489. <Properties>
  490. <Property name='dataset_id' type='string' key='dataset_id'>
  491. 知识库 ID
  492. </Property>
  493. <Property name='document_id' type='string' key='document_id'>
  494. 文档 ID
  495. </Property>
  496. </Properties>
  497. ### Request Body
  498. <Properties>
  499. <Property name='name' type='string' key='name'>
  500. 文档名称(选填)
  501. </Property>
  502. <Property name='file' type='multipart/form-data' key='file'>
  503. 需要上传的文件
  504. </Property>
  505. <Property name='process_rule' type='object' key='process_rule'>
  506. 处理规则(选填)
  507. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义
  508. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  509. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  510. - <code>id</code> (string) 预处理规则的唯一标识符
  511. - 枚举:
  512. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  513. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  514. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  515. - <code>segmentation</code> (object) 分段规则
  516. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  517. - <code>max_tokens</code> 最大长度(token)默认为 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='获取文档嵌入状态(进度)'
  573. name='#indexing_status'
  574. />
  575. <Row>
  576. <Col>
  577. ### Path
  578. <Properties>
  579. <Property name='dataset_id' type='string' key='dataset_id'>
  580. 知识库 ID
  581. </Property>
  582. <Property name='batch' type='string' key='batch'>
  583. 上传文档的批次号
  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='删除文档'
  626. name='#delete_document'
  627. />
  628. <Row>
  629. <Col>
  630. ### Path
  631. <Properties>
  632. <Property name='dataset_id' type='string' key='dataset_id'>
  633. 知识库 ID
  634. </Property>
  635. <Property name='document_id' type='string' key='document_id'>
  636. 文档 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='知识库文档列表'
  666. name='#dataset_document_list'
  667. />
  668. <Row>
  669. <Col>
  670. ### Path
  671. <Properties>
  672. <Property name='dataset_id' type='string' key='dataset_id'>
  673. 知识库 ID
  674. </Property>
  675. </Properties>
  676. ### Query
  677. <Properties>
  678. <Property name='keyword' type='string' key='keyword'>
  679. 搜索关键词,可选,目前仅搜索文档名称
  680. </Property>
  681. <Property name='page' type='string' key='page'>
  682. 页码,可选
  683. </Property>
  684. <Property name='limit' type='string' key='limit'>
  685. 返回条数,可选,默认 20,范围 1-100
  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='新增分段'
  738. name='#create_new_segment'
  739. />
  740. <Row>
  741. <Col>
  742. ### Path
  743. <Properties>
  744. <Property name='dataset_id' type='string' key='dataset_id'>
  745. 知识库 ID
  746. </Property>
  747. <Property name='document_id' type='string' key='document_id'>
  748. 文档 ID
  749. </Property>
  750. </Properties>
  751. ### Request Body
  752. <Properties>
  753. <Property name='segments' type='object list' key='segments'>
  754. - <code>content</code> (text) 文本内容/问题内容,必填
  755. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  756. - <code>keywords</code> (list) 关键字,非必填
  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='查询文档分段'
  821. name='#get_segment'
  822. />
  823. <Row>
  824. <Col>
  825. ### Path
  826. <Properties>
  827. <Property name='dataset_id' type='string' key='dataset_id'>
  828. 知识库 ID
  829. </Property>
  830. <Property name='document_id' type='string' key='document_id'>
  831. 文档 ID
  832. </Property>
  833. </Properties>
  834. ### Query
  835. <Properties>
  836. <Property name='keyword' type='string' key='keyword'>
  837. 搜索关键词,可选
  838. </Property>
  839. <Property name='status' type='string' key='status'>
  840. 搜索状态,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='删除文档分段'
  896. name='#delete_segment'
  897. />
  898. <Row>
  899. <Col>
  900. ### Path
  901. <Properties>
  902. <Property name='dataset_id' type='string' key='dataset_id'>
  903. 知识库 ID
  904. </Property>
  905. <Property name='document_id' type='string' key='document_id'>
  906. 文档 ID
  907. </Property>
  908. <Property name='segment_id' type='string' key='segment_id'>
  909. 文档分段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}/documents/{document_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}/documents/{document_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='更新文档分段'
  940. name='#update_segment'
  941. />
  942. <Row>
  943. <Col>
  944. ### POST
  945. <Properties>
  946. <Property name='dataset_id' type='string' key='dataset_id'>
  947. 知识库 ID
  948. </Property>
  949. <Property name='document_id' type='string' key='document_id'>
  950. 文档 ID
  951. </Property>
  952. <Property name='segment_id' type='string' key='segment_id'>
  953. 文档分段ID
  954. </Property>
  955. </Properties>
  956. ### Request Body
  957. <Properties>
  958. <Property name='segment' type='object' key='segment'>
  959. - <code>content</code> (text) 文本内容/问题内容,必填
  960. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  961. - <code>keywords</code> (list) 关键字,非必填
  962. - <code>enabled</code> (bool) false/true,非必填
  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 'Authorization: Bearer {api_key}' \
  976. --header 'Content-Type: application/json' \
  977. --data-raw '{
  978. "segment": {
  979. "content": "1",
  980. "answer": "1",
  981. "keywords": ["a"],
  982. "enabled": false
  983. }
  984. }'
  985. ```
  986. </CodeGroup>
  987. <CodeGroup title="Response">
  988. ```json {{ title: 'Response' }}
  989. {
  990. "data": [{
  991. "id": "",
  992. "position": 1,
  993. "document_id": "",
  994. "content": "1",
  995. "answer": "1",
  996. "word_count": 25,
  997. "tokens": 0,
  998. "keywords": [
  999. "a"
  1000. ],
  1001. "index_node_id": "",
  1002. "index_node_hash": "",
  1003. "hit_count": 0,
  1004. "enabled": true,
  1005. "disabled_at": null,
  1006. "disabled_by": null,
  1007. "status": "completed",
  1008. "created_by": "",
  1009. "created_at": 1695312007,
  1010. "indexing_at": 1695312007,
  1011. "completed_at": 1695312007,
  1012. "error": null,
  1013. "stopped_at": null
  1014. }],
  1015. "doc_form": "text_model"
  1016. }
  1017. ```
  1018. </CodeGroup>
  1019. </Col>
  1020. </Row>
  1021. <hr className='ml-0 mr-0' />
  1022. <Heading
  1023. url='/datasets/{dataset_id}/retrieve'
  1024. method='POST'
  1025. title='检索知识库'
  1026. name='#dataset_retrieval'
  1027. />
  1028. <Row>
  1029. <Col>
  1030. ### Path
  1031. <Properties>
  1032. <Property name='dataset_id' type='string' key='dataset_id'>
  1033. 知识库 ID
  1034. </Property>
  1035. </Properties>
  1036. ### Request Body
  1037. <Properties>
  1038. <Property name='query' type='string' key='query'>
  1039. 检索关键词
  1040. </Property>
  1041. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1042. 检索参数(选填,如不填,按照默认方式召回)
  1043. - <code>search_method</code> (text) 检索方法:以下三个关键字之一,必填
  1044. - <code>keyword_search</code> 关键字检索
  1045. - <code>semantic_search</code> 语义检索
  1046. - <code>full_text_search</code> 全文检索
  1047. - <code>hybrid_search</code> 混合检索
  1048. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
  1049. - <code>reranking_mode</code> (object) Rerank模型配置,非必填,如果启用了 reranking 则传值
  1050. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  1051. - <code>reranking_model_name</code> (string) Rerank 模型名称
  1052. - <code>weights</code> (double) 混合检索模式下语意检索的权重设置
  1053. - <code>top_k</code> (integer) 返回结果数量,非必填
  1054. - <code>score_threshold_enabled</code> (bool) 是否开启 score 阈值
  1055. - <code>score_threshold</code> (double) Score 阈值
  1056. </Property>
  1057. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1058. 未启用字段
  1059. </Property>
  1060. </Properties>
  1061. </Col>
  1062. <Col sticky>
  1063. <CodeGroup
  1064. title="Request"
  1065. tag="POST"
  1066. label="/datasets/{dataset_id}/retrieve"
  1067. 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 '{
  1068. "query": "test",
  1069. "retrieval_model": {
  1070. "search_method": "keyword_search",
  1071. "reranking_enable": false,
  1072. "reranking_mode": null,
  1073. "reranking_model": {
  1074. "reranking_provider_name": "",
  1075. "reranking_model_name": ""
  1076. },
  1077. "weights": null,
  1078. "top_k": 1,
  1079. "score_threshold_enabled": false,
  1080. "score_threshold": null
  1081. }
  1082. }'`}
  1083. >
  1084. ```bash {{ title: 'cURL' }}
  1085. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1086. --header 'Authorization: Bearer {api_key}' \
  1087. --header 'Content-Type: application/json' \
  1088. --data-raw '{
  1089. "query": "test",
  1090. "retrieval_model": {
  1091. "search_method": "keyword_search",
  1092. "reranking_enable": false,
  1093. "reranking_mode": null,
  1094. "reranking_model": {
  1095. "reranking_provider_name": "",
  1096. "reranking_model_name": ""
  1097. },
  1098. "weights": null,
  1099. "top_k": 2,
  1100. "score_threshold_enabled": false,
  1101. "score_threshold": null
  1102. }
  1103. }'
  1104. ```
  1105. </CodeGroup>
  1106. <CodeGroup title="Response">
  1107. ```json {{ title: 'Response' }}
  1108. {
  1109. "query": {
  1110. "content": "test"
  1111. },
  1112. "records": [
  1113. {
  1114. "segment": {
  1115. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1116. "position": 1,
  1117. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1118. "content": "Operation guide",
  1119. "answer": null,
  1120. "word_count": 847,
  1121. "tokens": 280,
  1122. "keywords": [
  1123. "install",
  1124. "java",
  1125. "base",
  1126. "scripts",
  1127. "jdk",
  1128. "manual",
  1129. "internal",
  1130. "opens",
  1131. "add",
  1132. "vmoptions"
  1133. ],
  1134. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1135. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1136. "hit_count": 0,
  1137. "enabled": true,
  1138. "disabled_at": null,
  1139. "disabled_by": null,
  1140. "status": "completed",
  1141. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1142. "created_at": 1728734540,
  1143. "indexing_at": 1728734552,
  1144. "completed_at": 1728734584,
  1145. "error": null,
  1146. "stopped_at": null,
  1147. "document": {
  1148. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1149. "data_source_type": "upload_file",
  1150. "name": "readme.txt",
  1151. "doc_type": null
  1152. }
  1153. },
  1154. "score": 3.730463140527718e-05,
  1155. "tsne_position": null
  1156. }
  1157. ]
  1158. }
  1159. ```
  1160. </CodeGroup>
  1161. </Col>
  1162. </Row>
  1163. <hr className='ml-0 mr-0' />
  1164. <Row>
  1165. <Col>
  1166. ### 错误信息
  1167. <Properties>
  1168. <Property name='code' type='string' key='code'>
  1169. 返回的错误代码
  1170. </Property>
  1171. </Properties>
  1172. <Properties>
  1173. <Property name='status' type='number' key='status'>
  1174. 返回的错误状态
  1175. </Property>
  1176. </Properties>
  1177. <Properties>
  1178. <Property name='message' type='string' key='message'>
  1179. 返回的错误信息
  1180. </Property>
  1181. </Properties>
  1182. </Col>
  1183. <Col>
  1184. <CodeGroup title="Example">
  1185. ```json {{ title: 'Response' }}
  1186. {
  1187. "code": "no_file_uploaded",
  1188. "message": "Please upload your file.",
  1189. "status": 400
  1190. }
  1191. ```
  1192. </CodeGroup>
  1193. </Col>
  1194. </Row>
  1195. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  1196. <thead style={{ background: '#f9fafc' }}>
  1197. <tr>
  1198. <th className="p-2 border border-slate-300">code</th>
  1199. <th className="p-2 border border-slate-300">status</th>
  1200. <th className="p-2 border border-slate-300">message</th>
  1201. </tr>
  1202. </thead>
  1203. <tbody>
  1204. <tr>
  1205. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  1206. <td className="p-2 border border-slate-300">400</td>
  1207. <td className="p-2 border border-slate-300">Please upload your file.</td>
  1208. </tr>
  1209. <tr>
  1210. <td className="p-2 border border-slate-300">too_many_files</td>
  1211. <td className="p-2 border border-slate-300">400</td>
  1212. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  1213. </tr>
  1214. <tr>
  1215. <td className="p-2 border border-slate-300">file_too_large</td>
  1216. <td className="p-2 border border-slate-300">413</td>
  1217. <td className="p-2 border border-slate-300">File size exceeded.</td>
  1218. </tr>
  1219. <tr>
  1220. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  1221. <td className="p-2 border border-slate-300">415</td>
  1222. <td className="p-2 border border-slate-300">File type not allowed.</td>
  1223. </tr>
  1224. <tr>
  1225. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  1226. <td className="p-2 border border-slate-300">400</td>
  1227. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  1228. </tr>
  1229. <tr>
  1230. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  1231. <td className="p-2 border border-slate-300">400</td>
  1232. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  1233. </tr>
  1234. <tr>
  1235. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  1236. <td className="p-2 border border-slate-300">403</td>
  1237. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  1238. </tr>
  1239. <tr>
  1240. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  1241. <td className="p-2 border border-slate-300">409</td>
  1242. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  1243. </tr>
  1244. <tr>
  1245. <td className="p-2 border border-slate-300">invalid_action</td>
  1246. <td className="p-2 border border-slate-300">400</td>
  1247. <td className="p-2 border border-slate-300">Invalid action.</td>
  1248. </tr>
  1249. <tr>
  1250. <td className="p-2 border border-slate-300">document_already_finished</td>
  1251. <td className="p-2 border border-slate-300">400</td>
  1252. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  1253. </tr>
  1254. <tr>
  1255. <td className="p-2 border border-slate-300">document_indexing</td>
  1256. <td className="p-2 border border-slate-300">400</td>
  1257. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  1258. </tr>
  1259. <tr>
  1260. <td className="p-2 border border-slate-300">invalid_metadata</td>
  1261. <td className="p-2 border border-slate-300">400</td>
  1262. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  1263. </tr>
  1264. </tbody>
  1265. </table>
  1266. <div className="pb-4" />