Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

template.zh.mdx 79KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400
  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 自定义
  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 自定义
  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_provider_name' type='str' key='embedding_provider_name'>
  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 自定义
  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 自定义
  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. ```json {{ title: 'Response' }}
  1008. {
  1009. "result": "success"
  1010. }
  1011. ```
  1012. </CodeGroup>
  1013. </Col>
  1014. </Row>
  1015. <hr className='ml-0 mr-0' />
  1016. <Heading
  1017. url='/datasets/{dataset_id}/documents'
  1018. method='GET'
  1019. title='知识库文档列表'
  1020. name='#dataset_document_list'
  1021. />
  1022. <Row>
  1023. <Col>
  1024. ### Path
  1025. <Properties>
  1026. <Property name='dataset_id' type='string' key='dataset_id'>
  1027. 知识库 ID
  1028. </Property>
  1029. </Properties>
  1030. ### Query
  1031. <Properties>
  1032. <Property name='keyword' type='string' key='keyword'>
  1033. 搜索关键词,可选,目前仅搜索文档名称
  1034. </Property>
  1035. <Property name='page' type='string' key='page'>
  1036. 页码,可选
  1037. </Property>
  1038. <Property name='limit' type='string' key='limit'>
  1039. 返回条数,可选,默认 20,范围 1-100
  1040. </Property>
  1041. </Properties>
  1042. </Col>
  1043. <Col sticky>
  1044. <CodeGroup
  1045. title="Request"
  1046. tag="GET"
  1047. label="/datasets/{dataset_id}/documents"
  1048. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  1049. >
  1050. ```bash {{ title: 'cURL' }}
  1051. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  1052. --header 'Authorization: Bearer {api_key}' \
  1053. ```
  1054. </CodeGroup>
  1055. <CodeGroup title="Response">
  1056. ```json {{ title: 'Response' }}
  1057. {
  1058. "data": [
  1059. {
  1060. "id": "",
  1061. "position": 1,
  1062. "data_source_type": "file_upload",
  1063. "data_source_info": null,
  1064. "dataset_process_rule_id": null,
  1065. "name": "dify",
  1066. "created_from": "",
  1067. "created_by": "",
  1068. "created_at": 1681623639,
  1069. "tokens": 0,
  1070. "indexing_status": "waiting",
  1071. "error": null,
  1072. "enabled": true,
  1073. "disabled_at": null,
  1074. "disabled_by": null,
  1075. "archived": false
  1076. },
  1077. ],
  1078. "has_more": false,
  1079. "limit": 20,
  1080. "total": 9,
  1081. "page": 1
  1082. }
  1083. ```
  1084. </CodeGroup>
  1085. </Col>
  1086. </Row>
  1087. <hr className='ml-0 mr-0' />
  1088. <Heading
  1089. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1090. method='POST'
  1091. title='新增分段'
  1092. name='#create_new_segment'
  1093. />
  1094. <Row>
  1095. <Col>
  1096. ### Path
  1097. <Properties>
  1098. <Property name='dataset_id' type='string' key='dataset_id'>
  1099. 知识库 ID
  1100. </Property>
  1101. <Property name='document_id' type='string' key='document_id'>
  1102. 文档 ID
  1103. </Property>
  1104. </Properties>
  1105. ### Request Body
  1106. <Properties>
  1107. <Property name='segments' type='object list' key='segments'>
  1108. - <code>content</code> (text) 文本内容/问题内容,必填
  1109. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  1110. - <code>keywords</code> (list) 关键字,非必填
  1111. </Property>
  1112. </Properties>
  1113. </Col>
  1114. <Col sticky>
  1115. <CodeGroup
  1116. title="Request"
  1117. tag="POST"
  1118. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1119. 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"]}]}'`}
  1120. >
  1121. ```bash {{ title: 'cURL' }}
  1122. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1123. --header 'Authorization: Bearer {api_key}' \
  1124. --header 'Content-Type: application/json' \
  1125. --data-raw '{
  1126. "segments": [
  1127. {
  1128. "content": "1",
  1129. "answer": "1",
  1130. "keywords": ["a"]
  1131. }
  1132. ]
  1133. }'
  1134. ```
  1135. </CodeGroup>
  1136. <CodeGroup title="Response">
  1137. ```json {{ title: 'Response' }}
  1138. {
  1139. "data": [{
  1140. "id": "",
  1141. "position": 1,
  1142. "document_id": "",
  1143. "content": "1",
  1144. "answer": "1",
  1145. "word_count": 25,
  1146. "tokens": 0,
  1147. "keywords": [
  1148. "a"
  1149. ],
  1150. "index_node_id": "",
  1151. "index_node_hash": "",
  1152. "hit_count": 0,
  1153. "enabled": true,
  1154. "disabled_at": null,
  1155. "disabled_by": null,
  1156. "status": "completed",
  1157. "created_by": "",
  1158. "created_at": 1695312007,
  1159. "indexing_at": 1695312007,
  1160. "completed_at": 1695312007,
  1161. "error": null,
  1162. "stopped_at": null
  1163. }],
  1164. "doc_form": "text_model"
  1165. }
  1166. ```
  1167. </CodeGroup>
  1168. </Col>
  1169. </Row>
  1170. <hr className='ml-0 mr-0' />
  1171. <Heading
  1172. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1173. method='GET'
  1174. title='查询文档分段'
  1175. name='#get_segment'
  1176. />
  1177. <Row>
  1178. <Col>
  1179. ### Path
  1180. <Properties>
  1181. <Property name='dataset_id' type='string' key='dataset_id'>
  1182. 知识库 ID
  1183. </Property>
  1184. <Property name='document_id' type='string' key='document_id'>
  1185. 文档 ID
  1186. </Property>
  1187. </Properties>
  1188. ### Query
  1189. <Properties>
  1190. <Property name='keyword' type='string' key='keyword'>
  1191. 搜索关键词,可选
  1192. </Property>
  1193. <Property name='status' type='string' key='status'>
  1194. 搜索状态,completed
  1195. </Property>
  1196. <Property name='page' type='string' key='page'>
  1197. 页码,可选
  1198. </Property>
  1199. <Property name='limit' type='string' key='limit'>
  1200. 返回条数,可选,默认 20,范围 1-100
  1201. </Property>
  1202. </Properties>
  1203. </Col>
  1204. <Col sticky>
  1205. <CodeGroup
  1206. title="Request"
  1207. tag="GET"
  1208. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1209. 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'`}
  1210. >
  1211. ```bash {{ title: 'cURL' }}
  1212. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1213. --header 'Authorization: Bearer {api_key}' \
  1214. --header 'Content-Type: application/json'
  1215. ```
  1216. </CodeGroup>
  1217. <CodeGroup title="Response">
  1218. ```json {{ title: 'Response' }}
  1219. {
  1220. "data": [{
  1221. "id": "",
  1222. "position": 1,
  1223. "document_id": "",
  1224. "content": "1",
  1225. "answer": "1",
  1226. "word_count": 25,
  1227. "tokens": 0,
  1228. "keywords": [
  1229. "a"
  1230. ],
  1231. "index_node_id": "",
  1232. "index_node_hash": "",
  1233. "hit_count": 0,
  1234. "enabled": true,
  1235. "disabled_at": null,
  1236. "disabled_by": null,
  1237. "status": "completed",
  1238. "created_by": "",
  1239. "created_at": 1695312007,
  1240. "indexing_at": 1695312007,
  1241. "completed_at": 1695312007,
  1242. "error": null,
  1243. "stopped_at": null
  1244. }],
  1245. "doc_form": "text_model",
  1246. "has_more": false,
  1247. "limit": 20,
  1248. "total": 9,
  1249. "page": 1
  1250. }
  1251. ```
  1252. </CodeGroup>
  1253. </Col>
  1254. </Row>
  1255. <hr className='ml-0 mr-0' />
  1256. <Heading
  1257. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1258. method='DELETE'
  1259. title='删除文档分段'
  1260. name='#delete_segment'
  1261. />
  1262. <Row>
  1263. <Col>
  1264. ### Path
  1265. <Properties>
  1266. <Property name='dataset_id' type='string' key='dataset_id'>
  1267. 知识库 ID
  1268. </Property>
  1269. <Property name='document_id' type='string' key='document_id'>
  1270. 文档 ID
  1271. </Property>
  1272. <Property name='segment_id' type='string' key='segment_id'>
  1273. 文档分段ID
  1274. </Property>
  1275. </Properties>
  1276. </Col>
  1277. <Col sticky>
  1278. <CodeGroup
  1279. title="Request"
  1280. tag="DELETE"
  1281. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1282. 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'`}
  1283. >
  1284. ```bash {{ title: 'cURL' }}
  1285. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1286. --header 'Authorization: Bearer {api_key}' \
  1287. --header 'Content-Type: application/json'
  1288. ```
  1289. </CodeGroup>
  1290. <CodeGroup title="Response">
  1291. ```json {{ title: 'Response' }}
  1292. {
  1293. "result": "success"
  1294. }
  1295. ```
  1296. </CodeGroup>
  1297. </Col>
  1298. </Row>
  1299. <hr className='ml-0 mr-0' />
  1300. <Heading
  1301. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1302. method='POST'
  1303. title='更新文档分段'
  1304. name='#update_segment'
  1305. />
  1306. <Row>
  1307. <Col>
  1308. ### POST
  1309. <Properties>
  1310. <Property name='dataset_id' type='string' key='dataset_id'>
  1311. 知识库 ID
  1312. </Property>
  1313. <Property name='document_id' type='string' key='document_id'>
  1314. 文档 ID
  1315. </Property>
  1316. <Property name='segment_id' type='string' key='segment_id'>
  1317. 文档分段ID
  1318. </Property>
  1319. </Properties>
  1320. ### Request Body
  1321. <Properties>
  1322. <Property name='segment' type='object' key='segment'>
  1323. - <code>content</code> (text) 文本内容/问题内容,必填
  1324. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  1325. - <code>keywords</code> (list) 关键字,非必填
  1326. - <code>enabled</code> (bool) false/true,非必填
  1327. - <code>regenerate_child_chunks</code> (bool) 是否重新生成子分段,非必填
  1328. </Property>
  1329. </Properties>
  1330. </Col>
  1331. <Col sticky>
  1332. <CodeGroup
  1333. title="Request"
  1334. tag="POST"
  1335. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1336. 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}}'`}
  1337. >
  1338. ```bash {{ title: 'cURL' }}
  1339. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1340. --header 'Authorization: Bearer {api_key}' \
  1341. --header 'Content-Type: application/json' \
  1342. --data-raw '{
  1343. "segment": {
  1344. "content": "1",
  1345. "answer": "1",
  1346. "keywords": ["a"],
  1347. "enabled": false
  1348. }
  1349. }'
  1350. ```
  1351. </CodeGroup>
  1352. <CodeGroup title="Response">
  1353. ```json {{ title: 'Response' }}
  1354. {
  1355. "data": {
  1356. "id": "",
  1357. "position": 1,
  1358. "document_id": "",
  1359. "content": "1",
  1360. "answer": "1",
  1361. "word_count": 25,
  1362. "tokens": 0,
  1363. "keywords": [
  1364. "a"
  1365. ],
  1366. "index_node_id": "",
  1367. "index_node_hash": "",
  1368. "hit_count": 0,
  1369. "enabled": true,
  1370. "disabled_at": null,
  1371. "disabled_by": null,
  1372. "status": "completed",
  1373. "created_by": "",
  1374. "created_at": 1695312007,
  1375. "indexing_at": 1695312007,
  1376. "completed_at": 1695312007,
  1377. "error": null,
  1378. "stopped_at": null
  1379. },
  1380. "doc_form": "text_model"
  1381. }
  1382. ```
  1383. </CodeGroup>
  1384. </Col>
  1385. </Row>
  1386. <hr className='ml-0 mr-0' />
  1387. <Heading
  1388. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1389. method='POST'
  1390. title='新增文档子分段'
  1391. name='#create_child_chunk'
  1392. />
  1393. <Row>
  1394. <Col>
  1395. ### Path
  1396. <Properties>
  1397. <Property name='dataset_id' type='string' key='dataset_id'>
  1398. 知识库 ID
  1399. </Property>
  1400. <Property name='document_id' type='string' key='document_id'>
  1401. 文档 ID
  1402. </Property>
  1403. <Property name='segment_id' type='string' key='segment_id'>
  1404. 分段 ID
  1405. </Property>
  1406. </Properties>
  1407. ### Request Body
  1408. <Properties>
  1409. <Property name='content' type='string' key='content'>
  1410. 子分段内容
  1411. </Property>
  1412. </Properties>
  1413. </Col>
  1414. <Col sticky>
  1415. <CodeGroup
  1416. title="Request"
  1417. tag="POST"
  1418. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1419. 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": "子分段内容"}'`}
  1420. >
  1421. ```bash {{ title: 'cURL' }}
  1422. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1423. --header 'Authorization: Bearer {api_key}' \
  1424. --header 'Content-Type: application/json' \
  1425. --data-raw '{
  1426. "content": "子分段内容"
  1427. }'
  1428. ```
  1429. </CodeGroup>
  1430. <CodeGroup title="Response">
  1431. ```json {{ title: 'Response' }}
  1432. {
  1433. "data": {
  1434. "id": "",
  1435. "segment_id": "",
  1436. "content": "子分段内容",
  1437. "word_count": 25,
  1438. "tokens": 0,
  1439. "index_node_id": "",
  1440. "index_node_hash": "",
  1441. "status": "completed",
  1442. "created_by": "",
  1443. "created_at": 1695312007,
  1444. "indexing_at": 1695312007,
  1445. "completed_at": 1695312007,
  1446. "error": null,
  1447. "stopped_at": null
  1448. }
  1449. }
  1450. ```
  1451. </CodeGroup>
  1452. </Col>
  1453. </Row>
  1454. <hr className='ml-0 mr-0' />
  1455. <Heading
  1456. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1457. method='GET'
  1458. title='查询文档子分段'
  1459. name='#get_child_chunks'
  1460. />
  1461. <Row>
  1462. <Col>
  1463. ### Path
  1464. <Properties>
  1465. <Property name='dataset_id' type='string' key='dataset_id'>
  1466. 知识库 ID
  1467. </Property>
  1468. <Property name='document_id' type='string' key='document_id'>
  1469. 文档 ID
  1470. </Property>
  1471. <Property name='segment_id' type='string' key='segment_id'>
  1472. 分段 ID
  1473. </Property>
  1474. </Properties>
  1475. ### Query
  1476. <Properties>
  1477. <Property name='keyword' type='string' key='keyword'>
  1478. 搜索关键词(选填)
  1479. </Property>
  1480. <Property name='page' type='integer' key='page'>
  1481. 页码(选填,默认1)
  1482. </Property>
  1483. <Property name='limit' type='integer' key='limit'>
  1484. 每页数量(选填,默认20,最大100)
  1485. </Property>
  1486. </Properties>
  1487. </Col>
  1488. <Col sticky>
  1489. <CodeGroup
  1490. title="Request"
  1491. tag="GET"
  1492. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1493. 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}'`}
  1494. >
  1495. ```bash {{ title: 'cURL' }}
  1496. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1497. --header 'Authorization: Bearer {api_key}'
  1498. ```
  1499. </CodeGroup>
  1500. <CodeGroup title="Response">
  1501. ```json {{ title: 'Response' }}
  1502. {
  1503. "data": [{
  1504. "id": "",
  1505. "segment_id": "",
  1506. "content": "子分段内容",
  1507. "word_count": 25,
  1508. "tokens": 0,
  1509. "index_node_id": "",
  1510. "index_node_hash": "",
  1511. "status": "completed",
  1512. "created_by": "",
  1513. "created_at": 1695312007,
  1514. "indexing_at": 1695312007,
  1515. "completed_at": 1695312007,
  1516. "error": null,
  1517. "stopped_at": null
  1518. }],
  1519. "total": 1,
  1520. "total_pages": 1,
  1521. "page": 1,
  1522. "limit": 20
  1523. }
  1524. ```
  1525. </CodeGroup>
  1526. </Col>
  1527. </Row>
  1528. <hr className='ml-0 mr-0' />
  1529. <Heading
  1530. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1531. method='DELETE'
  1532. title='删除文档子分段'
  1533. name='#delete_child_chunk'
  1534. />
  1535. <Row>
  1536. <Col>
  1537. ### Path
  1538. <Properties>
  1539. <Property name='dataset_id' type='string' key='dataset_id'>
  1540. 知识库 ID
  1541. </Property>
  1542. <Property name='document_id' type='string' key='document_id'>
  1543. 文档 ID
  1544. </Property>
  1545. <Property name='segment_id' type='string' key='segment_id'>
  1546. 分段 ID
  1547. </Property>
  1548. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1549. 子分段 ID
  1550. </Property>
  1551. </Properties>
  1552. </Col>
  1553. <Col sticky>
  1554. <CodeGroup
  1555. title="Request"
  1556. tag="DELETE"
  1557. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1558. 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}'`}
  1559. >
  1560. ```bash {{ title: 'cURL' }}
  1561. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1562. --header 'Authorization: Bearer {api_key}'
  1563. ```
  1564. </CodeGroup>
  1565. <CodeGroup title="Response">
  1566. ```json {{ title: 'Response' }}
  1567. {
  1568. "result": "success"
  1569. }
  1570. ```
  1571. </CodeGroup>
  1572. </Col>
  1573. </Row>
  1574. <hr className='ml-0 mr-0' />
  1575. <Row>
  1576. <Col>
  1577. ### 错误信息
  1578. <Properties>
  1579. <Property name='code' type='string' key='code'>
  1580. 返回的错误代码
  1581. </Property>
  1582. </Properties>
  1583. <Properties>
  1584. <Property name='status' type='number' key='status'>
  1585. 返回的错误状态
  1586. </Property>
  1587. </Properties>
  1588. <Properties>
  1589. <Property name='message' type='string' key='message'>
  1590. 返回的错误信息
  1591. </Property>
  1592. </Properties>
  1593. </Col>
  1594. <Col>
  1595. <CodeGroup title="Example">
  1596. ```json {{ title: 'Response' }}
  1597. {
  1598. "code": "no_file_uploaded",
  1599. "message": "Please upload your file.",
  1600. "status": 400
  1601. }
  1602. ```
  1603. </CodeGroup>
  1604. </Col>
  1605. </Row>
  1606. <hr className='ml-0 mr-0' />
  1607. <Heading
  1608. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1609. method='PATCH'
  1610. title='更新文档子分段'
  1611. name='#update_child_chunk'
  1612. />
  1613. <Row>
  1614. <Col>
  1615. ### Path
  1616. <Properties>
  1617. <Property name='dataset_id' type='string' key='dataset_id'>
  1618. 知识库 ID
  1619. </Property>
  1620. <Property name='document_id' type='string' key='document_id'>
  1621. 文档 ID
  1622. </Property>
  1623. <Property name='segment_id' type='string' key='segment_id'>
  1624. 分段 ID
  1625. </Property>
  1626. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1627. 子分段 ID
  1628. </Property>
  1629. </Properties>
  1630. ### Request Body
  1631. <Properties>
  1632. <Property name='content' type='string' key='content'>
  1633. 子分段内容
  1634. </Property>
  1635. </Properties>
  1636. </Col>
  1637. <Col sticky>
  1638. <CodeGroup
  1639. title="Request"
  1640. tag="PATCH"
  1641. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1642. 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": "更新的子分段内容"}'`}
  1643. >
  1644. ```bash {{ title: 'cURL' }}
  1645. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1646. --header 'Authorization: Bearer {api_key}' \
  1647. --header 'Content-Type: application/json' \
  1648. --data-raw '{
  1649. "content": "更新的子分段内容"
  1650. }'
  1651. ```
  1652. </CodeGroup>
  1653. <CodeGroup title="Response">
  1654. ```json {{ title: 'Response' }}
  1655. {
  1656. "data": {
  1657. "id": "",
  1658. "segment_id": "",
  1659. "content": "更新的子分段内容",
  1660. "word_count": 25,
  1661. "tokens": 0,
  1662. "index_node_id": "",
  1663. "index_node_hash": "",
  1664. "status": "completed",
  1665. "created_by": "",
  1666. "created_at": 1695312007,
  1667. "indexing_at": 1695312007,
  1668. "completed_at": 1695312007,
  1669. "error": null,
  1670. "stopped_at": null
  1671. }
  1672. }
  1673. ```
  1674. </CodeGroup>
  1675. </Col>
  1676. </Row>
  1677. <hr className='ml-0 mr-0' />
  1678. <Heading
  1679. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1680. method='GET'
  1681. title='获取上传文件'
  1682. name='#get_upload_file'
  1683. />
  1684. <Row>
  1685. <Col>
  1686. ### Path
  1687. <Properties>
  1688. <Property name='dataset_id' type='string' key='dataset_id'>
  1689. 知识库 ID
  1690. </Property>
  1691. <Property name='document_id' type='string' key='document_id'>
  1692. 文档 ID
  1693. </Property>
  1694. </Properties>
  1695. </Col>
  1696. <Col sticky>
  1697. <CodeGroup
  1698. title="Request"
  1699. tag="GET"
  1700. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1701. 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'`}
  1702. >
  1703. ```bash {{ title: 'cURL' }}
  1704. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1705. --header 'Authorization: Bearer {api_key}' \
  1706. --header 'Content-Type: application/json'
  1707. ```
  1708. </CodeGroup>
  1709. <CodeGroup title="Response">
  1710. ```json {{ title: 'Response' }}
  1711. {
  1712. "id": "file_id",
  1713. "name": "file_name",
  1714. "size": 1024,
  1715. "extension": "txt",
  1716. "url": "preview_url",
  1717. "download_url": "download_url",
  1718. "mime_type": "text/plain",
  1719. "created_by": "user_id",
  1720. "created_at": 1728734540,
  1721. }
  1722. ```
  1723. </CodeGroup>
  1724. </Col>
  1725. </Row>
  1726. <hr className='ml-0 mr-0' />
  1727. <Heading
  1728. url='/datasets/{dataset_id}/retrieve'
  1729. method='POST'
  1730. title='检索知识库'
  1731. name='#dataset_retrieval'
  1732. />
  1733. <Row>
  1734. <Col>
  1735. ### Path
  1736. <Properties>
  1737. <Property name='dataset_id' type='string' key='dataset_id'>
  1738. 知识库 ID
  1739. </Property>
  1740. </Properties>
  1741. ### Request Body
  1742. <Properties>
  1743. <Property name='query' type='string' key='query'>
  1744. 检索关键词
  1745. </Property>
  1746. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1747. 检索参数(选填,如不填,按照默认方式召回)
  1748. - <code>search_method</code> (text) 检索方法:以下四个关键字之一,必填
  1749. - <code>keyword_search</code> 关键字检索
  1750. - <code>semantic_search</code> 语义检索
  1751. - <code>full_text_search</code> 全文检索
  1752. - <code>hybrid_search</code> 混合检索
  1753. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
  1754. - <code>reranking_mode</code> (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
  1755. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  1756. - <code>reranking_model_name</code> (string) Rerank 模型名称
  1757. - <code>weights</code> (float) 混合检索模式下语意检索的权重设置
  1758. - <code>top_k</code> (integer) 返回结果数量,非必填
  1759. - <code>score_threshold_enabled</code> (bool) 是否开启 score 阈值
  1760. - <code>score_threshold</code> (float) Score 阈值
  1761. </Property>
  1762. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  1763. 未启用字段
  1764. </Property>
  1765. </Properties>
  1766. </Col>
  1767. <Col sticky>
  1768. <CodeGroup
  1769. title="Request"
  1770. tag="POST"
  1771. label="/datasets/{dataset_id}/retrieve"
  1772. 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 '{
  1773. "query": "test",
  1774. "retrieval_model": {
  1775. "search_method": "keyword_search",
  1776. "reranking_enable": false,
  1777. "reranking_mode": null,
  1778. "reranking_model": {
  1779. "reranking_provider_name": "",
  1780. "reranking_model_name": ""
  1781. },
  1782. "weights": null,
  1783. "top_k": 1,
  1784. "score_threshold_enabled": false,
  1785. "score_threshold": null
  1786. }
  1787. }'`}
  1788. >
  1789. ```bash {{ title: 'cURL' }}
  1790. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  1791. --header 'Authorization: Bearer {api_key}' \
  1792. --header 'Content-Type: application/json' \
  1793. --data-raw '{
  1794. "query": "test",
  1795. "retrieval_model": {
  1796. "search_method": "keyword_search",
  1797. "reranking_enable": false,
  1798. "reranking_mode": null,
  1799. "reranking_model": {
  1800. "reranking_provider_name": "",
  1801. "reranking_model_name": ""
  1802. },
  1803. "weights": null,
  1804. "top_k": 2,
  1805. "score_threshold_enabled": false,
  1806. "score_threshold": null
  1807. }
  1808. }'
  1809. ```
  1810. </CodeGroup>
  1811. <CodeGroup title="Response">
  1812. ```json {{ title: 'Response' }}
  1813. {
  1814. "query": {
  1815. "content": "test"
  1816. },
  1817. "records": [
  1818. {
  1819. "segment": {
  1820. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  1821. "position": 1,
  1822. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1823. "content": "Operation guide",
  1824. "answer": null,
  1825. "word_count": 847,
  1826. "tokens": 280,
  1827. "keywords": [
  1828. "install",
  1829. "java",
  1830. "base",
  1831. "scripts",
  1832. "jdk",
  1833. "manual",
  1834. "internal",
  1835. "opens",
  1836. "add",
  1837. "vmoptions"
  1838. ],
  1839. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  1840. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  1841. "hit_count": 0,
  1842. "enabled": true,
  1843. "disabled_at": null,
  1844. "disabled_by": null,
  1845. "status": "completed",
  1846. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  1847. "created_at": 1728734540,
  1848. "indexing_at": 1728734552,
  1849. "completed_at": 1728734584,
  1850. "error": null,
  1851. "stopped_at": null,
  1852. "document": {
  1853. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  1854. "data_source_type": "upload_file",
  1855. "name": "readme.txt",
  1856. }
  1857. },
  1858. "score": 3.730463140527718e-05,
  1859. "tsne_position": null
  1860. }
  1861. ]
  1862. }
  1863. ```
  1864. </CodeGroup>
  1865. </Col>
  1866. </Row>
  1867. <hr className='ml-0 mr-0' />
  1868. <Heading
  1869. url='/datasets/{dataset_id}/metadata'
  1870. method='POST'
  1871. title='新增元数据'
  1872. name='#create_metadata'
  1873. />
  1874. <Row>
  1875. <Col>
  1876. ### Params
  1877. <Properties>
  1878. <Property name='dataset_id' type='string' key='dataset_id'>
  1879. 知识库 ID
  1880. </Property>
  1881. </Properties>
  1882. ### Request Body
  1883. <Properties>
  1884. <Property name='segment' type='object' key='segment'>
  1885. - <code>type</code> (string) 元数据类型,必填
  1886. - <code>name</code> (string) 元数据名称,必填
  1887. </Property>
  1888. </Properties>
  1889. </Col>
  1890. <Col sticky>
  1891. <CodeGroup
  1892. title="Request"
  1893. tag="POST"
  1894. label="/datasets/{dataset_id}/metadata"
  1895. 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"}'`}
  1896. >
  1897. ```bash {{ title: 'cURL' }}
  1898. ```
  1899. </CodeGroup>
  1900. <CodeGroup title="Response">
  1901. ```json {{ title: 'Response' }}
  1902. {
  1903. "id": "abc",
  1904. "type": "string",
  1905. "name": "test",
  1906. }
  1907. ```
  1908. </CodeGroup>
  1909. </Col>
  1910. </Row>
  1911. <hr className='ml-0 mr-0' />
  1912. <Heading
  1913. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1914. method='PATCH'
  1915. title='更新元数据'
  1916. name='#update_metadata'
  1917. />
  1918. <Row>
  1919. <Col>
  1920. ### Path
  1921. <Properties>
  1922. <Property name='dataset_id' type='string' key='dataset_id'>
  1923. 知识库 ID
  1924. </Property>
  1925. <Property name='metadata_id' type='string' key='metadata_id'>
  1926. 元数据 ID
  1927. </Property>
  1928. </Properties>
  1929. ### Request Body
  1930. <Properties>
  1931. <Property name='segment' type='object' key='segment'>
  1932. - <code>name</code> (string) 元数据名称,必填
  1933. </Property>
  1934. </Properties>
  1935. </Col>
  1936. <Col sticky>
  1937. <CodeGroup
  1938. title="Request"
  1939. tag="PATCH"
  1940. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1941. 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"}'`}
  1942. >
  1943. ```bash {{ title: 'cURL' }}
  1944. ```
  1945. </CodeGroup>
  1946. <CodeGroup title="Response">
  1947. ```json {{ title: 'Response' }}
  1948. {
  1949. "id": "abc",
  1950. "type": "string",
  1951. "name": "test",
  1952. }
  1953. ```
  1954. </CodeGroup>
  1955. </Col>
  1956. </Row>
  1957. <hr className='ml-0 mr-0' />
  1958. <Heading
  1959. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  1960. method='DELETE'
  1961. title='删除元数据'
  1962. name='#delete_metadata'
  1963. />
  1964. <Row>
  1965. <Col>
  1966. ### Path
  1967. <Properties>
  1968. <Property name='dataset_id' type='string' key='dataset_id'>
  1969. 知识库 ID
  1970. </Property>
  1971. <Property name='metadata_id' type='string' key='metadata_id'>
  1972. 元数据 ID
  1973. </Property>
  1974. </Properties>
  1975. </Col>
  1976. <Col sticky>
  1977. <CodeGroup
  1978. title="Request"
  1979. tag="DELETE"
  1980. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  1981. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1982. >
  1983. ```bash {{ title: 'cURL' }}
  1984. ```
  1985. </CodeGroup>
  1986. </Col>
  1987. </Row>
  1988. <hr className='ml-0 mr-0' />
  1989. <Heading
  1990. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  1991. method='POST'
  1992. title='启用/禁用内置元数据'
  1993. name='#toggle_metadata'
  1994. />
  1995. <Row>
  1996. <Col>
  1997. ### Path
  1998. <Properties>
  1999. <Property name='dataset_id' type='string' key='dataset_id'>
  2000. 知识库 ID
  2001. </Property>
  2002. <Property name='action' type='string' key='action'>
  2003. disable/enable
  2004. </Property>
  2005. </Properties>
  2006. </Col>
  2007. <Col sticky>
  2008. <CodeGroup
  2009. title="Request"
  2010. tag="POST"
  2011. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  2012. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2013. >
  2014. ```bash {{ title: 'cURL' }}
  2015. ```
  2016. </CodeGroup>
  2017. </Col>
  2018. </Row>
  2019. <hr className='ml-0 mr-0' />
  2020. <Heading
  2021. url='/datasets/{dataset_id}/documents/metadata'
  2022. method='POST'
  2023. title='更新文档元数据'
  2024. name='#update_documents_metadata'
  2025. />
  2026. <Row>
  2027. <Col>
  2028. ### Path
  2029. <Properties>
  2030. <Property name='dataset_id' type='string' key='dataset_id'>
  2031. 知识库 ID
  2032. </Property>
  2033. </Properties>
  2034. ### Request Body
  2035. <Properties>
  2036. <Property name='operation_data' type='object list' key='segments'>
  2037. - <code>document_id</code> (string) 文档 ID
  2038. - <code>metadata_list</code> (list) 元数据列表
  2039. - <code>id</code> (string) 元数据 ID
  2040. - <code>type</code> (string) 元数据类型
  2041. - <code>name</code> (string) 元数据名称
  2042. </Property>
  2043. </Properties>
  2044. </Col>
  2045. <Col sticky>
  2046. <CodeGroup
  2047. title="Request"
  2048. tag="POST"
  2049. label="/datasets/{dataset_id}/documents/metadata"
  2050. 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"}]}]}'`}
  2051. >
  2052. ```bash {{ title: 'cURL' }}
  2053. ```
  2054. </CodeGroup>
  2055. </Col>
  2056. </Row>
  2057. <hr className='ml-0 mr-0' />
  2058. <Heading
  2059. url='/datasets/{dataset_id}/metadata'
  2060. method='GET'
  2061. title='查询知识库元数据列表'
  2062. name='#dataset_metadata_list'
  2063. />
  2064. <Row>
  2065. <Col>
  2066. ### Path
  2067. <Properties>
  2068. <Property name='dataset_id' type='string' key='dataset_id'>
  2069. 知识库 ID
  2070. </Property>
  2071. </Properties>
  2072. </Col>
  2073. <Col sticky>
  2074. <CodeGroup
  2075. title="Request"
  2076. tag="GET"
  2077. label="/datasets/{dataset_id}/metadata"
  2078. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  2079. >
  2080. ```bash {{ title: 'cURL' }}
  2081. ```
  2082. </CodeGroup>
  2083. <CodeGroup title="Response">
  2084. ```json {{ title: 'Response' }}
  2085. {
  2086. "doc_metadata": [
  2087. {
  2088. "id": "",
  2089. "name": "name",
  2090. "type": "string",
  2091. "use_count": 0,
  2092. },
  2093. ...
  2094. ],
  2095. "built_in_field_enabled": true
  2096. }
  2097. ```
  2098. </CodeGroup>
  2099. </Col>
  2100. </Row>
  2101. <hr className='ml-0 mr-0' />
  2102. <Heading
  2103. url='/workspaces/current/models/model-types/text-embedding'
  2104. method='GET'
  2105. title='获取嵌入模型列表'
  2106. name='#model_type_list'
  2107. />
  2108. <Row>
  2109. <Col>
  2110. ### Query
  2111. <Properties>
  2112. </Properties>
  2113. </Col>
  2114. <Col sticky>
  2115. <CodeGroup
  2116. title="Request"
  2117. tag="GET"
  2118. label="/datasets/{dataset_id}"
  2119. 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' `}
  2120. >
  2121. ```bash {{ title: 'cURL' }}
  2122. curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
  2123. --header 'Authorization: Bearer {api_key}' \
  2124. --header 'Content-Type: application/json' \
  2125. ```
  2126. </CodeGroup>
  2127. <CodeGroup title="Response">
  2128. ```json {{ title: 'Response' }}
  2129. {
  2130. "data": [
  2131. {
  2132. "provider": "zhipuai",
  2133. "label": {
  2134. "zh_Hans": "智谱 AI",
  2135. "en_US": "ZHIPU AI"
  2136. },
  2137. "icon_small": {
  2138. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
  2139. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
  2140. },
  2141. "icon_large": {
  2142. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
  2143. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
  2144. },
  2145. "status": "active",
  2146. "models": [
  2147. {
  2148. "model": "embedding-3",
  2149. "label": {
  2150. "zh_Hans": "embedding-3",
  2151. "en_US": "embedding-3"
  2152. },
  2153. "model_type": "text-embedding",
  2154. "features": null,
  2155. "fetch_from": "predefined-model",
  2156. "model_properties": {
  2157. "context_size": 8192
  2158. },
  2159. "deprecated": false,
  2160. "status": "active",
  2161. "load_balancing_enabled": false
  2162. },
  2163. {
  2164. "model": "embedding-2",
  2165. "label": {
  2166. "zh_Hans": "embedding-2",
  2167. "en_US": "embedding-2"
  2168. },
  2169. "model_type": "text-embedding",
  2170. "features": null,
  2171. "fetch_from": "predefined-model",
  2172. "model_properties": {
  2173. "context_size": 8192
  2174. },
  2175. "deprecated": false,
  2176. "status": "active",
  2177. "load_balancing_enabled": false
  2178. },
  2179. {
  2180. "model": "text_embedding",
  2181. "label": {
  2182. "zh_Hans": "text_embedding",
  2183. "en_US": "text_embedding"
  2184. },
  2185. "model_type": "text-embedding",
  2186. "features": null,
  2187. "fetch_from": "predefined-model",
  2188. "model_properties": {
  2189. "context_size": 512
  2190. },
  2191. "deprecated": false,
  2192. "status": "active",
  2193. "load_balancing_enabled": false
  2194. }
  2195. ]
  2196. }
  2197. ]
  2198. }
  2199. ```
  2200. </CodeGroup>
  2201. </Col>
  2202. </Row>
  2203. <hr className='ml-0 mr-0' />
  2204. <Row>
  2205. <Col>
  2206. ### 错误信息
  2207. <Properties>
  2208. <Property name='code' type='string' key='code'>
  2209. 返回的错误代码
  2210. </Property>
  2211. </Properties>
  2212. <Properties>
  2213. <Property name='status' type='number' key='status'>
  2214. 返回的错误状态
  2215. </Property>
  2216. </Properties>
  2217. <Properties>
  2218. <Property name='message' type='string' key='message'>
  2219. 返回的错误信息
  2220. </Property>
  2221. </Properties>
  2222. </Col>
  2223. <Col>
  2224. <CodeGroup title="Example">
  2225. ```json {{ title: 'Response' }}
  2226. {
  2227. "code": "no_file_uploaded",
  2228. "message": "Please upload your file.",
  2229. "status": 400
  2230. }
  2231. ```
  2232. </CodeGroup>
  2233. </Col>
  2234. </Row>
  2235. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2236. <thead style={{ background: '#f9fafc' }}>
  2237. <tr>
  2238. <th className="p-2 border border-slate-300">code</th>
  2239. <th className="p-2 border border-slate-300">status</th>
  2240. <th className="p-2 border border-slate-300">message</th>
  2241. </tr>
  2242. </thead>
  2243. <tbody>
  2244. <tr>
  2245. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2246. <td className="p-2 border border-slate-300">400</td>
  2247. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2248. </tr>
  2249. <tr>
  2250. <td className="p-2 border border-slate-300">too_many_files</td>
  2251. <td className="p-2 border border-slate-300">400</td>
  2252. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2253. </tr>
  2254. <tr>
  2255. <td className="p-2 border border-slate-300">file_too_large</td>
  2256. <td className="p-2 border border-slate-300">413</td>
  2257. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2258. </tr>
  2259. <tr>
  2260. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2261. <td className="p-2 border border-slate-300">415</td>
  2262. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2263. </tr>
  2264. <tr>
  2265. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2266. <td className="p-2 border border-slate-300">400</td>
  2267. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2268. </tr>
  2269. <tr>
  2270. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2271. <td className="p-2 border border-slate-300">400</td>
  2272. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2273. </tr>
  2274. <tr>
  2275. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2276. <td className="p-2 border border-slate-300">403</td>
  2277. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2278. </tr>
  2279. <tr>
  2280. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2281. <td className="p-2 border border-slate-300">409</td>
  2282. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2283. </tr>
  2284. <tr>
  2285. <td className="p-2 border border-slate-300">invalid_action</td>
  2286. <td className="p-2 border border-slate-300">400</td>
  2287. <td className="p-2 border border-slate-300">Invalid action.</td>
  2288. </tr>
  2289. <tr>
  2290. <td className="p-2 border border-slate-300">document_already_finished</td>
  2291. <td className="p-2 border border-slate-300">400</td>
  2292. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2293. </tr>
  2294. <tr>
  2295. <td className="p-2 border border-slate-300">document_indexing</td>
  2296. <td className="p-2 border border-slate-300">400</td>
  2297. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2298. </tr>
  2299. <tr>
  2300. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2301. <td className="p-2 border border-slate-300">400</td>
  2302. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2303. </tr>
  2304. </tbody>
  2305. </table>
  2306. <div className="pb-4" />