您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

template.zh.mdx 79KB

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