You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

template.zh.mdx 80KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394
  1. {/**
  2. * @typedef Props
  3. * @property {string} apiBaseUrl
  4. */}
  5. import { CodeGroup } from '@/app/components/develop/code.tsx'
  6. import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'
  7. # 知识库 API
  8. <div>
  9. ### 鉴权
  10. Dify Service API 使用 `API-Key` 进行鉴权。
  11. 建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。
  12. 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
  13. <CodeGroup title="Code">
  14. ```javascript
  15. Authorization: Bearer {API_KEY}
  16. ```
  17. </CodeGroup>
  18. </div>
  19. <hr className='ml-0 mr-0' />
  20. <Heading
  21. url='/datasets/{dataset_id}/document/create-by-text'
  22. method='POST'
  23. title='通过文本创建文档'
  24. name='#create-by-text'
  25. />
  26. <Row>
  27. <Col>
  28. 此接口基于已存在知识库,在此知识库的基础上通过文本创建新的文档
  29. ### Path
  30. <Properties>
  31. <Property name='dataset_id' type='string' key='dataset_id'>
  32. 知识库 ID
  33. </Property>
  34. </Properties>
  35. ### Request Body
  36. <Properties>
  37. <Property name='name' type='string' key='name'>
  38. 文档名称
  39. </Property>
  40. <Property name='text' type='string' key='text'>
  41. 文档内容
  42. </Property>
  43. <Property name='indexing_technique' type='string' key='indexing_technique'>
  44. 索引方式
  45. - <code>high_quality</code> 高质量:使用
  46. ding 模型进行嵌入,构建为向量数据库索引
  47. - <code>economy</code> 经济:使用 keyword table index 的倒排索引进行构建
  48. </Property>
  49. <Property name='doc_form' type='string' key='doc_form'>
  50. 索引内容的形式
  51. - <code>text_model</code> text 文档直接 embedding,经济模式默认为该模式
  52. - <code>hierarchical_model</code> parent-child 模式
  53. - <code>qa_model</code> Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding
  54. </Property>
  55. <Property name='doc_language' type='string' key='doc_language'>
  56. 在 Q&A 模式下,指定文档的语言,例如:<code>English</code>、<code>Chinese</code>
  57. </Property>
  58. <Property name='process_rule' type='object' key='process_rule'>
  59. 处理规则
  60. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  61. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  62. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  63. - <code>id</code> (string) 预处理规则的唯一标识符
  64. - 枚举:
  65. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  66. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  67. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  68. - <code>segmentation</code> (object) 分段规则
  69. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 <code>\n</code>
  70. - <code>max_tokens</code> 最大长度(token)默认为 1000
  71. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  72. - <code>subchunk_segmentation</code> (object) 子分段规则
  73. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  74. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  75. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  76. </Property>
  77. <PropertyInstruction>当知识库未设置任何参数的时候,首次上传需要提供以下参数,未提供则使用默认选项:</PropertyInstruction>
  78. <Property name='retrieval_model' type='object' key='retrieval_model'>
  79. 检索模式
  80. - <code>search_method</code> (string) 检索方法
  81. - <code>hybrid_search</code> 混合检索
  82. - <code>semantic_search</code> 语义检索
  83. - <code>full_text_search</code> 全文检索
  84. - <code>reranking_enable</code> (bool) 是否开启rerank
  85. - <code>reranking_mode</code> (String) 混合检索
  86. - <code>weighted_score</code> 权重设置
  87. - <code>reranking_model</code> Rerank 模型
  88. - <code>reranking_model</code> (object) Rerank 模型配置
  89. - <code>reranking_provider_name</code> (string) Rerank 模型的提供商
  90. - <code>reranking_model_name</code> (string) Rerank 模型的名称
  91. - <code>top_k</code> (int) 召回条数
  92. - <code>score_threshold_enabled</code> (bool)是否开启召回分数限制
  93. - <code>score_threshold</code> (float) 召回分数限制
  94. </Property>
  95. <Property name='embedding_model' type='string' key='embedding_model'>
  96. Embedding 模型名称
  97. </Property>
  98. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  99. Embedding 模型供应商
  100. </Property>
  101. </Properties>
  102. </Col>
  103. <Col sticky>
  104. <CodeGroup
  105. title="Request"
  106. tag="POST"
  107. label="/datasets/{dataset_id}/document/create-by-text"
  108. 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"}}'`}
  109. >
  110. ```bash {{ title: 'cURL' }}
  111. curl --location --request --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \
  112. --header 'Authorization: Bearer {api_key}' \
  113. --header 'Content-Type: application/json' \
  114. --data-raw '{
  115. "name": "text",
  116. "text": "text",
  117. "indexing_technique": "high_quality",
  118. "process_rule": {
  119. "mode": "automatic"
  120. }
  121. }'
  122. ```
  123. </CodeGroup>
  124. <CodeGroup title="Response">
  125. ```json {{ title: 'Response' }}
  126. {
  127. "document": {
  128. "id": "",
  129. "position": 1,
  130. "data_source_type": "upload_file",
  131. "data_source_info": {
  132. "upload_file_id": ""
  133. },
  134. "dataset_process_rule_id": "",
  135. "name": "text.txt",
  136. "created_from": "api",
  137. "created_by": "",
  138. "created_at": 1695690280,
  139. "tokens": 0,
  140. "indexing_status": "waiting",
  141. "error": null,
  142. "enabled": true,
  143. "disabled_at": null,
  144. "disabled_by": null,
  145. "archived": false,
  146. "display_status": "queuing",
  147. "word_count": 0,
  148. "hit_count": 0,
  149. "doc_form": "text_model"
  150. },
  151. "batch": ""
  152. }
  153. ```
  154. </CodeGroup>
  155. </Col>
  156. </Row>
  157. <hr className='ml-0 mr-0' />
  158. <Heading
  159. url='/datasets/{dataset_id}/document/create-by-file'
  160. method='POST'
  161. title='通过文件创建文档 '
  162. name='#create-by-file'
  163. />
  164. <Row>
  165. <Col>
  166. 此接口基于已存在知识库,在此知识库的基础上通过文件创建新的文档
  167. ### Path
  168. <Properties>
  169. <Property name='dataset_id' type='string' key='dataset_id'>
  170. 知识库 ID
  171. </Property>
  172. </Properties>
  173. ### Request Body
  174. <Properties>
  175. <Property name='data' type='multipart/form-data json string' key='data'>
  176. - <code>original_document_id</code> 源文档 ID(选填)
  177. - 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制
  178. - 源文档不可为归档的文档
  179. - 当传入 <code>original_document_id</code> 时,代表文档进行更新操作,<code>process_rule</code> 为可填项目,不填默认使用源文档的分段方式
  180. - 未传入 <code>original_document_id</code> 时,代表文档进行新增操作,<code>process_rule</code> 为必填
  181. - <code>indexing_technique</code> 索引方式
  182. - <code>high_quality</code> 高质量:使用 embedding 模型进行嵌入,构建为向量数据库索引
  183. - <code>economy</code> 经济:使用 keyword table index 的倒排索引进行构建
  184. - <code>doc_form</code> 索引内容的形式
  185. - <code>text_model</code> text 文档直接 embedding,经济模式默认为该模式
  186. - <code>hierarchical_model</code> parent-child 模式
  187. - <code>qa_model</code> Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding
  188. - <code>doc_language</code> 在 Q&A 模式下,指定文档的语言,例如:<code>English</code>、<code>Chinese</code>
  189. - <code>process_rule</code> 处理规则
  190. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  191. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  192. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  193. - <code>id</code> (string) 预处理规则的唯一标识符
  194. - 枚举:
  195. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  196. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  197. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  198. - <code>segmentation</code> (object) 分段规则
  199. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  200. - <code>max_tokens</code> 最大长度(token)默认为 1000
  201. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  202. - <code>subchunk_segmentation</code> (object) 子分段规则
  203. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  204. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  205. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  206. </Property>
  207. <Property name='file' type='multipart/form-data' key='file'>
  208. 需要上传的文件。
  209. </Property>
  210. <PropertyInstruction>当知识库未设置任何参数的时候,首次上传需要提供以下参数,未提供则使用默认选项:</PropertyInstruction>
  211. <Property name='retrieval_model' type='object' key='retrieval_model'>
  212. 检索模式
  213. - <code>search_method</code> (string) 检索方法
  214. - <code>hybrid_search</code> 混合检索
  215. - <code>semantic_search</code> 语义检索
  216. - <code>full_text_search</code> 全文检索
  217. - <code>reranking_enable</code> (bool) 是否开启rerank
  218. - <code>reranking_model</code> (object) Rerank 模型配置
  219. - <code>reranking_provider_name</code> (string) Rerank 模型的提供商
  220. - <code>reranking_model_name</code> (string) Rerank 模型的名称
  221. - <code>top_k</code> (int) 召回条数
  222. - <code>score_threshold_enabled</code> (bool)是否开启召回分数限制
  223. - <code>score_threshold</code> (float) 召回分数限制
  224. </Property>
  225. <Property name='embedding_model' type='string' key='embedding_model'>
  226. Embedding 模型名称
  227. </Property>
  228. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  229. Embedding 模型供应商
  230. </Property>
  231. </Properties>
  232. </Col>
  233. <Col sticky>
  234. <CodeGroup
  235. title="Request"
  236. tag="POST"
  237. label="/datasets/{dataset_id}/document/create-by-file"
  238. 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"'`}
  239. >
  240. ```bash {{ title: 'cURL' }}
  241. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \
  242. --header 'Authorization: Bearer {api_key}' \
  243. --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' \
  244. --form 'file=@"/path/to/file"'
  245. ```
  246. </CodeGroup>
  247. <CodeGroup title="Response">
  248. ```json {{ title: 'Response' }}
  249. {
  250. "document": {
  251. "id": "",
  252. "position": 1,
  253. "data_source_type": "upload_file",
  254. "data_source_info": {
  255. "upload_file_id": ""
  256. },
  257. "dataset_process_rule_id": "",
  258. "name": "Dify.txt",
  259. "created_from": "api",
  260. "created_by": "",
  261. "created_at": 1695308667,
  262. "tokens": 0,
  263. "indexing_status": "waiting",
  264. "error": null,
  265. "enabled": true,
  266. "disabled_at": null,
  267. "disabled_by": null,
  268. "archived": false,
  269. "display_status": "queuing",
  270. "word_count": 0,
  271. "hit_count": 0,
  272. "doc_form": "text_model"
  273. },
  274. "batch": ""
  275. }
  276. ```
  277. </CodeGroup>
  278. </Col>
  279. </Row>
  280. <hr className='ml-0 mr-0' />
  281. <Heading
  282. url='/datasets'
  283. method='POST'
  284. title='创建空知识库'
  285. name='#create_empty_dataset'
  286. />
  287. <Row>
  288. <Col>
  289. ### Request Body
  290. <Properties>
  291. <Property name='name' type='string' key='name'>
  292. 知识库名称(必填)
  293. </Property>
  294. <Property name='description' type='string' key='description'>
  295. 知识库描述(选填)
  296. </Property>
  297. <Property name='indexing_technique' type='string' key='indexing_technique'>
  298. 索引模式(选填,建议填写)
  299. - <code>high_quality</code> 高质量
  300. - <code>economy</code> 经济
  301. </Property>
  302. <Property name='permission' type='string' key='permission'>
  303. 权限(选填,默认 only_me)
  304. - <code>only_me</code> 仅自己
  305. - <code>all_team_members</code> 所有团队成员
  306. - <code>partial_members</code> 部分团队成员
  307. </Property>
  308. <Property name='provider' type='string' key='provider'>
  309. Provider(选填,默认 vendor)
  310. - <code>vendor</code> 上传文件
  311. - <code>external</code> 外部知识库
  312. </Property>
  313. <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
  314. 外部知识库 API_ID(选填)
  315. </Property>
  316. <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
  317. 外部知识库 ID(选填)
  318. </Property>
  319. <Property name='embedding_model' type='str' key='embedding_model'>
  320. Embedding 模型名称
  321. </Property>
  322. <Property name='embedding_model_provider' type='str' key='embedding_model_provider'>
  323. Embedding 模型供应商
  324. </Property>
  325. <Property name='retrieval_model' type='object' key='retrieval_model'>
  326. 检索模式
  327. - <code>search_method</code> (string) 检索方法
  328. - <code>hybrid_search</code> 混合检索
  329. - <code>semantic_search</code> 语义检索
  330. - <code>full_text_search</code> 全文检索
  331. - <code>reranking_enable</code> (bool) 是否开启rerank
  332. - <code>reranking_model</code> (object) Rerank 模型配置
  333. - <code>reranking_provider_name</code> (string) Rerank 模型的提供商
  334. - <code>reranking_model_name</code> (string) Rerank 模型的名称
  335. - <code>top_k</code> (int) 召回条数
  336. - <code>score_threshold_enabled</code> (bool)是否开启召回分数限制
  337. - <code>score_threshold</code> (float) 召回分数限制
  338. </Property>
  339. </Properties>
  340. </Col>
  341. <Col sticky>
  342. <CodeGroup
  343. title="Request"
  344. tag="POST"
  345. label="/datasets"
  346. 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"}'`}
  347. >
  348. ```bash {{ title: 'cURL' }}
  349. curl --location --request POST '${props.apiBaseUrl}/datasets' \
  350. --header 'Authorization: Bearer {api_key}' \
  351. --header 'Content-Type: application/json' \
  352. --data-raw '{
  353. "name": "name",
  354. "permission": "only_me"
  355. }'
  356. ```
  357. </CodeGroup>
  358. <CodeGroup title="Response">
  359. ```json {{ title: 'Response' }}
  360. {
  361. "id": "",
  362. "name": "name",
  363. "description": null,
  364. "provider": "vendor",
  365. "permission": "only_me",
  366. "data_source_type": null,
  367. "indexing_technique": null,
  368. "app_count": 0,
  369. "document_count": 0,
  370. "word_count": 0,
  371. "created_by": "",
  372. "created_at": 1695636173,
  373. "updated_by": "",
  374. "updated_at": 1695636173,
  375. "embedding_model": null,
  376. "embedding_model_provider": null,
  377. "embedding_available": null
  378. }
  379. ```
  380. </CodeGroup>
  381. </Col>
  382. </Row>
  383. <hr className='ml-0 mr-0' />
  384. <Heading
  385. url='/datasets'
  386. method='GET'
  387. title='知识库列表'
  388. name='#dataset_list'
  389. />
  390. <Row>
  391. <Col>
  392. ### Query
  393. <Properties>
  394. <Property name='keyword' type='string' key='keyword'>
  395. 搜索关键词,可选
  396. </Property>
  397. <Property name='tag_ids' type='array[string]' key='tag_ids'>
  398. 标签 ID 列表,可选
  399. </Property>
  400. <Property name='page' type='integer' key='page'>
  401. 页码,可选,默认为 1
  402. </Property>
  403. <Property name='limit' type='string' key='limit'>
  404. 返回条数,可选,默认 20,范围 1-100
  405. </Property>
  406. <Property name='include_all' type='boolean' key='include_all'>
  407. 是否包含所有数据集(仅对所有者生效),可选,默认为 false
  408. </Property>
  409. </Properties>
  410. </Col>
  411. <Col sticky>
  412. <CodeGroup
  413. title="Request"
  414. tag="GET"
  415. label="/datasets"
  416. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  417. >
  418. ```bash {{ title: 'cURL' }}
  419. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  420. --header 'Authorization: Bearer {api_key}'
  421. ```
  422. </CodeGroup>
  423. <CodeGroup title="Response">
  424. ```json {{ title: 'Response' }}
  425. {
  426. "data": [
  427. {
  428. "id": "",
  429. "name": "知识库名称",
  430. "description": "描述信息",
  431. "permission": "only_me",
  432. "data_source_type": "upload_file",
  433. "indexing_technique": "",
  434. "app_count": 2,
  435. "document_count": 10,
  436. "word_count": 1200,
  437. "created_by": "",
  438. "created_at": "",
  439. "updated_by": "",
  440. "updated_at": ""
  441. },
  442. ...
  443. ],
  444. "has_more": true,
  445. "limit": 20,
  446. "total": 50,
  447. "page": 1
  448. }
  449. ```
  450. </CodeGroup>
  451. </Col>
  452. </Row>
  453. <hr className='ml-0 mr-0' />
  454. <Heading
  455. url='/datasets/{dataset_id}'
  456. method='GET'
  457. title='查看知识库详情'
  458. name='#view_dataset'
  459. />
  460. <Row>
  461. <Col>
  462. ### Path
  463. <Properties>
  464. <Property name='dataset_id' type='string' key='dataset_id'>
  465. 知识库 ID
  466. </Property>
  467. </Properties>
  468. </Col>
  469. <Col sticky>
  470. <CodeGroup
  471. title="Request"
  472. tag="GET"
  473. label="/datasets/{dataset_id}"
  474. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  475. >
  476. ```bash {{ title: 'cURL' }}
  477. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \
  478. --header 'Authorization: Bearer {api_key}'
  479. ```
  480. </CodeGroup>
  481. <CodeGroup title="Response">
  482. ```json {{ title: 'Response' }}
  483. {
  484. "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
  485. "name": "Test Knowledge Base",
  486. "description": "",
  487. "provider": "vendor",
  488. "permission": "only_me",
  489. "data_source_type": null,
  490. "indexing_technique": null,
  491. "app_count": 0,
  492. "document_count": 0,
  493. "word_count": 0,
  494. "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  495. "created_at": 1735620612,
  496. "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  497. "updated_at": 1735620612,
  498. "embedding_model": null,
  499. "embedding_model_provider": null,
  500. "embedding_available": true,
  501. "retrieval_model_dict": {
  502. "search_method": "semantic_search",
  503. "reranking_enable": false,
  504. "reranking_mode": null,
  505. "reranking_model": {
  506. "reranking_provider_name": "",
  507. "reranking_model_name": ""
  508. },
  509. "weights": null,
  510. "top_k": 2,
  511. "score_threshold_enabled": false,
  512. "score_threshold": null
  513. },
  514. "tags": [],
  515. "doc_form": null,
  516. "external_knowledge_info": {
  517. "external_knowledge_id": null,
  518. "external_knowledge_api_id": null,
  519. "external_knowledge_api_name": null,
  520. "external_knowledge_api_endpoint": null
  521. },
  522. "external_retrieval_model": {
  523. "top_k": 2,
  524. "score_threshold": 0.0,
  525. "score_threshold_enabled": null
  526. }
  527. }
  528. ```
  529. </CodeGroup>
  530. </Col>
  531. </Row>
  532. <hr className='ml-0 mr-0' />
  533. <Heading
  534. url='/datasets/{dataset_id}'
  535. method='PATCH'
  536. title='修改知识库详情'
  537. name='#update_dataset'
  538. />
  539. <Row>
  540. <Col>
  541. ### Path
  542. <Properties>
  543. <Property name='dataset_id' type='string' key='dataset_id'>
  544. 知识库 ID
  545. </Property>
  546. </Properties>
  547. ### Request Body
  548. <Properties>
  549. <Property name='indexing_technique' type='string' key='indexing_technique'>
  550. 索引模式(选填,建议填写)
  551. - <code>high_quality</code> 高质量
  552. - <code>economy</code> 经济
  553. </Property>
  554. <Property name='permission' type='string' key='permission'>
  555. 权限(选填,默认 only_me)
  556. - <code>only_me</code> 仅自己
  557. - <code>all_team_members</code> 所有团队成员
  558. - <code>partial_members</code> 部分团队成员
  559. </Property>
  560. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  561. 嵌入模型提供商(选填), 必须先在系统内设定好接入的模型,对应的是provider字段
  562. </Property>
  563. <Property name='embedding_model' type='string' key='embedding_model'>
  564. 嵌入模型(选填)
  565. </Property>
  566. <Property name='retrieval_model' type='object' key='retrieval_model'>
  567. 检索参数(选填,如不填,按照默认方式召回)
  568. - <code>search_method</code> (text) 检索方法:以下四个关键字之一,必填
  569. - <code>keyword_search</code> 关键字检索
  570. - <code>semantic_search</code> 语义检索
  571. - <code>full_text_search</code> 全文检索
  572. - <code>hybrid_search</code> 混合检索
  573. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
  574. - <code>reranking_mode</code> (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
  575. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  576. - <code>reranking_model_name</code> (string) Rerank 模型名称
  577. - <code>weights</code> (float) 混合检索模式下语意检索的权重设置
  578. - <code>top_k</code> (integer) 返回结果数量,非必填
  579. - <code>score_threshold_enabled</code> (bool) 是否开启 score 阈值
  580. - <code>score_threshold</code> (float) Score 阈值
  581. </Property>
  582. <Property name='partial_member_list' type='array' key='partial_member_list'>
  583. 部分团队成员 ID 列表(选填)
  584. </Property>
  585. </Properties>
  586. </Col>
  587. <Col sticky>
  588. <CodeGroup
  589. title="Request"
  590. tag="PATCH"
  591. label="/datasets/{dataset_id}"
  592. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{
  593. "name": "Test Knowledge Base",
  594. "indexing_technique": "high_quality",
  595. "permission": "only_me",
  596. "embedding_model_provider": "zhipuai",
  597. "embedding_model": "embedding-3",
  598. "retrieval_model": {
  599. "search_method": "keyword_search",
  600. "reranking_enable": false,
  601. "reranking_mode": null,
  602. "reranking_model": {
  603. "reranking_provider_name": "",
  604. "reranking_model_name": ""
  605. },
  606. "weights": null,
  607. "top_k": 1,
  608. "score_threshold_enabled": false,
  609. "score_threshold": null
  610. },
  611. "partial_member_list": []
  612. }'
  613. `}
  614. >
  615. ```bash {{ title: 'cURL' }}
  616. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \
  617. --header 'Authorization: Bearer {api_key}' \
  618. --header 'Content-Type: application/json' \
  619. --data-raw '{
  620. "name": "Test Knowledge Base",
  621. "indexing_technique": "high_quality",
  622. "permission": "only_me",
  623. "embedding_model_provider": "zhipuai",
  624. "embedding_model": "embedding-3",
  625. "retrieval_model": {
  626. "search_method": "keyword_search",
  627. "reranking_enable": false,
  628. "reranking_mode": null,
  629. "reranking_model": {
  630. "reranking_provider_name": "",
  631. "reranking_model_name": ""
  632. },
  633. "weights": null,
  634. "top_k": 1,
  635. "score_threshold_enabled": false,
  636. "score_threshold": null
  637. },
  638. "partial_member_list": []
  639. }'
  640. ```
  641. </CodeGroup>
  642. <CodeGroup title="Response">
  643. ```json {{ title: 'Response' }}
  644. {
  645. "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
  646. "name": "Test Knowledge Base",
  647. "description": "",
  648. "provider": "vendor",
  649. "permission": "only_me",
  650. "data_source_type": null,
  651. "indexing_technique": "high_quality",
  652. "app_count": 0,
  653. "document_count": 0,
  654. "word_count": 0,
  655. "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  656. "created_at": 1735620612,
  657. "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  658. "updated_at": 1735622679,
  659. "embedding_model": "embedding-3",
  660. "embedding_model_provider": "zhipuai",
  661. "embedding_available": null,
  662. "retrieval_model_dict": {
  663. "search_method": "semantic_search",
  664. "reranking_enable": false,
  665. "reranking_mode": null,
  666. "reranking_model": {
  667. "reranking_provider_name": "",
  668. "reranking_model_name": ""
  669. },
  670. "weights": null,
  671. "top_k": 2,
  672. "score_threshold_enabled": false,
  673. "score_threshold": null
  674. },
  675. "tags": [],
  676. "doc_form": null,
  677. "external_knowledge_info": {
  678. "external_knowledge_id": null,
  679. "external_knowledge_api_id": null,
  680. "external_knowledge_api_name": null,
  681. "external_knowledge_api_endpoint": null
  682. },
  683. "external_retrieval_model": {
  684. "top_k": 2,
  685. "score_threshold": 0.0,
  686. "score_threshold_enabled": null
  687. },
  688. "partial_member_list": []
  689. }
  690. ```
  691. </CodeGroup>
  692. </Col>
  693. </Row>
  694. <hr className='ml-0 mr-0' />
  695. <Heading
  696. url='/datasets/{dataset_id}'
  697. method='DELETE'
  698. title='删除知识库'
  699. name='#delete_dataset'
  700. />
  701. <Row>
  702. <Col>
  703. ### Path
  704. <Properties>
  705. <Property name='dataset_id' type='string' key='dataset_id'>
  706. 知识库 ID
  707. </Property>
  708. </Properties>
  709. </Col>
  710. <Col sticky>
  711. <CodeGroup
  712. title="Request"
  713. tag="DELETE"
  714. label="/datasets/{dataset_id}"
  715. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  716. >
  717. ```bash {{ title: 'cURL' }}
  718. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
  719. --header 'Authorization: Bearer {api_key}'
  720. ```
  721. </CodeGroup>
  722. <CodeGroup title="Response">
  723. ```text {{ title: 'Response' }}
  724. 204 No Content
  725. ```
  726. </CodeGroup>
  727. </Col>
  728. </Row>
  729. <hr className='ml-0 mr-0' />
  730. <Heading
  731. url='/datasets/{dataset_id}/documents/{document_id}/update-by-text'
  732. method='POST'
  733. title='通过文本更新文档'
  734. name='#update-by-text'
  735. />
  736. <Row>
  737. <Col>
  738. 此接口基于已存在知识库,在此知识库的基础上通过文本更新文档
  739. ### Path
  740. <Properties>
  741. <Property name='dataset_id' type='string' key='dataset_id'>
  742. 知识库 ID
  743. </Property>
  744. <Property name='document_id' type='string' key='document_id'>
  745. 文档 ID
  746. </Property>
  747. </Properties>
  748. ### Request Body
  749. <Properties>
  750. <Property name='name' type='string' key='name'>
  751. 文档名称(选填)
  752. </Property>
  753. <Property name='text' type='string' key='text'>
  754. 文档内容(选填)
  755. </Property>
  756. <Property name='process_rule' type='object' key='process_rule'>
  757. 处理规则(选填)
  758. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  759. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  760. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  761. - <code>id</code> (string) 预处理规则的唯一标识符
  762. - 枚举:
  763. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  764. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  765. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  766. - <code>segmentation</code> (object) 分段规则
  767. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  768. - <code>max_tokens</code> 最大长度(token)默认为 1000
  769. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  770. - <code>subchunk_segmentation</code> (object) 子分段规则
  771. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  772. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  773. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  774. </Property>
  775. </Properties>
  776. </Col>
  777. <Col sticky>
  778. <CodeGroup
  779. title="Request"
  780. tag="POST"
  781. label="/datasets/{dataset_id}/documents/{document_id}/update-by-text"
  782. 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"}'`}
  783. >
  784. ```bash {{ title: 'cURL' }}
  785. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \
  786. --header 'Authorization: Bearer {api_key}' \
  787. --header 'Content-Type: application/json' \
  788. --data-raw '{
  789. "name": "name",
  790. "text": "text"
  791. }'
  792. ```
  793. </CodeGroup>
  794. <CodeGroup title="Response">
  795. ```json {{ title: 'Response' }}
  796. {
  797. "document": {
  798. "id": "",
  799. "position": 1,
  800. "data_source_type": "upload_file",
  801. "data_source_info": {
  802. "upload_file_id": ""
  803. },
  804. "dataset_process_rule_id": "",
  805. "name": "name.txt",
  806. "created_from": "api",
  807. "created_by": "",
  808. "created_at": 1695308667,
  809. "tokens": 0,
  810. "indexing_status": "waiting",
  811. "error": null,
  812. "enabled": true,
  813. "disabled_at": null,
  814. "disabled_by": null,
  815. "archived": false,
  816. "display_status": "queuing",
  817. "word_count": 0,
  818. "hit_count": 0,
  819. "doc_form": "text_model"
  820. },
  821. "batch": ""
  822. }
  823. ```
  824. </CodeGroup>
  825. </Col>
  826. </Row>
  827. <hr className='ml-0 mr-0' />
  828. <Heading
  829. url='/datasets/{dataset_id}/documents/{document_id}/update-by-file'
  830. method='POST'
  831. title='通过文件更新文档'
  832. name='#update-by-file'
  833. />
  834. <Row>
  835. <Col>
  836. 此接口基于已存在知识库,在此知识库的基础上通过文件更新文档的操作。
  837. ### Path
  838. <Properties>
  839. <Property name='dataset_id' type='string' key='dataset_id'>
  840. 知识库 ID
  841. </Property>
  842. <Property name='document_id' type='string' key='document_id'>
  843. 文档 ID
  844. </Property>
  845. </Properties>
  846. ### Request Body
  847. <Properties>
  848. <Property name='name' type='string' key='name'>
  849. 文档名称(选填)
  850. </Property>
  851. <Property name='file' type='multipart/form-data' key='file'>
  852. 需要上传的文件
  853. </Property>
  854. <Property name='process_rule' type='object' key='process_rule'>
  855. 处理规则(选填)
  856. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  857. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  858. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  859. - <code>id</code> (string) 预处理规则的唯一标识符
  860. - 枚举:
  861. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  862. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  863. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  864. - <code>segmentation</code> (object) 分段规则
  865. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  866. - <code>max_tokens</code> 最大长度(token)默认为 1000
  867. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  868. - <code>subchunk_segmentation</code> (object) 子分段规则
  869. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  870. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  871. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  872. </Property>
  873. </Properties>
  874. </Col>
  875. <Col sticky>
  876. <CodeGroup
  877. title="Request"
  878. tag="POST"
  879. label="/datasets/{dataset_id}/documents/{document_id}/update-by-file"
  880. 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"'`}
  881. >
  882. ```bash {{ title: 'cURL' }}
  883. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \
  884. --header 'Authorization: Bearer {api_key}' \
  885. --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' \
  886. --form 'file=@"/path/to/file"'
  887. ```
  888. </CodeGroup>
  889. <CodeGroup title="Response">
  890. ```json {{ title: 'Response' }}
  891. {
  892. "document": {
  893. "id": "",
  894. "position": 1,
  895. "data_source_type": "upload_file",
  896. "data_source_info": {
  897. "upload_file_id": ""
  898. },
  899. "dataset_process_rule_id": "",
  900. "name": "Dify.txt",
  901. "created_from": "api",
  902. "created_by": "",
  903. "created_at": 1695308667,
  904. "tokens": 0,
  905. "indexing_status": "waiting",
  906. "error": null,
  907. "enabled": true,
  908. "disabled_at": null,
  909. "disabled_by": null,
  910. "archived": false,
  911. "display_status": "queuing",
  912. "word_count": 0,
  913. "hit_count": 0,
  914. "doc_form": "text_model"
  915. },
  916. "batch": "20230921150427533684"
  917. }
  918. ```
  919. </CodeGroup>
  920. </Col>
  921. </Row>
  922. <hr className='ml-0 mr-0' />
  923. <Heading
  924. url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
  925. method='GET'
  926. title='获取文档嵌入状态(进度)'
  927. name='#indexing_status'
  928. />
  929. <Row>
  930. <Col>
  931. ### Path
  932. <Properties>
  933. <Property name='dataset_id' type='string' key='dataset_id'>
  934. 知识库 ID
  935. </Property>
  936. <Property name='batch' type='string' key='batch'>
  937. 上传文档的批次号
  938. </Property>
  939. </Properties>
  940. </Col>
  941. <Col sticky>
  942. <CodeGroup
  943. title="Request"
  944. tag="GET"
  945. label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
  946. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
  947. >
  948. ```bash {{ title: 'cURL' }}
  949. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
  950. --header 'Authorization: Bearer {api_key}' \
  951. ```
  952. </CodeGroup>
  953. <CodeGroup title="Response">
  954. ```json {{ title: 'Response' }}
  955. {
  956. "data":[{
  957. "id": "",
  958. "indexing_status": "indexing",
  959. "processing_started_at": 1681623462.0,
  960. "parsing_completed_at": 1681623462.0,
  961. "cleaning_completed_at": 1681623462.0,
  962. "splitting_completed_at": 1681623462.0,
  963. "completed_at": null,
  964. "paused_at": null,
  965. "error": null,
  966. "stopped_at": null,
  967. "completed_segments": 24,
  968. "total_segments": 100
  969. }]
  970. }
  971. ```
  972. </CodeGroup>
  973. </Col>
  974. </Row>
  975. <hr className='ml-0 mr-0' />
  976. <Heading
  977. url='/datasets/{dataset_id}/documents/{document_id}'
  978. method='DELETE'
  979. title='删除文档'
  980. name='#delete_document'
  981. />
  982. <Row>
  983. <Col>
  984. ### Path
  985. <Properties>
  986. <Property name='dataset_id' type='string' key='dataset_id'>
  987. 知识库 ID
  988. </Property>
  989. <Property name='document_id' type='string' key='document_id'>
  990. 文档 ID
  991. </Property>
  992. </Properties>
  993. </Col>
  994. <Col sticky>
  995. <CodeGroup
  996. title="Request"
  997. tag="DELETE"
  998. label="/datasets/{dataset_id}/documents/{document_id}"
  999. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1000. >
  1001. ```bash {{ title: 'cURL' }}
  1002. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  1003. --header 'Authorization: Bearer {api_key}' \
  1004. ```
  1005. </CodeGroup>
  1006. <CodeGroup title="Response">
  1007. ```text {{ title: 'Response' }}
  1008. 204 No Content
  1009. ```
  1010. </CodeGroup>
  1011. </Col>
  1012. </Row>
  1013. <hr className='ml-0 mr-0' />
  1014. <Heading
  1015. url='/datasets/{dataset_id}/documents'
  1016. method='GET'
  1017. title='知识库文档列表'
  1018. name='#dataset_document_list'
  1019. />
  1020. <Row>
  1021. <Col>
  1022. ### Path
  1023. <Properties>
  1024. <Property name='dataset_id' type='string' key='dataset_id'>
  1025. 知识库 ID
  1026. </Property>
  1027. </Properties>
  1028. ### Query
  1029. <Properties>
  1030. <Property name='keyword' type='string' key='keyword'>
  1031. 搜索关键词,可选,目前仅搜索文档名称
  1032. </Property>
  1033. <Property name='page' type='string' key='page'>
  1034. 页码,可选
  1035. </Property>
  1036. <Property name='limit' type='string' key='limit'>
  1037. 返回条数,可选,默认 20,范围 1-100
  1038. </Property>
  1039. </Properties>
  1040. </Col>
  1041. <Col sticky>
  1042. <CodeGroup
  1043. title="Request"
  1044. tag="GET"
  1045. label="/datasets/{dataset_id}/documents"
  1046. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  1047. >
  1048. ```bash {{ title: 'cURL' }}
  1049. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  1050. --header 'Authorization: Bearer {api_key}' \
  1051. ```
  1052. </CodeGroup>
  1053. <CodeGroup title="Response">
  1054. ```json {{ title: 'Response' }}
  1055. {
  1056. "data": [
  1057. {
  1058. "id": "",
  1059. "position": 1,
  1060. "data_source_type": "file_upload",
  1061. "data_source_info": null,
  1062. "dataset_process_rule_id": null,
  1063. "name": "dify",
  1064. "created_from": "",
  1065. "created_by": "",
  1066. "created_at": 1681623639,
  1067. "tokens": 0,
  1068. "indexing_status": "waiting",
  1069. "error": null,
  1070. "enabled": true,
  1071. "disabled_at": null,
  1072. "disabled_by": null,
  1073. "archived": false
  1074. },
  1075. ],
  1076. "has_more": false,
  1077. "limit": 20,
  1078. "total": 9,
  1079. "page": 1
  1080. }
  1081. ```
  1082. </CodeGroup>
  1083. </Col>
  1084. </Row>
  1085. <hr className='ml-0 mr-0' />
  1086. <Heading
  1087. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1088. method='POST'
  1089. title='新增分段'
  1090. name='#create_new_segment'
  1091. />
  1092. <Row>
  1093. <Col>
  1094. ### Path
  1095. <Properties>
  1096. <Property name='dataset_id' type='string' key='dataset_id'>
  1097. 知识库 ID
  1098. </Property>
  1099. <Property name='document_id' type='string' key='document_id'>
  1100. 文档 ID
  1101. </Property>
  1102. </Properties>
  1103. ### Request Body
  1104. <Properties>
  1105. <Property name='segments' type='object list' key='segments'>
  1106. - <code>content</code> (text) 文本内容/问题内容,必填
  1107. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  1108. - <code>keywords</code> (list) 关键字,非必填
  1109. </Property>
  1110. </Properties>
  1111. </Col>
  1112. <Col sticky>
  1113. <CodeGroup
  1114. title="Request"
  1115. tag="POST"
  1116. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1117. 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"]}]}'`}
  1118. >
  1119. ```bash {{ title: 'cURL' }}
  1120. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1121. --header 'Authorization: Bearer {api_key}' \
  1122. --header 'Content-Type: application/json' \
  1123. --data-raw '{
  1124. "segments": [
  1125. {
  1126. "content": "1",
  1127. "answer": "1",
  1128. "keywords": ["a"]
  1129. }
  1130. ]
  1131. }'
  1132. ```
  1133. </CodeGroup>
  1134. <CodeGroup title="Response">
  1135. ```json {{ title: 'Response' }}
  1136. {
  1137. "data": [{
  1138. "id": "",
  1139. "position": 1,
  1140. "document_id": "",
  1141. "content": "1",
  1142. "answer": "1",
  1143. "word_count": 25,
  1144. "tokens": 0,
  1145. "keywords": [
  1146. "a"
  1147. ],
  1148. "index_node_id": "",
  1149. "index_node_hash": "",
  1150. "hit_count": 0,
  1151. "enabled": true,
  1152. "disabled_at": null,
  1153. "disabled_by": null,
  1154. "status": "completed",
  1155. "created_by": "",
  1156. "created_at": 1695312007,
  1157. "indexing_at": 1695312007,
  1158. "completed_at": 1695312007,
  1159. "error": null,
  1160. "stopped_at": null
  1161. }],
  1162. "doc_form": "text_model"
  1163. }
  1164. ```
  1165. </CodeGroup>
  1166. </Col>
  1167. </Row>
  1168. <hr className='ml-0 mr-0' />
  1169. <Heading
  1170. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1171. method='GET'
  1172. title='查询文档分段'
  1173. name='#get_segment'
  1174. />
  1175. <Row>
  1176. <Col>
  1177. ### Path
  1178. <Properties>
  1179. <Property name='dataset_id' type='string' key='dataset_id'>
  1180. 知识库 ID
  1181. </Property>
  1182. <Property name='document_id' type='string' key='document_id'>
  1183. 文档 ID
  1184. </Property>
  1185. </Properties>
  1186. ### Query
  1187. <Properties>
  1188. <Property name='keyword' type='string' key='keyword'>
  1189. 搜索关键词,可选
  1190. </Property>
  1191. <Property name='status' type='string' key='status'>
  1192. 搜索状态,completed
  1193. </Property>
  1194. <Property name='page' type='string' key='page'>
  1195. 页码,可选
  1196. </Property>
  1197. <Property name='limit' type='string' key='limit'>
  1198. 返回条数,可选,默认 20,范围 1-100
  1199. </Property>
  1200. </Properties>
  1201. </Col>
  1202. <Col sticky>
  1203. <CodeGroup
  1204. title="Request"
  1205. tag="GET"
  1206. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1207. 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'`}
  1208. >
  1209. ```bash {{ title: 'cURL' }}
  1210. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1211. --header 'Authorization: Bearer {api_key}' \
  1212. --header 'Content-Type: application/json'
  1213. ```
  1214. </CodeGroup>
  1215. <CodeGroup title="Response">
  1216. ```json {{ title: 'Response' }}
  1217. {
  1218. "data": [{
  1219. "id": "",
  1220. "position": 1,
  1221. "document_id": "",
  1222. "content": "1",
  1223. "answer": "1",
  1224. "word_count": 25,
  1225. "tokens": 0,
  1226. "keywords": [
  1227. "a"
  1228. ],
  1229. "index_node_id": "",
  1230. "index_node_hash": "",
  1231. "hit_count": 0,
  1232. "enabled": true,
  1233. "disabled_at": null,
  1234. "disabled_by": null,
  1235. "status": "completed",
  1236. "created_by": "",
  1237. "created_at": 1695312007,
  1238. "indexing_at": 1695312007,
  1239. "completed_at": 1695312007,
  1240. "error": null,
  1241. "stopped_at": null
  1242. }],
  1243. "doc_form": "text_model",
  1244. "has_more": false,
  1245. "limit": 20,
  1246. "total": 9,
  1247. "page": 1
  1248. }
  1249. ```
  1250. </CodeGroup>
  1251. </Col>
  1252. </Row>
  1253. <hr className='ml-0 mr-0' />
  1254. <Heading
  1255. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1256. method='DELETE'
  1257. title='删除文档分段'
  1258. name='#delete_segment'
  1259. />
  1260. <Row>
  1261. <Col>
  1262. ### Path
  1263. <Properties>
  1264. <Property name='dataset_id' type='string' key='dataset_id'>
  1265. 知识库 ID
  1266. </Property>
  1267. <Property name='document_id' type='string' key='document_id'>
  1268. 文档 ID
  1269. </Property>
  1270. <Property name='segment_id' type='string' key='segment_id'>
  1271. 文档分段ID
  1272. </Property>
  1273. </Properties>
  1274. </Col>
  1275. <Col sticky>
  1276. <CodeGroup
  1277. title="Request"
  1278. tag="DELETE"
  1279. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1280. 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'`}
  1281. >
  1282. ```bash {{ title: 'cURL' }}
  1283. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1284. --header 'Authorization: Bearer {api_key}' \
  1285. --header 'Content-Type: application/json'
  1286. ```
  1287. </CodeGroup>
  1288. <CodeGroup title="Response">
  1289. ```text {{ title: 'Response' }}
  1290. 204 No Content
  1291. ```
  1292. </CodeGroup>
  1293. </Col>
  1294. </Row>
  1295. <hr className='ml-0 mr-0' />
  1296. <Heading
  1297. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1298. method='POST'
  1299. title='更新文档分段'
  1300. name='#update_segment'
  1301. />
  1302. <Row>
  1303. <Col>
  1304. ### POST
  1305. <Properties>
  1306. <Property name='dataset_id' type='string' key='dataset_id'>
  1307. 知识库 ID
  1308. </Property>
  1309. <Property name='document_id' type='string' key='document_id'>
  1310. 文档 ID
  1311. </Property>
  1312. <Property name='segment_id' type='string' key='segment_id'>
  1313. 文档分段ID
  1314. </Property>
  1315. </Properties>
  1316. ### Request Body
  1317. <Properties>
  1318. <Property name='segment' type='object' key='segment'>
  1319. - <code>content</code> (text) 文本内容/问题内容,必填
  1320. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  1321. - <code>keywords</code> (list) 关键字,非必填
  1322. - <code>enabled</code> (bool) false/true,非必填
  1323. - <code>regenerate_child_chunks</code> (bool) 是否重新生成子分段,非必填
  1324. </Property>
  1325. </Properties>
  1326. </Col>
  1327. <Col sticky>
  1328. <CodeGroup
  1329. title="Request"
  1330. tag="POST"
  1331. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1332. 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}}'`}
  1333. >
  1334. ```bash {{ title: 'cURL' }}
  1335. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1336. --header 'Authorization: Bearer {api_key}' \
  1337. --header 'Content-Type: application/json' \
  1338. --data-raw '{
  1339. "segment": {
  1340. "content": "1",
  1341. "answer": "1",
  1342. "keywords": ["a"],
  1343. "enabled": false
  1344. }
  1345. }'
  1346. ```
  1347. </CodeGroup>
  1348. <CodeGroup title="Response">
  1349. ```json {{ title: 'Response' }}
  1350. {
  1351. "data": {
  1352. "id": "",
  1353. "position": 1,
  1354. "document_id": "",
  1355. "content": "1",
  1356. "answer": "1",
  1357. "word_count": 25,
  1358. "tokens": 0,
  1359. "keywords": [
  1360. "a"
  1361. ],
  1362. "index_node_id": "",
  1363. "index_node_hash": "",
  1364. "hit_count": 0,
  1365. "enabled": true,
  1366. "disabled_at": null,
  1367. "disabled_by": null,
  1368. "status": "completed",
  1369. "created_by": "",
  1370. "created_at": 1695312007,
  1371. "indexing_at": 1695312007,
  1372. "completed_at": 1695312007,
  1373. "error": null,
  1374. "stopped_at": null
  1375. },
  1376. "doc_form": "text_model"
  1377. }
  1378. ```
  1379. </CodeGroup>
  1380. </Col>
  1381. </Row>
  1382. <hr className='ml-0 mr-0' />
  1383. <Heading
  1384. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1385. method='POST'
  1386. title='新增文档子分段'
  1387. name='#create_child_chunk'
  1388. />
  1389. <Row>
  1390. <Col>
  1391. ### Path
  1392. <Properties>
  1393. <Property name='dataset_id' type='string' key='dataset_id'>
  1394. 知识库 ID
  1395. </Property>
  1396. <Property name='document_id' type='string' key='document_id'>
  1397. 文档 ID
  1398. </Property>
  1399. <Property name='segment_id' type='string' key='segment_id'>
  1400. 分段 ID
  1401. </Property>
  1402. </Properties>
  1403. ### Request Body
  1404. <Properties>
  1405. <Property name='content' type='string' key='content'>
  1406. 子分段内容
  1407. </Property>
  1408. </Properties>
  1409. </Col>
  1410. <Col sticky>
  1411. <CodeGroup
  1412. title="Request"
  1413. tag="POST"
  1414. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1415. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"content": "子分段内容"}'`}
  1416. >
  1417. ```bash {{ title: 'cURL' }}
  1418. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1419. --header 'Authorization: Bearer {api_key}' \
  1420. --header 'Content-Type: application/json' \
  1421. --data-raw '{
  1422. "content": "子分段内容"
  1423. }'
  1424. ```
  1425. </CodeGroup>
  1426. <CodeGroup title="Response">
  1427. ```json {{ title: 'Response' }}
  1428. {
  1429. "data": {
  1430. "id": "",
  1431. "segment_id": "",
  1432. "content": "子分段内容",
  1433. "word_count": 25,
  1434. "tokens": 0,
  1435. "index_node_id": "",
  1436. "index_node_hash": "",
  1437. "status": "completed",
  1438. "created_by": "",
  1439. "created_at": 1695312007,
  1440. "indexing_at": 1695312007,
  1441. "completed_at": 1695312007,
  1442. "error": null,
  1443. "stopped_at": null
  1444. }
  1445. }
  1446. ```
  1447. </CodeGroup>
  1448. </Col>
  1449. </Row>
  1450. <hr className='ml-0 mr-0' />
  1451. <Heading
  1452. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1453. method='GET'
  1454. title='查询文档子分段'
  1455. name='#get_child_chunks'
  1456. />
  1457. <Row>
  1458. <Col>
  1459. ### Path
  1460. <Properties>
  1461. <Property name='dataset_id' type='string' key='dataset_id'>
  1462. 知识库 ID
  1463. </Property>
  1464. <Property name='document_id' type='string' key='document_id'>
  1465. 文档 ID
  1466. </Property>
  1467. <Property name='segment_id' type='string' key='segment_id'>
  1468. 分段 ID
  1469. </Property>
  1470. </Properties>
  1471. ### Query
  1472. <Properties>
  1473. <Property name='keyword' type='string' key='keyword'>
  1474. 搜索关键词(选填)
  1475. </Property>
  1476. <Property name='page' type='integer' key='page'>
  1477. 页码(选填,默认1)
  1478. </Property>
  1479. <Property name='limit' type='integer' key='limit'>
  1480. 每页数量(选填,默认20,最大100)
  1481. </Property>
  1482. </Properties>
  1483. </Col>
  1484. <Col sticky>
  1485. <CodeGroup
  1486. title="Request"
  1487. tag="GET"
  1488. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1489. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  1490. >
  1491. ```bash {{ title: 'cURL' }}
  1492. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1493. --header 'Authorization: Bearer {api_key}'
  1494. ```
  1495. </CodeGroup>
  1496. <CodeGroup title="Response">
  1497. ```json {{ title: 'Response' }}
  1498. {
  1499. "data": [{
  1500. "id": "",
  1501. "segment_id": "",
  1502. "content": "子分段内容",
  1503. "word_count": 25,
  1504. "tokens": 0,
  1505. "index_node_id": "",
  1506. "index_node_hash": "",
  1507. "status": "completed",
  1508. "created_by": "",
  1509. "created_at": 1695312007,
  1510. "indexing_at": 1695312007,
  1511. "completed_at": 1695312007,
  1512. "error": null,
  1513. "stopped_at": null
  1514. }],
  1515. "total": 1,
  1516. "total_pages": 1,
  1517. "page": 1,
  1518. "limit": 20
  1519. }
  1520. ```
  1521. </CodeGroup>
  1522. </Col>
  1523. </Row>
  1524. <hr className='ml-0 mr-0' />
  1525. <Heading
  1526. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1527. method='DELETE'
  1528. title='删除文档子分段'
  1529. name='#delete_child_chunk'
  1530. />
  1531. <Row>
  1532. <Col>
  1533. ### Path
  1534. <Properties>
  1535. <Property name='dataset_id' type='string' key='dataset_id'>
  1536. 知识库 ID
  1537. </Property>
  1538. <Property name='document_id' type='string' key='document_id'>
  1539. 文档 ID
  1540. </Property>
  1541. <Property name='segment_id' type='string' key='segment_id'>
  1542. 分段 ID
  1543. </Property>
  1544. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1545. 子分段 ID
  1546. </Property>
  1547. </Properties>
  1548. </Col>
  1549. <Col sticky>
  1550. <CodeGroup
  1551. title="Request"
  1552. tag="DELETE"
  1553. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1554. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1555. >
  1556. ```bash {{ title: 'cURL' }}
  1557. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1558. --header 'Authorization: Bearer {api_key}'
  1559. ```
  1560. </CodeGroup>
  1561. <CodeGroup title="Response">
  1562. ```text {{ title: 'Response' }}
  1563. 204 No Content
  1564. ```
  1565. </CodeGroup>
  1566. </Col>
  1567. </Row>
  1568. <hr className='ml-0 mr-0' />
  1569. <Row>
  1570. <Col>
  1571. ### 错误信息
  1572. <Properties>
  1573. <Property name='code' type='string' key='code'>
  1574. 返回的错误代码
  1575. </Property>
  1576. </Properties>
  1577. <Properties>
  1578. <Property name='status' type='number' key='status'>
  1579. 返回的错误状态
  1580. </Property>
  1581. </Properties>
  1582. <Properties>
  1583. <Property name='message' type='string' key='message'>
  1584. 返回的错误信息
  1585. </Property>
  1586. </Properties>
  1587. </Col>
  1588. <Col>
  1589. <CodeGroup title="Example">
  1590. ```json {{ title: 'Response' }}
  1591. {
  1592. "code": "no_file_uploaded",
  1593. "message": "Please upload your file.",
  1594. "status": 400
  1595. }
  1596. ```
  1597. </CodeGroup>
  1598. </Col>
  1599. </Row>
  1600. <hr className='ml-0 mr-0' />
  1601. <Heading
  1602. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1603. method='PATCH'
  1604. title='更新文档子分段'
  1605. name='#update_child_chunk'
  1606. />
  1607. <Row>
  1608. <Col>
  1609. ### Path
  1610. <Properties>
  1611. <Property name='dataset_id' type='string' key='dataset_id'>
  1612. 知识库 ID
  1613. </Property>
  1614. <Property name='document_id' type='string' key='document_id'>
  1615. 文档 ID
  1616. </Property>
  1617. <Property name='segment_id' type='string' key='segment_id'>
  1618. 分段 ID
  1619. </Property>
  1620. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1621. 子分段 ID
  1622. </Property>
  1623. </Properties>
  1624. ### Request Body
  1625. <Properties>
  1626. <Property name='content' type='string' key='content'>
  1627. 子分段内容
  1628. </Property>
  1629. </Properties>
  1630. </Col>
  1631. <Col sticky>
  1632. <CodeGroup
  1633. title="Request"
  1634. tag="PATCH"
  1635. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1636. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"content": "更新的子分段内容"}'`}
  1637. >
  1638. ```bash {{ title: 'cURL' }}
  1639. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1640. --header 'Authorization: Bearer {api_key}' \
  1641. --header 'Content-Type: application/json' \
  1642. --data-raw '{
  1643. "content": "更新的子分段内容"
  1644. }'
  1645. ```
  1646. </CodeGroup>
  1647. <CodeGroup title="Response">
  1648. ```json {{ title: 'Response' }}
  1649. {
  1650. "data": {
  1651. "id": "",
  1652. "segment_id": "",
  1653. "content": "更新的子分段内容",
  1654. "word_count": 25,
  1655. "tokens": 0,
  1656. "index_node_id": "",
  1657. "index_node_hash": "",
  1658. "status": "completed",
  1659. "created_by": "",
  1660. "created_at": 1695312007,
  1661. "indexing_at": 1695312007,
  1662. "completed_at": 1695312007,
  1663. "error": null,
  1664. "stopped_at": null
  1665. }
  1666. }
  1667. ```
  1668. </CodeGroup>
  1669. </Col>
  1670. </Row>
  1671. <hr className='ml-0 mr-0' />
  1672. <Heading
  1673. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1674. method='GET'
  1675. title='获取上传文件'
  1676. name='#get_upload_file'
  1677. />
  1678. <Row>
  1679. <Col>
  1680. ### Path
  1681. <Properties>
  1682. <Property name='dataset_id' type='string' key='dataset_id'>
  1683. 知识库 ID
  1684. </Property>
  1685. <Property name='document_id' type='string' key='document_id'>
  1686. 文档 ID
  1687. </Property>
  1688. </Properties>
  1689. </Col>
  1690. <Col sticky>
  1691. <CodeGroup
  1692. title="Request"
  1693. tag="GET"
  1694. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1695. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  1696. >
  1697. ```bash {{ title: 'cURL' }}
  1698. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1699. --header 'Authorization: Bearer {api_key}' \
  1700. --header 'Content-Type: application/json'
  1701. ```
  1702. </CodeGroup>
  1703. <CodeGroup title="Response">
  1704. ```json {{ title: 'Response' }}
  1705. {
  1706. "id": "file_id",
  1707. "name": "file_name",
  1708. "size": 1024,
  1709. "extension": "txt",
  1710. "url": "preview_url",
  1711. "download_url": "download_url",
  1712. "mime_type": "text/plain",
  1713. "created_by": "user_id",
  1714. "created_at": 1728734540,
  1715. }
  1716. ```
  1717. </CodeGroup>
  1718. </Col>
  1719. </Row>
  1720. <hr className='ml-0 mr-0' />
  1721. <Heading
  1722. url='/datasets/{dataset_id}/retrieve'
  1723. method='POST'
  1724. title='检索知识库'
  1725. name='#dataset_retrieval'
  1726. />
  1727. <Row>
  1728. <Col>
  1729. ### Path
  1730. <Properties>
  1731. <Property name='dataset_id' type='string' key='dataset_id'>
  1732. 知识库 ID
  1733. </Property>
  1734. </Properties>
  1735. ### Request Body
  1736. <Properties>
  1737. <Property name='query' type='string' key='query'>
  1738. 检索关键词
  1739. </Property>
  1740. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1741. 检索参数(选填,如不填,按照默认方式召回)
  1742. - <code>search_method</code> (text) 检索方法:以下四个关键字之一,必填
  1743. - <code>keyword_search</code> 关键字检索
  1744. - <code>semantic_search</code> 语义检索
  1745. - <code>full_text_search</code> 全文检索
  1746. - <code>hybrid_search</code> 混合检索
  1747. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
  1748. - <code>reranking_mode</code> (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
  1749. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  1750. - <code>reranking_model_name</code> (string) Rerank 模型名称
  1751. - <code>weights</code> (float) 混合检索模式下语意检索的权重设置
  1752. - <code>top_k</code> (integer) 返回结果数量,非必填
  1753. - <code>score_threshold_enabled</code> (bool) 是否开启 score 阈值
  1754. - <code>score_threshold</code> (float) Score 阈值
  1755. </Property>
  1756. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1757. 未启用字段
  1758. </Property>
  1759. </Properties>
  1760. </Col>
  1761. <Col sticky>
  1762. <CodeGroup
  1763. title="Request"
  1764. tag="POST"
  1765. label="/datasets/{dataset_id}/retrieve"
  1766. 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 '{
  1767. "query": "test",
  1768. "retrieval_model": {
  1769. "search_method": "keyword_search",
  1770. "reranking_enable": false,
  1771. "reranking_mode": null,
  1772. "reranking_model": {
  1773. "reranking_provider_name": "",
  1774. "reranking_model_name": ""
  1775. },
  1776. "weights": null,
  1777. "top_k": 1,
  1778. "score_threshold_enabled": false,
  1779. "score_threshold": null
  1780. }
  1781. }'`}
  1782. >
  1783. ```bash {{ title: 'cURL' }}
  1784. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1785. --header 'Authorization: Bearer {api_key}' \
  1786. --header 'Content-Type: application/json' \
  1787. --data-raw '{
  1788. "query": "test",
  1789. "retrieval_model": {
  1790. "search_method": "keyword_search",
  1791. "reranking_enable": false,
  1792. "reranking_mode": null,
  1793. "reranking_model": {
  1794. "reranking_provider_name": "",
  1795. "reranking_model_name": ""
  1796. },
  1797. "weights": null,
  1798. "top_k": 2,
  1799. "score_threshold_enabled": false,
  1800. "score_threshold": null
  1801. }
  1802. }'
  1803. ```
  1804. </CodeGroup>
  1805. <CodeGroup title="Response">
  1806. ```json {{ title: 'Response' }}
  1807. {
  1808. "query": {
  1809. "content": "test"
  1810. },
  1811. "records": [
  1812. {
  1813. "segment": {
  1814. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1815. "position": 1,
  1816. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1817. "content": "Operation guide",
  1818. "answer": null,
  1819. "word_count": 847,
  1820. "tokens": 280,
  1821. "keywords": [
  1822. "install",
  1823. "java",
  1824. "base",
  1825. "scripts",
  1826. "jdk",
  1827. "manual",
  1828. "internal",
  1829. "opens",
  1830. "add",
  1831. "vmoptions"
  1832. ],
  1833. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1834. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1835. "hit_count": 0,
  1836. "enabled": true,
  1837. "disabled_at": null,
  1838. "disabled_by": null,
  1839. "status": "completed",
  1840. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1841. "created_at": 1728734540,
  1842. "indexing_at": 1728734552,
  1843. "completed_at": 1728734584,
  1844. "error": null,
  1845. "stopped_at": null,
  1846. "document": {
  1847. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1848. "data_source_type": "upload_file",
  1849. "name": "readme.txt",
  1850. }
  1851. },
  1852. "score": 3.730463140527718e-05,
  1853. "tsne_position": null
  1854. }
  1855. ]
  1856. }
  1857. ```
  1858. </CodeGroup>
  1859. </Col>
  1860. </Row>
  1861. <hr className='ml-0 mr-0' />
  1862. <Heading
  1863. url='/datasets/{dataset_id}/metadata'
  1864. method='POST'
  1865. title='新增元数据'
  1866. name='#create_metadata'
  1867. />
  1868. <Row>
  1869. <Col>
  1870. ### Params
  1871. <Properties>
  1872. <Property name='dataset_id' type='string' key='dataset_id'>
  1873. 知识库 ID
  1874. </Property>
  1875. </Properties>
  1876. ### Request Body
  1877. <Properties>
  1878. <Property name='segment' type='object' key='segment'>
  1879. - <code>type</code> (string) 元数据类型,必填
  1880. - <code>name</code> (string) 元数据名称,必填
  1881. </Property>
  1882. </Properties>
  1883. </Col>
  1884. <Col sticky>
  1885. <CodeGroup
  1886. title="Request"
  1887. tag="POST"
  1888. label="/datasets/{dataset_id}/metadata"
  1889. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"type": "string", "name": "test"}'`}
  1890. >
  1891. ```bash {{ title: 'cURL' }}
  1892. ```
  1893. </CodeGroup>
  1894. <CodeGroup title="Response">
  1895. ```json {{ title: 'Response' }}
  1896. {
  1897. "id": "abc",
  1898. "type": "string",
  1899. "name": "test",
  1900. }
  1901. ```
  1902. </CodeGroup>
  1903. </Col>
  1904. </Row>
  1905. <hr className='ml-0 mr-0' />
  1906. <Heading
  1907. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1908. method='PATCH'
  1909. title='更新元数据'
  1910. name='#update_metadata'
  1911. />
  1912. <Row>
  1913. <Col>
  1914. ### Path
  1915. <Properties>
  1916. <Property name='dataset_id' type='string' key='dataset_id'>
  1917. 知识库 ID
  1918. </Property>
  1919. <Property name='metadata_id' type='string' key='metadata_id'>
  1920. 元数据 ID
  1921. </Property>
  1922. </Properties>
  1923. ### Request Body
  1924. <Properties>
  1925. <Property name='segment' type='object' key='segment'>
  1926. - <code>name</code> (string) 元数据名称,必填
  1927. </Property>
  1928. </Properties>
  1929. </Col>
  1930. <Col sticky>
  1931. <CodeGroup
  1932. title="Request"
  1933. tag="PATCH"
  1934. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1935. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"name": "test"}'`}
  1936. >
  1937. ```bash {{ title: 'cURL' }}
  1938. ```
  1939. </CodeGroup>
  1940. <CodeGroup title="Response">
  1941. ```json {{ title: 'Response' }}
  1942. {
  1943. "id": "abc",
  1944. "type": "string",
  1945. "name": "test",
  1946. }
  1947. ```
  1948. </CodeGroup>
  1949. </Col>
  1950. </Row>
  1951. <hr className='ml-0 mr-0' />
  1952. <Heading
  1953. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1954. method='DELETE'
  1955. title='删除元数据'
  1956. name='#delete_metadata'
  1957. />
  1958. <Row>
  1959. <Col>
  1960. ### Path
  1961. <Properties>
  1962. <Property name='dataset_id' type='string' key='dataset_id'>
  1963. 知识库 ID
  1964. </Property>
  1965. <Property name='metadata_id' type='string' key='metadata_id'>
  1966. 元数据 ID
  1967. </Property>
  1968. </Properties>
  1969. </Col>
  1970. <Col sticky>
  1971. <CodeGroup
  1972. title="Request"
  1973. tag="DELETE"
  1974. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1975. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1976. >
  1977. ```bash {{ title: 'cURL' }}
  1978. ```
  1979. </CodeGroup>
  1980. </Col>
  1981. </Row>
  1982. <hr className='ml-0 mr-0' />
  1983. <Heading
  1984. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  1985. method='POST'
  1986. title='启用/禁用内置元数据'
  1987. name='#toggle_metadata'
  1988. />
  1989. <Row>
  1990. <Col>
  1991. ### Path
  1992. <Properties>
  1993. <Property name='dataset_id' type='string' key='dataset_id'>
  1994. 知识库 ID
  1995. </Property>
  1996. <Property name='action' type='string' key='action'>
  1997. disable/enable
  1998. </Property>
  1999. </Properties>
  2000. </Col>
  2001. <Col sticky>
  2002. <CodeGroup
  2003. title="Request"
  2004. tag="POST"
  2005. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  2006. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2007. >
  2008. ```bash {{ title: 'cURL' }}
  2009. ```
  2010. </CodeGroup>
  2011. </Col>
  2012. </Row>
  2013. <hr className='ml-0 mr-0' />
  2014. <Heading
  2015. url='/datasets/{dataset_id}/documents/metadata'
  2016. method='POST'
  2017. title='更新文档元数据'
  2018. name='#update_documents_metadata'
  2019. />
  2020. <Row>
  2021. <Col>
  2022. ### Path
  2023. <Properties>
  2024. <Property name='dataset_id' type='string' key='dataset_id'>
  2025. 知识库 ID
  2026. </Property>
  2027. </Properties>
  2028. ### Request Body
  2029. <Properties>
  2030. <Property name='operation_data' type='object list' key='segments'>
  2031. - <code>document_id</code> (string) 文档 ID
  2032. - <code>metadata_list</code> (list) 元数据列表
  2033. - <code>id</code> (string) 元数据 ID
  2034. - <code>type</code> (string) 元数据类型
  2035. - <code>name</code> (string) 元数据名称
  2036. </Property>
  2037. </Properties>
  2038. </Col>
  2039. <Col sticky>
  2040. <CodeGroup
  2041. title="Request"
  2042. tag="POST"
  2043. label="/datasets/{dataset_id}/documents/metadata"
  2044. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"operation_data": [{"document_id": "document_id", "metadata_list": [{"id": "id", "value": "value", "name": "name"}]}]}'`}
  2045. >
  2046. ```bash {{ title: 'cURL' }}
  2047. ```
  2048. </CodeGroup>
  2049. </Col>
  2050. </Row>
  2051. <hr className='ml-0 mr-0' />
  2052. <Heading
  2053. url='/datasets/{dataset_id}/metadata'
  2054. method='GET'
  2055. title='查询知识库元数据列表'
  2056. name='#dataset_metadata_list'
  2057. />
  2058. <Row>
  2059. <Col>
  2060. ### Path
  2061. <Properties>
  2062. <Property name='dataset_id' type='string' key='dataset_id'>
  2063. 知识库 ID
  2064. </Property>
  2065. </Properties>
  2066. </Col>
  2067. <Col sticky>
  2068. <CodeGroup
  2069. title="Request"
  2070. tag="GET"
  2071. label="/datasets/{dataset_id}/metadata"
  2072. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  2073. >
  2074. ```bash {{ title: 'cURL' }}
  2075. ```
  2076. </CodeGroup>
  2077. <CodeGroup title="Response">
  2078. ```json {{ title: 'Response' }}
  2079. {
  2080. "doc_metadata": [
  2081. {
  2082. "id": "",
  2083. "name": "name",
  2084. "type": "string",
  2085. "use_count": 0,
  2086. },
  2087. ...
  2088. ],
  2089. "built_in_field_enabled": true
  2090. }
  2091. ```
  2092. </CodeGroup>
  2093. </Col>
  2094. </Row>
  2095. <hr className='ml-0 mr-0' />
  2096. <Heading
  2097. url='/workspaces/current/models/model-types/text-embedding'
  2098. method='GET'
  2099. title='获取嵌入模型列表'
  2100. name='#model_type_list'
  2101. />
  2102. <Row>
  2103. <Col>
  2104. ### Query
  2105. <Properties>
  2106. </Properties>
  2107. </Col>
  2108. <Col sticky>
  2109. <CodeGroup
  2110. title="Request"
  2111. tag="GET"
  2112. label="/datasets/{dataset_id}"
  2113. targetCode={`curl --location --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' `}
  2114. >
  2115. ```bash {{ title: 'cURL' }}
  2116. curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
  2117. --header 'Authorization: Bearer {api_key}' \
  2118. --header 'Content-Type: application/json' \
  2119. ```
  2120. </CodeGroup>
  2121. <CodeGroup title="Response">
  2122. ```json {{ title: 'Response' }}
  2123. {
  2124. "data": [
  2125. {
  2126. "provider": "zhipuai",
  2127. "label": {
  2128. "zh_Hans": "智谱 AI",
  2129. "en_US": "ZHIPU AI"
  2130. },
  2131. "icon_small": {
  2132. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
  2133. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
  2134. },
  2135. "icon_large": {
  2136. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
  2137. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
  2138. },
  2139. "status": "active",
  2140. "models": [
  2141. {
  2142. "model": "embedding-3",
  2143. "label": {
  2144. "zh_Hans": "embedding-3",
  2145. "en_US": "embedding-3"
  2146. },
  2147. "model_type": "text-embedding",
  2148. "features": null,
  2149. "fetch_from": "predefined-model",
  2150. "model_properties": {
  2151. "context_size": 8192
  2152. },
  2153. "deprecated": false,
  2154. "status": "active",
  2155. "load_balancing_enabled": false
  2156. },
  2157. {
  2158. "model": "embedding-2",
  2159. "label": {
  2160. "zh_Hans": "embedding-2",
  2161. "en_US": "embedding-2"
  2162. },
  2163. "model_type": "text-embedding",
  2164. "features": null,
  2165. "fetch_from": "predefined-model",
  2166. "model_properties": {
  2167. "context_size": 8192
  2168. },
  2169. "deprecated": false,
  2170. "status": "active",
  2171. "load_balancing_enabled": false
  2172. },
  2173. {
  2174. "model": "text_embedding",
  2175. "label": {
  2176. "zh_Hans": "text_embedding",
  2177. "en_US": "text_embedding"
  2178. },
  2179. "model_type": "text-embedding",
  2180. "features": null,
  2181. "fetch_from": "predefined-model",
  2182. "model_properties": {
  2183. "context_size": 512
  2184. },
  2185. "deprecated": false,
  2186. "status": "active",
  2187. "load_balancing_enabled": false
  2188. }
  2189. ]
  2190. }
  2191. ]
  2192. }
  2193. ```
  2194. </CodeGroup>
  2195. </Col>
  2196. </Row>
  2197. <hr className='ml-0 mr-0' />
  2198. <Row>
  2199. <Col>
  2200. ### 错误信息
  2201. <Properties>
  2202. <Property name='code' type='string' key='code'>
  2203. 返回的错误代码
  2204. </Property>
  2205. </Properties>
  2206. <Properties>
  2207. <Property name='status' type='number' key='status'>
  2208. 返回的错误状态
  2209. </Property>
  2210. </Properties>
  2211. <Properties>
  2212. <Property name='message' type='string' key='message'>
  2213. 返回的错误信息
  2214. </Property>
  2215. </Properties>
  2216. </Col>
  2217. <Col>
  2218. <CodeGroup title="Example">
  2219. ```json {{ title: 'Response' }}
  2220. {
  2221. "code": "no_file_uploaded",
  2222. "message": "Please upload your file.",
  2223. "status": 400
  2224. }
  2225. ```
  2226. </CodeGroup>
  2227. </Col>
  2228. </Row>
  2229. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2230. <thead style={{ background: '#f9fafc' }}>
  2231. <tr>
  2232. <th className="p-2 border border-slate-300">code</th>
  2233. <th className="p-2 border border-slate-300">status</th>
  2234. <th className="p-2 border border-slate-300">message</th>
  2235. </tr>
  2236. </thead>
  2237. <tbody>
  2238. <tr>
  2239. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2240. <td className="p-2 border border-slate-300">400</td>
  2241. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2242. </tr>
  2243. <tr>
  2244. <td className="p-2 border border-slate-300">too_many_files</td>
  2245. <td className="p-2 border border-slate-300">400</td>
  2246. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2247. </tr>
  2248. <tr>
  2249. <td className="p-2 border border-slate-300">file_too_large</td>
  2250. <td className="p-2 border border-slate-300">413</td>
  2251. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2252. </tr>
  2253. <tr>
  2254. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2255. <td className="p-2 border border-slate-300">415</td>
  2256. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2257. </tr>
  2258. <tr>
  2259. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2260. <td className="p-2 border border-slate-300">400</td>
  2261. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2262. </tr>
  2263. <tr>
  2264. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2265. <td className="p-2 border border-slate-300">400</td>
  2266. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2267. </tr>
  2268. <tr>
  2269. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2270. <td className="p-2 border border-slate-300">403</td>
  2271. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2272. </tr>
  2273. <tr>
  2274. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2275. <td className="p-2 border border-slate-300">409</td>
  2276. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2277. </tr>
  2278. <tr>
  2279. <td className="p-2 border border-slate-300">invalid_action</td>
  2280. <td className="p-2 border border-slate-300">400</td>
  2281. <td className="p-2 border border-slate-300">Invalid action.</td>
  2282. </tr>
  2283. <tr>
  2284. <td className="p-2 border border-slate-300">document_already_finished</td>
  2285. <td className="p-2 border border-slate-300">400</td>
  2286. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2287. </tr>
  2288. <tr>
  2289. <td className="p-2 border border-slate-300">document_indexing</td>
  2290. <td className="p-2 border border-slate-300">400</td>
  2291. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2292. </tr>
  2293. <tr>
  2294. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2295. <td className="p-2 border border-slate-300">400</td>
  2296. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2297. </tr>
  2298. </tbody>
  2299. </table>
  2300. <div className="pb-4" />