Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987
  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. 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. Embedding 模型进行嵌入,构建为向量数据库索引
  47. - <code>economy</code> 经济:使用 keyword table index 的倒排索引进行构建
  48. </Property>
  49. <Property name='doc_form' type='string' key='doc_form'>
  50. 索引内容的形式
  51. - <code>text_model</code> text 文档直接 embedding,经济模式默认为该模式
  52. - <code>hierarchical_model</code> parent-child 模式
  53. - <code>qa_model</code> Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding
  54. </Property>
  55. <Property name='doc_language' type='string' key='doc_language'>
  56. 在 Q&A 模式下,指定文档的语言,例如:<code>English</code>、<code>Chinese</code>
  57. </Property>
  58. <Property name='process_rule' type='object' key='process_rule'>
  59. 处理规则
  60. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  61. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  62. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  63. - <code>id</code> (string) 预处理规则的唯一标识符
  64. - 枚举:
  65. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  66. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  67. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  68. - <code>segmentation</code> (object) 分段规则
  69. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 <code>\n</code>
  70. - <code>max_tokens</code> 最大长度(token)默认为 1000
  71. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  72. - <code>subchunk_segmentation</code> (object) 子分段规则
  73. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  74. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  75. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  76. </Property>
  77. <PropertyInstruction>当知识库未设置任何参数的时候,首次上传需要提供以下参数,未提供则使用默认选项:</PropertyInstruction>
  78. <Property name='retrieval_model' type='object' key='retrieval_model'>
  79. 检索模式
  80. - <code>search_method</code> (string) 检索方法
  81. - <code>hybrid_search</code> 混合检索
  82. - <code>semantic_search</code> 语义检索
  83. - <code>full_text_search</code> 全文检索
  84. - <code>reranking_enable</code> (bool) 是否开启rerank
  85. - <code>reranking_mode</code> (String) 混合检索
  86. - <code>weighted_score</code> 权重设置
  87. - <code>reranking_model</code> Rerank 模型
  88. - <code>reranking_model</code> (object) Rerank 模型配置
  89. - <code>reranking_provider_name</code> (string) Rerank 模型的提供商
  90. - <code>reranking_model_name</code> (string) Rerank 模型的名称
  91. - <code>top_k</code> (int) 召回条数
  92. - <code>score_threshold_enabled</code> (bool)是否开启召回分数限制
  93. - <code>score_threshold</code> (float) 召回分数限制
  94. </Property>
  95. <Property name='embedding_model' type='string' key='embedding_model'>
  96. Embedding 模型名称
  97. </Property>
  98. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  99. Embedding 模型供应商
  100. </Property>
  101. </Properties>
  102. </Col>
  103. <Col sticky>
  104. <CodeGroup
  105. title="Request"
  106. tag="POST"
  107. label="/datasets/{dataset_id}/document/create-by-text"
  108. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "text","text": "text","indexing_technique": "high_quality","process_rule": {"mode": "automatic"}}'`}
  109. >
  110. ```bash {{ title: 'cURL' }}
  111. curl --location --request --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-text' \
  112. --header 'Authorization: Bearer {api_key}' \
  113. --header 'Content-Type: application/json' \
  114. --data-raw '{
  115. "name": "text",
  116. "text": "text",
  117. "indexing_technique": "high_quality",
  118. "process_rule": {
  119. "mode": "automatic"
  120. }
  121. }'
  122. ```
  123. </CodeGroup>
  124. <CodeGroup title="Response">
  125. ```json {{ title: 'Response' }}
  126. {
  127. "document": {
  128. "id": "",
  129. "position": 1,
  130. "data_source_type": "upload_file",
  131. "data_source_info": {
  132. "upload_file_id": ""
  133. },
  134. "dataset_process_rule_id": "",
  135. "name": "text.txt",
  136. "created_from": "api",
  137. "created_by": "",
  138. "created_at": 1695690280,
  139. "tokens": 0,
  140. "indexing_status": "waiting",
  141. "error": null,
  142. "enabled": true,
  143. "disabled_at": null,
  144. "disabled_by": null,
  145. "archived": false,
  146. "display_status": "queuing",
  147. "word_count": 0,
  148. "hit_count": 0,
  149. "doc_form": "text_model"
  150. },
  151. "batch": ""
  152. }
  153. ```
  154. </CodeGroup>
  155. </Col>
  156. </Row>
  157. <hr className='ml-0 mr-0' />
  158. <Heading
  159. url='/datasets/{dataset_id}/document/create-by-file'
  160. method='POST'
  161. title='通过文件创建文档 '
  162. name='#create-by-file'
  163. />
  164. <Row>
  165. <Col>
  166. 此接口基于已存在知识库,在此知识库的基础上通过文件创建新的文档
  167. ### Path
  168. <Properties>
  169. <Property name='dataset_id' type='string' key='dataset_id'>
  170. 知识库 ID
  171. </Property>
  172. </Properties>
  173. ### Request Body
  174. <Properties>
  175. <Property name='data' type='multipart/form-data json string' key='data'>
  176. - <code>original_document_id</code> 源文档 ID(选填)
  177. - 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制
  178. - 源文档不可为归档的文档
  179. - 当传入 <code>original_document_id</code> 时,代表文档进行更新操作,<code>process_rule</code> 为可填项目,不填默认使用源文档的分段方式
  180. - 未传入 <code>original_document_id</code> 时,代表文档进行新增操作,<code>process_rule</code> 为必填
  181. - <code>indexing_technique</code> 索引方式
  182. - <code>high_quality</code> 高质量:使用 embedding 模型进行嵌入,构建为向量数据库索引
  183. - <code>economy</code> 经济:使用 keyword table index 的倒排索引进行构建
  184. - <code>doc_form</code> 索引内容的形式
  185. - <code>text_model</code> text 文档直接 embedding,经济模式默认为该模式
  186. - <code>hierarchical_model</code> parent-child 模式
  187. - <code>qa_model</code> Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding
  188. - <code>doc_language</code> 在 Q&A 模式下,指定文档的语言,例如:<code>English</code>、<code>Chinese</code>
  189. - <code>process_rule</code> 处理规则
  190. - <code>mode</code> (string) 清洗、分段模式,automatic 自动 / custom 自定义 / hierarchical 父子
  191. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  192. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  193. - <code>id</code> (string) 预处理规则的唯一标识符
  194. - 枚举:
  195. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  196. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  197. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  198. - <code>segmentation</code> (object) 分段规则
  199. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  200. - <code>max_tokens</code> 最大长度(token)默认为 1000
  201. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  202. - <code>subchunk_segmentation</code> (object) 子分段规则
  203. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  204. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  205. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  206. </Property>
  207. <Property name='file' type='multipart/form-data' key='file'>
  208. 需要上传的文件。
  209. </Property>
  210. <PropertyInstruction>当知识库未设置任何参数的时候,首次上传需要提供以下参数,未提供则使用默认选项:</PropertyInstruction>
  211. <Property name='retrieval_model' type='object' key='retrieval_model'>
  212. 检索模式
  213. - <code>search_method</code> (string) 检索方法
  214. - <code>hybrid_search</code> 混合检索
  215. - <code>semantic_search</code> 语义检索
  216. - <code>full_text_search</code> 全文检索
  217. - <code>reranking_enable</code> (bool) 是否开启 rerank
  218. - <code>reranking_model</code> (object) Rerank 模型配置
  219. - <code>reranking_provider_name</code> (string) Rerank 模型的提供商
  220. - <code>reranking_model_name</code> (string) Rerank 模型的名称
  221. - <code>top_k</code> (int) 召回条数
  222. - <code>score_threshold_enabled</code> (bool) 是否开启召回分数限制
  223. - <code>score_threshold</code> (float) 召回分数限制
  224. </Property>
  225. <Property name='embedding_model' type='string' key='embedding_model'>
  226. Embedding 模型名称
  227. </Property>
  228. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  229. Embedding 模型供应商
  230. </Property>
  231. </Properties>
  232. </Col>
  233. <Col sticky>
  234. <CodeGroup
  235. title="Request"
  236. tag="POST"
  237. label="/datasets/{dataset_id}/document/create-by-file"
  238. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
  239. >
  240. ```bash {{ title: 'cURL' }}
  241. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create-by-file' \
  242. --header 'Authorization: Bearer {api_key}' \
  243. --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
  244. --form 'file=@"/path/to/file"'
  245. ```
  246. </CodeGroup>
  247. <CodeGroup title="Response">
  248. ```json {{ title: 'Response' }}
  249. {
  250. "document": {
  251. "id": "",
  252. "position": 1,
  253. "data_source_type": "upload_file",
  254. "data_source_info": {
  255. "upload_file_id": ""
  256. },
  257. "dataset_process_rule_id": "",
  258. "name": "Dify.txt",
  259. "created_from": "api",
  260. "created_by": "",
  261. "created_at": 1695308667,
  262. "tokens": 0,
  263. "indexing_status": "waiting",
  264. "error": null,
  265. "enabled": true,
  266. "disabled_at": null,
  267. "disabled_by": null,
  268. "archived": false,
  269. "display_status": "queuing",
  270. "word_count": 0,
  271. "hit_count": 0,
  272. "doc_form": "text_model"
  273. },
  274. "batch": ""
  275. }
  276. ```
  277. </CodeGroup>
  278. </Col>
  279. </Row>
  280. <hr className='ml-0 mr-0' />
  281. <Heading
  282. url='/datasets'
  283. method='POST'
  284. title='创建空知识库'
  285. name='#create_empty_dataset'
  286. />
  287. <Row>
  288. <Col>
  289. ### Request Body
  290. <Properties>
  291. <Property name='name' type='string' key='name'>
  292. 知识库名称(必填)
  293. </Property>
  294. <Property name='description' type='string' key='description'>
  295. 知识库描述(选填)
  296. </Property>
  297. <Property name='indexing_technique' type='string' key='indexing_technique'>
  298. 索引模式(选填,建议填写)
  299. - <code>high_quality</code> 高质量
  300. - <code>economy</code> 经济
  301. </Property>
  302. <Property name='permission' type='string' key='permission'>
  303. 权限(选填,默认 only_me)
  304. - <code>only_me</code> 仅自己
  305. - <code>all_team_members</code> 所有团队成员
  306. - <code>partial_members</code> 部分团队成员
  307. </Property>
  308. <Property name='provider' type='string' key='provider'>
  309. Provider(选填,默认 vendor)
  310. - <code>vendor</code> 上传文件
  311. - <code>external</code> 外部知识库
  312. </Property>
  313. <Property name='external_knowledge_api_id' type='str' key='external_knowledge_api_id'>
  314. 外部知识库 API_ID(选填)
  315. </Property>
  316. <Property name='external_knowledge_id' type='str' key='external_knowledge_id'>
  317. 外部知识库 ID(选填)
  318. </Property>
  319. <Property name='embedding_model' type='str' key='embedding_model'>
  320. Embedding 模型名称
  321. </Property>
  322. <Property name='embedding_model_provider' type='str' key='embedding_model_provider'>
  323. Embedding 模型供应商
  324. </Property>
  325. <Property name='retrieval_model' type='object' key='retrieval_model'>
  326. 检索模式
  327. - <code>search_method</code> (string) 检索方法
  328. - <code>hybrid_search</code> 混合检索
  329. - <code>semantic_search</code> 语义检索
  330. - <code>full_text_search</code> 全文检索
  331. - <code>reranking_enable</code> (bool) 是否开启 rerank
  332. - <code>reranking_model</code> (object) Rerank 模型配置
  333. - <code>reranking_provider_name</code> (string) Rerank 模型的提供商
  334. - <code>reranking_model_name</code> (string) Rerank 模型的名称
  335. - <code>top_k</code> (int) 召回条数
  336. - <code>score_threshold_enabled</code> (bool) 是否开启召回分数限制
  337. - <code>score_threshold</code> (float) 召回分数限制
  338. </Property>
  339. </Properties>
  340. </Col>
  341. <Col sticky>
  342. <CodeGroup
  343. title="Request"
  344. tag="POST"
  345. label="/datasets"
  346. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name", "permission": "only_me"}'`}
  347. >
  348. ```bash {{ title: 'cURL' }}
  349. curl --location --request POST '${props.apiBaseUrl}/datasets' \
  350. --header 'Authorization: Bearer {api_key}' \
  351. --header 'Content-Type: application/json' \
  352. --data-raw '{
  353. "name": "name",
  354. "permission": "only_me"
  355. }'
  356. ```
  357. </CodeGroup>
  358. <CodeGroup title="Response">
  359. ```json {{ title: 'Response' }}
  360. {
  361. "id": "",
  362. "name": "name",
  363. "description": null,
  364. "provider": "vendor",
  365. "permission": "only_me",
  366. "data_source_type": null,
  367. "indexing_technique": null,
  368. "app_count": 0,
  369. "document_count": 0,
  370. "word_count": 0,
  371. "created_by": "",
  372. "created_at": 1695636173,
  373. "updated_by": "",
  374. "updated_at": 1695636173,
  375. "embedding_model": null,
  376. "embedding_model_provider": null,
  377. "embedding_available": null
  378. }
  379. ```
  380. </CodeGroup>
  381. </Col>
  382. </Row>
  383. <hr className='ml-0 mr-0' />
  384. <Heading
  385. url='/datasets'
  386. method='GET'
  387. title='知识库列表'
  388. name='#dataset_list'
  389. />
  390. <Row>
  391. <Col>
  392. ### Query
  393. <Properties>
  394. <Property name='keyword' type='string' key='keyword'>
  395. 搜索关键词,可选
  396. </Property>
  397. <Property name='tag_ids' type='array[string]' key='tag_ids'>
  398. 标签 ID 列表,可选
  399. </Property>
  400. <Property name='page' type='integer' key='page'>
  401. 页码,可选,默认为 1
  402. </Property>
  403. <Property name='limit' type='string' key='limit'>
  404. 返回条数,可选,默认 20,范围 1-100
  405. </Property>
  406. <Property name='include_all' type='boolean' key='include_all'>
  407. 是否包含所有数据集(仅对所有者生效),可选,默认为 false
  408. </Property>
  409. </Properties>
  410. </Col>
  411. <Col sticky>
  412. <CodeGroup
  413. title="Request"
  414. tag="GET"
  415. label="/datasets"
  416. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \\\n--header 'Authorization: Bearer {api_key}'`}
  417. >
  418. ```bash {{ title: 'cURL' }}
  419. curl --location --request GET '${props.apiBaseUrl}/datasets?page=1&limit=20' \
  420. --header 'Authorization: Bearer {api_key}'
  421. ```
  422. </CodeGroup>
  423. <CodeGroup title="Response">
  424. ```json {{ title: 'Response' }}
  425. {
  426. "data": [
  427. {
  428. "id": "",
  429. "name": "知识库名称",
  430. "description": "描述信息",
  431. "permission": "only_me",
  432. "data_source_type": "upload_file",
  433. "indexing_technique": "",
  434. "app_count": 2,
  435. "document_count": 10,
  436. "word_count": 1200,
  437. "created_by": "",
  438. "created_at": "",
  439. "updated_by": "",
  440. "updated_at": ""
  441. },
  442. ...
  443. ],
  444. "has_more": true,
  445. "limit": 20,
  446. "total": 50,
  447. "page": 1
  448. }
  449. ```
  450. </CodeGroup>
  451. </Col>
  452. </Row>
  453. <hr className='ml-0 mr-0' />
  454. <Heading
  455. url='/datasets/{dataset_id}'
  456. method='GET'
  457. title='查看知识库详情'
  458. name='#view_dataset'
  459. />
  460. <Row>
  461. <Col>
  462. ### Path
  463. <Properties>
  464. <Property name='dataset_id' type='string' key='dataset_id'>
  465. 知识库 ID
  466. </Property>
  467. </Properties>
  468. </Col>
  469. <Col sticky>
  470. <CodeGroup
  471. title="Request"
  472. tag="GET"
  473. label="/datasets/{dataset_id}"
  474. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  475. >
  476. ```bash {{ title: 'cURL' }}
  477. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}' \
  478. --header 'Authorization: Bearer {api_key}'
  479. ```
  480. </CodeGroup>
  481. <CodeGroup title="Response">
  482. ```json {{ title: 'Response' }}
  483. {
  484. "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
  485. "name": "Test Knowledge Base",
  486. "description": "",
  487. "provider": "vendor",
  488. "permission": "only_me",
  489. "data_source_type": null,
  490. "indexing_technique": null,
  491. "app_count": 0,
  492. "document_count": 0,
  493. "word_count": 0,
  494. "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  495. "created_at": 1735620612,
  496. "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  497. "updated_at": 1735620612,
  498. "embedding_model": null,
  499. "embedding_model_provider": null,
  500. "embedding_available": true,
  501. "retrieval_model_dict": {
  502. "search_method": "semantic_search",
  503. "reranking_enable": false,
  504. "reranking_mode": null,
  505. "reranking_model": {
  506. "reranking_provider_name": "",
  507. "reranking_model_name": ""
  508. },
  509. "weights": null,
  510. "top_k": 2,
  511. "score_threshold_enabled": false,
  512. "score_threshold": null
  513. },
  514. "tags": [],
  515. "doc_form": null,
  516. "external_knowledge_info": {
  517. "external_knowledge_id": null,
  518. "external_knowledge_api_id": null,
  519. "external_knowledge_api_name": null,
  520. "external_knowledge_api_endpoint": null
  521. },
  522. "external_retrieval_model": {
  523. "top_k": 2,
  524. "score_threshold": 0.0,
  525. "score_threshold_enabled": null
  526. }
  527. }
  528. ```
  529. </CodeGroup>
  530. </Col>
  531. </Row>
  532. <hr className='ml-0 mr-0' />
  533. <Heading
  534. url='/datasets/{dataset_id}'
  535. method='PATCH'
  536. title='修改知识库详情'
  537. name='#update_dataset'
  538. />
  539. <Row>
  540. <Col>
  541. ### Path
  542. <Properties>
  543. <Property name='dataset_id' type='string' key='dataset_id'>
  544. 知识库 ID
  545. </Property>
  546. </Properties>
  547. ### Request Body
  548. <Properties>
  549. <Property name='indexing_technique' type='string' key='indexing_technique'>
  550. 索引模式(选填,建议填写)
  551. - <code>high_quality</code> 高质量
  552. - <code>economy</code> 经济
  553. </Property>
  554. <Property name='permission' type='string' key='permission'>
  555. 权限(选填,默认 only_me)
  556. - <code>only_me</code> 仅自己
  557. - <code>all_team_members</code> 所有团队成员
  558. - <code>partial_members</code> 部分团队成员
  559. </Property>
  560. <Property name='embedding_model_provider' type='string' key='embedding_model_provider'>
  561. 嵌入模型提供商(选填), 必须先在系统内设定好接入的模型,对应的是provider字段
  562. </Property>
  563. <Property name='embedding_model' type='string' key='embedding_model'>
  564. 嵌入模型(选填)
  565. </Property>
  566. <Property name='retrieval_model' type='object' key='retrieval_model'>
  567. 检索参数(选填,如不填,按照默认方式召回)
  568. - <code>search_method</code> (text) 检索方法:以下四个关键字之一,必填
  569. - <code>keyword_search</code> 关键字检索
  570. - <code>semantic_search</code> 语义检索
  571. - <code>full_text_search</code> 全文检索
  572. - <code>hybrid_search</code> 混合检索
  573. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
  574. - <code>reranking_mode</code> (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
  575. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  576. - <code>reranking_model_name</code> (string) Rerank 模型名称
  577. - <code>weights</code> (float) 混合检索模式下语意检索的权重设置
  578. - <code>top_k</code> (integer) 返回结果数量,非必填
  579. - <code>score_threshold_enabled</code> (bool) 是否开启 score 阈值
  580. - <code>score_threshold</code> (float) Score 阈值
  581. </Property>
  582. <Property name='partial_member_list' type='array' key='partial_member_list'>
  583. 部分团队成员 ID 列表(选填)
  584. </Property>
  585. </Properties>
  586. </Col>
  587. <Col sticky>
  588. <CodeGroup
  589. title="Request"
  590. tag="PATCH"
  591. label="/datasets/{dataset_id}"
  592. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{
  593. "name": "Test Knowledge Base",
  594. "indexing_technique": "high_quality",
  595. "permission": "only_me",
  596. "embedding_model_provider": "zhipuai",
  597. "embedding_model": "embedding-3",
  598. "retrieval_model": {
  599. "search_method": "keyword_search",
  600. "reranking_enable": false,
  601. "reranking_mode": null,
  602. "reranking_model": {
  603. "reranking_provider_name": "",
  604. "reranking_model_name": ""
  605. },
  606. "weights": null,
  607. "top_k": 1,
  608. "score_threshold_enabled": false,
  609. "score_threshold": null
  610. },
  611. "partial_member_list": []
  612. }'
  613. `}
  614. >
  615. ```bash {{ title: 'cURL' }}
  616. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}' \
  617. --header 'Authorization: Bearer {api_key}' \
  618. --header 'Content-Type: application/json' \
  619. --data-raw '{
  620. "name": "Test Knowledge Base",
  621. "indexing_technique": "high_quality",
  622. "permission": "only_me",
  623. "embedding_model_provider": "zhipuai",
  624. "embedding_model": "embedding-3",
  625. "retrieval_model": {
  626. "search_method": "keyword_search",
  627. "reranking_enable": false,
  628. "reranking_mode": null,
  629. "reranking_model": {
  630. "reranking_provider_name": "",
  631. "reranking_model_name": ""
  632. },
  633. "weights": null,
  634. "top_k": 1,
  635. "score_threshold_enabled": false,
  636. "score_threshold": null
  637. },
  638. "partial_member_list": []
  639. }'
  640. ```
  641. </CodeGroup>
  642. <CodeGroup title="Response">
  643. ```json {{ title: 'Response' }}
  644. {
  645. "id": "eaedb485-95ac-4ffd-ab1e-18da6d676a2f",
  646. "name": "Test Knowledge Base",
  647. "description": "",
  648. "provider": "vendor",
  649. "permission": "only_me",
  650. "data_source_type": null,
  651. "indexing_technique": "high_quality",
  652. "app_count": 0,
  653. "document_count": 0,
  654. "word_count": 0,
  655. "created_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  656. "created_at": 1735620612,
  657. "updated_by": "e99a1635-f725-4951-a99a-1daaaa76cfc6",
  658. "updated_at": 1735622679,
  659. "embedding_model": "embedding-3",
  660. "embedding_model_provider": "zhipuai",
  661. "embedding_available": null,
  662. "retrieval_model_dict": {
  663. "search_method": "semantic_search",
  664. "reranking_enable": false,
  665. "reranking_mode": null,
  666. "reranking_model": {
  667. "reranking_provider_name": "",
  668. "reranking_model_name": ""
  669. },
  670. "weights": null,
  671. "top_k": 2,
  672. "score_threshold_enabled": false,
  673. "score_threshold": null
  674. },
  675. "tags": [],
  676. "doc_form": null,
  677. "external_knowledge_info": {
  678. "external_knowledge_id": null,
  679. "external_knowledge_api_id": null,
  680. "external_knowledge_api_name": null,
  681. "external_knowledge_api_endpoint": null
  682. },
  683. "external_retrieval_model": {
  684. "top_k": 2,
  685. "score_threshold": 0.0,
  686. "score_threshold_enabled": null
  687. },
  688. "partial_member_list": []
  689. }
  690. ```
  691. </CodeGroup>
  692. </Col>
  693. </Row>
  694. <hr className='ml-0 mr-0' />
  695. <Heading
  696. url='/datasets/{dataset_id}'
  697. method='DELETE'
  698. title='删除知识库'
  699. name='#delete_dataset'
  700. />
  701. <Row>
  702. <Col>
  703. ### Path
  704. <Properties>
  705. <Property name='dataset_id' type='string' key='dataset_id'>
  706. 知识库 ID
  707. </Property>
  708. </Properties>
  709. </Col>
  710. <Col sticky>
  711. <CodeGroup
  712. title="Request"
  713. tag="DELETE"
  714. label="/datasets/{dataset_id}"
  715. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  716. >
  717. ```bash {{ title: 'cURL' }}
  718. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}' \
  719. --header 'Authorization: Bearer {api_key}'
  720. ```
  721. </CodeGroup>
  722. <CodeGroup title="Response">
  723. ```text {{ title: 'Response' }}
  724. 204 No Content
  725. ```
  726. </CodeGroup>
  727. </Col>
  728. </Row>
  729. <hr className='ml-0 mr-0' />
  730. <Heading
  731. url='/datasets/{dataset_id}/documents/{document_id}/update-by-text'
  732. method='POST'
  733. title='通过文本更新文档'
  734. name='#update-by-text'
  735. />
  736. <Row>
  737. <Col>
  738. 此接口基于已存在知识库,在此知识库的基础上通过文本更新文档
  739. ### Path
  740. <Properties>
  741. <Property name='dataset_id' type='string' key='dataset_id'>
  742. 知识库 ID
  743. </Property>
  744. <Property name='document_id' type='string' key='document_id'>
  745. 文档 ID
  746. </Property>
  747. </Properties>
  748. ### Request Body
  749. <Properties>
  750. <Property name='name' type='string' key='name'>
  751. 文档名称(选填)
  752. </Property>
  753. <Property name='text' type='string' key='text'>
  754. 文档内容(选填)
  755. </Property>
  756. <Property name='process_rule' type='object' key='process_rule'>
  757. 处理规则(选填)
  758. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  759. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  760. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  761. - <code>id</code> (string) 预处理规则的唯一标识符
  762. - 枚举:
  763. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  764. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  765. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  766. - <code>segmentation</code> (object) 分段规则
  767. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  768. - <code>max_tokens</code> 最大长度(token)默认为 1000
  769. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  770. - <code>subchunk_segmentation</code> (object) 子分段规则
  771. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  772. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  773. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  774. </Property>
  775. </Properties>
  776. </Col>
  777. <Col sticky>
  778. <CodeGroup
  779. title="Request"
  780. tag="POST"
  781. label="/datasets/{dataset_id}/documents/{document_id}/update-by-text"
  782. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "name","text": "text"}'`}
  783. >
  784. ```bash {{ title: 'cURL' }}
  785. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-text' \
  786. --header 'Authorization: Bearer {api_key}' \
  787. --header 'Content-Type: application/json' \
  788. --data-raw '{
  789. "name": "name",
  790. "text": "text"
  791. }'
  792. ```
  793. </CodeGroup>
  794. <CodeGroup title="Response">
  795. ```json {{ title: 'Response' }}
  796. {
  797. "document": {
  798. "id": "",
  799. "position": 1,
  800. "data_source_type": "upload_file",
  801. "data_source_info": {
  802. "upload_file_id": ""
  803. },
  804. "dataset_process_rule_id": "",
  805. "name": "name.txt",
  806. "created_from": "api",
  807. "created_by": "",
  808. "created_at": 1695308667,
  809. "tokens": 0,
  810. "indexing_status": "waiting",
  811. "error": null,
  812. "enabled": true,
  813. "disabled_at": null,
  814. "disabled_by": null,
  815. "archived": false,
  816. "display_status": "queuing",
  817. "word_count": 0,
  818. "hit_count": 0,
  819. "doc_form": "text_model"
  820. },
  821. "batch": ""
  822. }
  823. ```
  824. </CodeGroup>
  825. </Col>
  826. </Row>
  827. <hr className='ml-0 mr-0' />
  828. <Heading
  829. url='/datasets/{dataset_id}/documents/{document_id}/update-by-file'
  830. method='POST'
  831. title='通过文件更新文档'
  832. name='#update-by-file'
  833. />
  834. <Row>
  835. <Col>
  836. 此接口基于已存在知识库,在此知识库的基础上通过文件更新文档的操作。
  837. ### Path
  838. <Properties>
  839. <Property name='dataset_id' type='string' key='dataset_id'>
  840. 知识库 ID
  841. </Property>
  842. <Property name='document_id' type='string' key='document_id'>
  843. 文档 ID
  844. </Property>
  845. </Properties>
  846. ### Request Body
  847. <Properties>
  848. <Property name='name' type='string' key='name'>
  849. 文档名称(选填)
  850. </Property>
  851. <Property name='file' type='multipart/form-data' key='file'>
  852. 需要上传的文件
  853. </Property>
  854. <Property name='process_rule' type='object' key='process_rule'>
  855. 处理规则(选填)
  856. - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 / hierarchical 父子
  857. - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空)
  858. - <code>pre_processing_rules</code> (array[object]) 预处理规则
  859. - <code>id</code> (string) 预处理规则的唯一标识符
  860. - 枚举:
  861. - <code>remove_extra_spaces</code> 替换连续空格、换行符、制表符
  862. - <code>remove_urls_emails</code> 删除 URL、电子邮件地址
  863. - <code>enabled</code> (bool) 是否选中该规则,不传入文档 ID 时代表默认值
  864. - <code>segmentation</code> (object) 分段规则
  865. - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n
  866. - <code>max_tokens</code> 最大长度(token)默认为 1000
  867. - <code>parent_mode</code> 父分段的召回模式 <code>full-doc</code> 全文召回 / <code>paragraph</code> 段落召回
  868. - <code>subchunk_segmentation</code> (object) 子分段规则
  869. - <code>separator</code> 分段标识符,目前仅允许设置一个分隔符。默认为 <code>***</code>
  870. - <code>max_tokens</code> 最大长度 (token) 需要校验小于父级的长度
  871. - <code>chunk_overlap</code> 分段重叠指的是在对数据进行分段时,段与段之间存在一定的重叠部分(选填)
  872. </Property>
  873. </Properties>
  874. </Col>
  875. <Col sticky>
  876. <CodeGroup
  877. title="Request"
  878. tag="POST"
  879. label="/datasets/{dataset_id}/documents/{document_id}/update-by-file"
  880. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`}
  881. >
  882. ```bash {{ title: 'cURL' }}
  883. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/update-by-file' \
  884. --header 'Authorization: Bearer {api_key}' \
  885. --form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
  886. --form 'file=@"/path/to/file"'
  887. ```
  888. </CodeGroup>
  889. <CodeGroup title="Response">
  890. ```json {{ title: 'Response' }}
  891. {
  892. "document": {
  893. "id": "",
  894. "position": 1,
  895. "data_source_type": "upload_file",
  896. "data_source_info": {
  897. "upload_file_id": ""
  898. },
  899. "dataset_process_rule_id": "",
  900. "name": "Dify.txt",
  901. "created_from": "api",
  902. "created_by": "",
  903. "created_at": 1695308667,
  904. "tokens": 0,
  905. "indexing_status": "waiting",
  906. "error": null,
  907. "enabled": true,
  908. "disabled_at": null,
  909. "disabled_by": null,
  910. "archived": false,
  911. "display_status": "queuing",
  912. "word_count": 0,
  913. "hit_count": 0,
  914. "doc_form": "text_model"
  915. },
  916. "batch": "20230921150427533684"
  917. }
  918. ```
  919. </CodeGroup>
  920. </Col>
  921. </Row>
  922. <hr className='ml-0 mr-0' />
  923. <Heading
  924. url='/datasets/{dataset_id}/documents/{batch}/indexing-status'
  925. method='GET'
  926. title='获取文档嵌入状态(进度)'
  927. name='#indexing_status'
  928. />
  929. <Row>
  930. <Col>
  931. ### Path
  932. <Properties>
  933. <Property name='dataset_id' type='string' key='dataset_id'>
  934. 知识库 ID
  935. </Property>
  936. <Property name='batch' type='string' key='batch'>
  937. 上传文档的批次号
  938. </Property>
  939. </Properties>
  940. </Col>
  941. <Col sticky>
  942. <CodeGroup
  943. title="Request"
  944. tag="GET"
  945. label="/datasets/{dataset_id}/documents/{batch}/indexing-status"
  946. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \\\n--header 'Authorization: Bearer {api_key}'`}
  947. >
  948. ```bash {{ title: 'cURL' }}
  949. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{batch}/indexing-status' \
  950. --header 'Authorization: Bearer {api_key}' \
  951. ```
  952. </CodeGroup>
  953. <CodeGroup title="Response">
  954. ```json {{ title: 'Response' }}
  955. {
  956. "data":[{
  957. "id": "",
  958. "indexing_status": "indexing",
  959. "processing_started_at": 1681623462.0,
  960. "parsing_completed_at": 1681623462.0,
  961. "cleaning_completed_at": 1681623462.0,
  962. "splitting_completed_at": 1681623462.0,
  963. "completed_at": null,
  964. "paused_at": null,
  965. "error": null,
  966. "stopped_at": null,
  967. "completed_segments": 24,
  968. "total_segments": 100
  969. }]
  970. }
  971. ```
  972. </CodeGroup>
  973. </Col>
  974. </Row>
  975. <hr className='ml-0 mr-0' />
  976. <Heading
  977. url='/datasets/{dataset_id}/documents/{document_id}'
  978. method='DELETE'
  979. title='删除文档'
  980. name='#delete_document'
  981. />
  982. <Row>
  983. <Col>
  984. ### Path
  985. <Properties>
  986. <Property name='dataset_id' type='string' key='dataset_id'>
  987. 知识库 ID
  988. </Property>
  989. <Property name='document_id' type='string' key='document_id'>
  990. 文档 ID
  991. </Property>
  992. </Properties>
  993. </Col>
  994. <Col sticky>
  995. <CodeGroup
  996. title="Request"
  997. tag="DELETE"
  998. label="/datasets/{dataset_id}/documents/{document_id}"
  999. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1000. >
  1001. ```bash {{ title: 'cURL' }}
  1002. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  1003. --header 'Authorization: Bearer {api_key}' \
  1004. ```
  1005. </CodeGroup>
  1006. <CodeGroup title="Response">
  1007. ```text {{ title: 'Response' }}
  1008. 204 No Content
  1009. ```
  1010. </CodeGroup>
  1011. </Col>
  1012. </Row>
  1013. <hr className='ml-0 mr-0' />
  1014. <Heading
  1015. url='/datasets/{dataset_id}/documents'
  1016. method='GET'
  1017. title='知识库文档列表'
  1018. name='#dataset_document_list'
  1019. />
  1020. <Row>
  1021. <Col>
  1022. ### Path
  1023. <Properties>
  1024. <Property name='dataset_id' type='string' key='dataset_id'>
  1025. 知识库 ID
  1026. </Property>
  1027. </Properties>
  1028. ### Query
  1029. <Properties>
  1030. <Property name='keyword' type='string' key='keyword'>
  1031. 搜索关键词,可选,目前仅搜索文档名称
  1032. </Property>
  1033. <Property name='page' type='string' key='page'>
  1034. 页码,可选
  1035. </Property>
  1036. <Property name='limit' type='string' key='limit'>
  1037. 返回条数,可选,默认 20,范围 1-100
  1038. </Property>
  1039. </Properties>
  1040. </Col>
  1041. <Col sticky>
  1042. <CodeGroup
  1043. title="Request"
  1044. tag="GET"
  1045. label="/datasets/{dataset_id}/documents"
  1046. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \\\n--header 'Authorization: Bearer {api_key}'`}
  1047. >
  1048. ```bash {{ title: 'cURL' }}
  1049. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents' \
  1050. --header 'Authorization: Bearer {api_key}' \
  1051. ```
  1052. </CodeGroup>
  1053. <CodeGroup title="Response">
  1054. ```json {{ title: 'Response' }}
  1055. {
  1056. "data": [
  1057. {
  1058. "id": "",
  1059. "position": 1,
  1060. "data_source_type": "file_upload",
  1061. "data_source_info": null,
  1062. "dataset_process_rule_id": null,
  1063. "name": "dify",
  1064. "created_from": "",
  1065. "created_by": "",
  1066. "created_at": 1681623639,
  1067. "tokens": 0,
  1068. "indexing_status": "waiting",
  1069. "error": null,
  1070. "enabled": true,
  1071. "disabled_at": null,
  1072. "disabled_by": null,
  1073. "archived": false
  1074. },
  1075. ],
  1076. "has_more": false,
  1077. "limit": 20,
  1078. "total": 9,
  1079. "page": 1
  1080. }
  1081. ```
  1082. </CodeGroup>
  1083. </Col>
  1084. </Row>
  1085. <hr className='ml-0 mr-0' />
  1086. <Heading
  1087. url='/datasets/{dataset_id}/documents/{document_id}'
  1088. method='GET'
  1089. title='获取文档详情'
  1090. name='#get-document-detail'
  1091. />
  1092. <Row>
  1093. <Col>
  1094. 获取文档详情.
  1095. ### Path
  1096. - `dataset_id` (string) 知识库 ID
  1097. - `document_id` (string) 文档 ID
  1098. ### Query
  1099. - `metadata` (string) metadata 过滤条件 `all`, `only`, 或者 `without`. 默认是 `all`.
  1100. ### Response
  1101. 返回知识库文档的详情.
  1102. </Col>
  1103. <Col sticky>
  1104. ### Request Example
  1105. <CodeGroup title="Request" tag="GET" label="/datasets/{dataset_id}/documents/{document_id}" targetCode={`curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \\\n-H 'Authorization: Bearer {api_key}'`}>
  1106. ```bash {{ title: 'cURL' }}
  1107. curl -X GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}' \
  1108. -H 'Authorization: Bearer {api_key}'
  1109. ```
  1110. </CodeGroup>
  1111. ### Response Example
  1112. <CodeGroup title="Response">
  1113. ```json {{ title: 'Response' }}
  1114. {
  1115. "id": "f46ae30c-5c11-471b-96d0-464f5f32a7b2",
  1116. "position": 1,
  1117. "data_source_type": "upload_file",
  1118. "data_source_info": {
  1119. "upload_file": {
  1120. ...
  1121. }
  1122. },
  1123. "dataset_process_rule_id": "24b99906-845e-499f-9e3c-d5565dd6962c",
  1124. "dataset_process_rule": {
  1125. "mode": "hierarchical",
  1126. "rules": {
  1127. "pre_processing_rules": [
  1128. {
  1129. "id": "remove_extra_spaces",
  1130. "enabled": true
  1131. },
  1132. {
  1133. "id": "remove_urls_emails",
  1134. "enabled": false
  1135. }
  1136. ],
  1137. "segmentation": {
  1138. "separator": "**********page_ending**********",
  1139. "max_tokens": 1024,
  1140. "chunk_overlap": 0
  1141. },
  1142. "parent_mode": "paragraph",
  1143. "subchunk_segmentation": {
  1144. "separator": "\n",
  1145. "max_tokens": 512,
  1146. "chunk_overlap": 0
  1147. }
  1148. }
  1149. },
  1150. "document_process_rule": {
  1151. "id": "24b99906-845e-499f-9e3c-d5565dd6962c",
  1152. "dataset_id": "48a0db76-d1a9-46c1-ae35-2baaa919a8a9",
  1153. "mode": "hierarchical",
  1154. "rules": {
  1155. "pre_processing_rules": [
  1156. {
  1157. "id": "remove_extra_spaces",
  1158. "enabled": true
  1159. },
  1160. {
  1161. "id": "remove_urls_emails",
  1162. "enabled": false
  1163. }
  1164. ],
  1165. "segmentation": {
  1166. "separator": "**********page_ending**********",
  1167. "max_tokens": 1024,
  1168. "chunk_overlap": 0
  1169. },
  1170. "parent_mode": "paragraph",
  1171. "subchunk_segmentation": {
  1172. "separator": "\n",
  1173. "max_tokens": 512,
  1174. "chunk_overlap": 0
  1175. }
  1176. }
  1177. },
  1178. "name": "xxxx",
  1179. "created_from": "web",
  1180. "created_by": "17f71940-a7b5-4c77-b60f-2bd645c1ffa0",
  1181. "created_at": 1750464191,
  1182. "tokens": null,
  1183. "indexing_status": "waiting",
  1184. "completed_at": null,
  1185. "updated_at": 1750464191,
  1186. "indexing_latency": null,
  1187. "error": null,
  1188. "enabled": true,
  1189. "disabled_at": null,
  1190. "disabled_by": null,
  1191. "archived": false,
  1192. "segment_count": 0,
  1193. "average_segment_length": 0,
  1194. "hit_count": null,
  1195. "display_status": "queuing",
  1196. "doc_form": "hierarchical_model",
  1197. "doc_language": "Chinese Simplified"
  1198. }
  1199. ```
  1200. </CodeGroup>
  1201. </Col>
  1202. </Row>
  1203. ___
  1204. <hr className='ml-0 mr-0' />
  1205. <Heading
  1206. url='/datasets/{dataset_id}/documents/status/{action}'
  1207. method='PATCH'
  1208. title='更新文档状态'
  1209. name='#batch_document_status'
  1210. />
  1211. <Row>
  1212. <Col>
  1213. ### Path
  1214. <Properties>
  1215. <Property name='dataset_id' type='string' key='dataset_id'>
  1216. 知识库 ID
  1217. </Property>
  1218. <Property name='action' type='string' key='action'>
  1219. - `enable` - 启用文档
  1220. - `disable` - 禁用文档
  1221. - `archive` - 归档文档
  1222. - `un_archive` - 取消归档文档
  1223. </Property>
  1224. </Properties>
  1225. ### Request Body
  1226. <Properties>
  1227. <Property name='document_ids' type='array[string]' key='document_ids'>
  1228. 文档ID列表
  1229. </Property>
  1230. </Properties>
  1231. </Col>
  1232. <Col sticky>
  1233. <CodeGroup
  1234. title="Request"
  1235. tag="PATCH"
  1236. label="/datasets/{dataset_id}/documents/status/{action}"
  1237. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "document_ids": ["doc-id-1", "doc-id-2"]\n}'`}
  1238. >
  1239. ```bash {{ title: 'cURL' }}
  1240. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/status/{action}' \
  1241. --header 'Authorization: Bearer {api_key}' \
  1242. --header 'Content-Type: application/json' \
  1243. --data-raw '{
  1244. "document_ids": ["doc-id-1", "doc-id-2"]
  1245. }'
  1246. ```
  1247. </CodeGroup>
  1248. <CodeGroup title="Response">
  1249. ```json {{ title: 'Response' }}
  1250. {
  1251. "result": "success"
  1252. }
  1253. ```
  1254. </CodeGroup>
  1255. </Col>
  1256. </Row>
  1257. <hr className='ml-0 mr-0' />
  1258. <Heading
  1259. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1260. method='POST'
  1261. title='新增分段'
  1262. name='#create_new_segment'
  1263. />
  1264. <Row>
  1265. <Col>
  1266. ### Path
  1267. <Properties>
  1268. <Property name='dataset_id' type='string' key='dataset_id'>
  1269. 知识库 ID
  1270. </Property>
  1271. <Property name='document_id' type='string' key='document_id'>
  1272. 文档 ID
  1273. </Property>
  1274. </Properties>
  1275. ### Request Body
  1276. <Properties>
  1277. <Property name='segments' type='object list' key='segments'>
  1278. - <code>content</code> (text) 文本内容/问题内容,必填
  1279. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  1280. - <code>keywords</code> (list) 关键字,非必填
  1281. </Property>
  1282. </Properties>
  1283. </Col>
  1284. <Col sticky>
  1285. <CodeGroup
  1286. title="Request"
  1287. tag="POST"
  1288. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1289. 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"]}]}'`}
  1290. >
  1291. ```bash {{ title: 'cURL' }}
  1292. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1293. --header 'Authorization: Bearer {api_key}' \
  1294. --header 'Content-Type: application/json' \
  1295. --data-raw '{
  1296. "segments": [
  1297. {
  1298. "content": "1",
  1299. "answer": "1",
  1300. "keywords": ["a"]
  1301. }
  1302. ]
  1303. }'
  1304. ```
  1305. </CodeGroup>
  1306. <CodeGroup title="Response">
  1307. ```json {{ title: 'Response' }}
  1308. {
  1309. "data": [{
  1310. "id": "",
  1311. "position": 1,
  1312. "document_id": "",
  1313. "content": "1",
  1314. "answer": "1",
  1315. "word_count": 25,
  1316. "tokens": 0,
  1317. "keywords": [
  1318. "a"
  1319. ],
  1320. "index_node_id": "",
  1321. "index_node_hash": "",
  1322. "hit_count": 0,
  1323. "enabled": true,
  1324. "disabled_at": null,
  1325. "disabled_by": null,
  1326. "status": "completed",
  1327. "created_by": "",
  1328. "created_at": 1695312007,
  1329. "indexing_at": 1695312007,
  1330. "completed_at": 1695312007,
  1331. "error": null,
  1332. "stopped_at": null
  1333. }],
  1334. "doc_form": "text_model"
  1335. }
  1336. ```
  1337. </CodeGroup>
  1338. </Col>
  1339. </Row>
  1340. <hr className='ml-0 mr-0' />
  1341. <Heading
  1342. url='/datasets/{dataset_id}/documents/{document_id}/segments'
  1343. method='GET'
  1344. title='查询文档分段'
  1345. name='#get_segment'
  1346. />
  1347. <Row>
  1348. <Col>
  1349. ### Path
  1350. <Properties>
  1351. <Property name='dataset_id' type='string' key='dataset_id'>
  1352. 知识库 ID
  1353. </Property>
  1354. <Property name='document_id' type='string' key='document_id'>
  1355. 文档 ID
  1356. </Property>
  1357. </Properties>
  1358. ### Query
  1359. <Properties>
  1360. <Property name='keyword' type='string' key='keyword'>
  1361. 搜索关键词,可选
  1362. </Property>
  1363. <Property name='status' type='string' key='status'>
  1364. 搜索状态,completed
  1365. </Property>
  1366. <Property name='page' type='string' key='page'>
  1367. 页码,可选
  1368. </Property>
  1369. <Property name='limit' type='string' key='limit'>
  1370. 返回条数,可选,默认 20,范围 1-100
  1371. </Property>
  1372. </Properties>
  1373. </Col>
  1374. <Col sticky>
  1375. <CodeGroup
  1376. title="Request"
  1377. tag="GET"
  1378. label="/datasets/{dataset_id}/documents/{document_id}/segments"
  1379. 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'`}
  1380. >
  1381. ```bash {{ title: 'cURL' }}
  1382. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments' \
  1383. --header 'Authorization: Bearer {api_key}' \
  1384. --header 'Content-Type: application/json'
  1385. ```
  1386. </CodeGroup>
  1387. <CodeGroup title="Response">
  1388. ```json {{ title: 'Response' }}
  1389. {
  1390. "data": [{
  1391. "id": "",
  1392. "position": 1,
  1393. "document_id": "",
  1394. "content": "1",
  1395. "answer": "1",
  1396. "word_count": 25,
  1397. "tokens": 0,
  1398. "keywords": [
  1399. "a"
  1400. ],
  1401. "index_node_id": "",
  1402. "index_node_hash": "",
  1403. "hit_count": 0,
  1404. "enabled": true,
  1405. "disabled_at": null,
  1406. "disabled_by": null,
  1407. "status": "completed",
  1408. "created_by": "",
  1409. "created_at": 1695312007,
  1410. "indexing_at": 1695312007,
  1411. "completed_at": 1695312007,
  1412. "error": null,
  1413. "stopped_at": null
  1414. }],
  1415. "doc_form": "text_model",
  1416. "has_more": false,
  1417. "limit": 20,
  1418. "total": 9,
  1419. "page": 1
  1420. }
  1421. ```
  1422. </CodeGroup>
  1423. </Col>
  1424. </Row>
  1425. <hr className='ml-0 mr-0' />
  1426. <Heading
  1427. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1428. method='DELETE'
  1429. title='删除文档分段'
  1430. name='#delete_segment'
  1431. />
  1432. <Row>
  1433. <Col>
  1434. ### Path
  1435. <Properties>
  1436. <Property name='dataset_id' type='string' key='dataset_id'>
  1437. 知识库 ID
  1438. </Property>
  1439. <Property name='document_id' type='string' key='document_id'>
  1440. 文档 ID
  1441. </Property>
  1442. <Property name='segment_id' type='string' key='segment_id'>
  1443. 文档分段 ID
  1444. </Property>
  1445. </Properties>
  1446. </Col>
  1447. <Col sticky>
  1448. <CodeGroup
  1449. title="Request"
  1450. tag="DELETE"
  1451. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1452. 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'`}
  1453. >
  1454. ```bash {{ title: 'cURL' }}
  1455. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1456. --header 'Authorization: Bearer {api_key}' \
  1457. --header 'Content-Type: application/json'
  1458. ```
  1459. </CodeGroup>
  1460. <CodeGroup title="Response">
  1461. ```text {{ title: 'Response' }}
  1462. 204 No Content
  1463. ```
  1464. </CodeGroup>
  1465. </Col>
  1466. </Row>
  1467. <hr className='ml-0 mr-0' />
  1468. <Heading
  1469. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}'
  1470. method='GET'
  1471. title='查看文档分段详情'
  1472. name='#view_document_segment'
  1473. />
  1474. <Row>
  1475. <Col>
  1476. 查看指定知识库中特定文档的分段详情
  1477. ### Path
  1478. <Properties>
  1479. <Property name='dataset_id' type='string' key='dataset_id'>
  1480. 知识库 ID
  1481. </Property>
  1482. <Property name='document_id' type='string' key='document_id'>
  1483. 文档 ID
  1484. </Property>
  1485. <Property name='segment_id' type='string' key='segment_id'>
  1486. 分段 ID
  1487. </Property>
  1488. </Properties>
  1489. </Col>
  1490. <Col sticky>
  1491. <CodeGroup
  1492. title="Request"
  1493. tag="GET"
  1494. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1495. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  1496. >
  1497. ```bash {{ title: 'cURL' }}
  1498. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1499. --header 'Authorization: Bearer {api_key}'
  1500. ```
  1501. </CodeGroup>
  1502. <CodeGroup title="Response">
  1503. ```json {{ title: 'Response' }}
  1504. {
  1505. "data": {
  1506. "id": "分段唯一ID",
  1507. "position": 2,
  1508. "document_id": "所属文档ID",
  1509. "content": "分段内容文本",
  1510. "sign_content": "签名内容文本",
  1511. "answer": "答案内容(如果有)",
  1512. "word_count": 470,
  1513. "tokens": 382,
  1514. "keywords": ["关键词1", "关键词2"],
  1515. "index_node_id": "索引节点ID",
  1516. "index_node_hash": "索引节点哈希值",
  1517. "hit_count": 0,
  1518. "enabled": true,
  1519. "status": "completed",
  1520. "created_by": "创建者ID",
  1521. "created_at": 创建时间戳,
  1522. "updated_at": 更新时间戳,
  1523. "indexing_at": 索引时间戳,
  1524. "completed_at": 完成时间戳,
  1525. "error": null,
  1526. "child_chunks": []
  1527. },
  1528. "doc_form": "text_model"
  1529. }
  1530. ```
  1531. </CodeGroup>
  1532. </Col>
  1533. </Row>
  1534. <hr className='ml-0 mr-0' />
  1535. <Heading
  1536. method='POST'
  1537. title='更新文档分段'
  1538. name='#update_segment'
  1539. />
  1540. <Row>
  1541. <Col>
  1542. ### POST
  1543. <Properties>
  1544. <Property name='dataset_id' type='string' key='dataset_id'>
  1545. 知识库 ID
  1546. </Property>
  1547. <Property name='document_id' type='string' key='document_id'>
  1548. 文档 ID
  1549. </Property>
  1550. <Property name='segment_id' type='string' key='segment_id'>
  1551. 文档分段 ID
  1552. </Property>
  1553. </Properties>
  1554. ### Request Body
  1555. <Properties>
  1556. <Property name='segment' type='object' key='segment'>
  1557. - <code>content</code> (text) 文本内容/问题内容,必填
  1558. - <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为 Q&A 模式则传值
  1559. - <code>keywords</code> (list) 关键字,非必填
  1560. - <code>enabled</code> (bool) false/true,非必填
  1561. - <code>regenerate_child_chunks</code> (bool) 是否重新生成子分段,非必填
  1562. </Property>
  1563. </Properties>
  1564. </Col>
  1565. <Col sticky>
  1566. <CodeGroup
  1567. title="Request"
  1568. tag="POST"
  1569. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
  1570. 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}}'`}
  1571. >
  1572. ```bash {{ title: 'cURL' }}
  1573. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
  1574. --header 'Authorization: Bearer {api_key}' \
  1575. --header 'Content-Type: application/json' \
  1576. --data-raw '{
  1577. "segment": {
  1578. "content": "1",
  1579. "answer": "1",
  1580. "keywords": ["a"],
  1581. "enabled": false
  1582. }
  1583. }'
  1584. ```
  1585. </CodeGroup>
  1586. <CodeGroup title="Response">
  1587. ```json {{ title: 'Response' }}
  1588. {
  1589. "data": {
  1590. "id": "",
  1591. "position": 1,
  1592. "document_id": "",
  1593. "content": "1",
  1594. "answer": "1",
  1595. "word_count": 25,
  1596. "tokens": 0,
  1597. "keywords": [
  1598. "a"
  1599. ],
  1600. "index_node_id": "",
  1601. "index_node_hash": "",
  1602. "hit_count": 0,
  1603. "enabled": true,
  1604. "disabled_at": null,
  1605. "disabled_by": null,
  1606. "status": "completed",
  1607. "created_by": "",
  1608. "created_at": 1695312007,
  1609. "indexing_at": 1695312007,
  1610. "completed_at": 1695312007,
  1611. "error": null,
  1612. "stopped_at": null
  1613. },
  1614. "doc_form": "text_model"
  1615. }
  1616. ```
  1617. </CodeGroup>
  1618. </Col>
  1619. </Row>
  1620. <hr className='ml-0 mr-0' />
  1621. <Heading
  1622. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1623. method='POST'
  1624. title='新增文档子分段'
  1625. name='#create_child_chunk'
  1626. />
  1627. <Row>
  1628. <Col>
  1629. ### Path
  1630. <Properties>
  1631. <Property name='dataset_id' type='string' key='dataset_id'>
  1632. 知识库 ID
  1633. </Property>
  1634. <Property name='document_id' type='string' key='document_id'>
  1635. 文档 ID
  1636. </Property>
  1637. <Property name='segment_id' type='string' key='segment_id'>
  1638. 分段 ID
  1639. </Property>
  1640. </Properties>
  1641. ### Request Body
  1642. <Properties>
  1643. <Property name='content' type='string' key='content'>
  1644. 子分段内容
  1645. </Property>
  1646. </Properties>
  1647. </Col>
  1648. <Col sticky>
  1649. <CodeGroup
  1650. title="Request"
  1651. tag="POST"
  1652. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1653. 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": "子分段内容"}'`}
  1654. >
  1655. ```bash {{ title: 'cURL' }}
  1656. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks' \
  1657. --header 'Authorization: Bearer {api_key}' \
  1658. --header 'Content-Type: application/json' \
  1659. --data-raw '{
  1660. "content": "子分段内容"
  1661. }'
  1662. ```
  1663. </CodeGroup>
  1664. <CodeGroup title="Response">
  1665. ```json {{ title: 'Response' }}
  1666. {
  1667. "data": {
  1668. "id": "",
  1669. "segment_id": "",
  1670. "content": "子分段内容",
  1671. "word_count": 25,
  1672. "tokens": 0,
  1673. "index_node_id": "",
  1674. "index_node_hash": "",
  1675. "status": "completed",
  1676. "created_by": "",
  1677. "created_at": 1695312007,
  1678. "indexing_at": 1695312007,
  1679. "completed_at": 1695312007,
  1680. "error": null,
  1681. "stopped_at": null
  1682. }
  1683. }
  1684. ```
  1685. </CodeGroup>
  1686. </Col>
  1687. </Row>
  1688. <hr className='ml-0 mr-0' />
  1689. <Heading
  1690. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks'
  1691. method='GET'
  1692. title='查询文档子分段'
  1693. name='#get_child_chunks'
  1694. />
  1695. <Row>
  1696. <Col>
  1697. ### Path
  1698. <Properties>
  1699. <Property name='dataset_id' type='string' key='dataset_id'>
  1700. 知识库 ID
  1701. </Property>
  1702. <Property name='document_id' type='string' key='document_id'>
  1703. 文档 ID
  1704. </Property>
  1705. <Property name='segment_id' type='string' key='segment_id'>
  1706. 分段 ID
  1707. </Property>
  1708. </Properties>
  1709. ### Query
  1710. <Properties>
  1711. <Property name='keyword' type='string' key='keyword'>
  1712. 搜索关键词(选填)
  1713. </Property>
  1714. <Property name='page' type='integer' key='page'>
  1715. 页码(选填,默认1)
  1716. </Property>
  1717. <Property name='limit' type='integer' key='limit'>
  1718. 每页数量(选填,默认20,最大100)
  1719. </Property>
  1720. </Properties>
  1721. </Col>
  1722. <Col sticky>
  1723. <CodeGroup
  1724. title="Request"
  1725. tag="GET"
  1726. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks"
  1727. 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}'`}
  1728. >
  1729. ```bash {{ title: 'cURL' }}
  1730. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks?page=1&limit=20' \
  1731. --header 'Authorization: Bearer {api_key}'
  1732. ```
  1733. </CodeGroup>
  1734. <CodeGroup title="Response">
  1735. ```json {{ title: 'Response' }}
  1736. {
  1737. "data": [{
  1738. "id": "",
  1739. "segment_id": "",
  1740. "content": "子分段内容",
  1741. "word_count": 25,
  1742. "tokens": 0,
  1743. "index_node_id": "",
  1744. "index_node_hash": "",
  1745. "status": "completed",
  1746. "created_by": "",
  1747. "created_at": 1695312007,
  1748. "indexing_at": 1695312007,
  1749. "completed_at": 1695312007,
  1750. "error": null,
  1751. "stopped_at": null
  1752. }],
  1753. "total": 1,
  1754. "total_pages": 1,
  1755. "page": 1,
  1756. "limit": 20
  1757. }
  1758. ```
  1759. </CodeGroup>
  1760. </Col>
  1761. </Row>
  1762. <hr className='ml-0 mr-0' />
  1763. <Heading
  1764. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1765. method='DELETE'
  1766. title='删除文档子分段'
  1767. name='#delete_child_chunk'
  1768. />
  1769. <Row>
  1770. <Col>
  1771. ### Path
  1772. <Properties>
  1773. <Property name='dataset_id' type='string' key='dataset_id'>
  1774. 知识库 ID
  1775. </Property>
  1776. <Property name='document_id' type='string' key='document_id'>
  1777. 文档 ID
  1778. </Property>
  1779. <Property name='segment_id' type='string' key='segment_id'>
  1780. 分段 ID
  1781. </Property>
  1782. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1783. 子分段 ID
  1784. </Property>
  1785. </Properties>
  1786. </Col>
  1787. <Col sticky>
  1788. <CodeGroup
  1789. title="Request"
  1790. tag="DELETE"
  1791. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1792. 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}'`}
  1793. >
  1794. ```bash {{ title: 'cURL' }}
  1795. curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1796. --header 'Authorization: Bearer {api_key}'
  1797. ```
  1798. </CodeGroup>
  1799. <CodeGroup title="Response">
  1800. ```text {{ title: 'Response' }}
  1801. 204 No Content
  1802. ```
  1803. </CodeGroup>
  1804. </Col>
  1805. </Row>
  1806. <hr className='ml-0 mr-0' />
  1807. <Row>
  1808. <Col>
  1809. ### 错误信息
  1810. <Properties>
  1811. <Property name='code' type='string' key='code'>
  1812. 返回的错误代码
  1813. </Property>
  1814. </Properties>
  1815. <Properties>
  1816. <Property name='status' type='number' key='status'>
  1817. 返回的错误状态
  1818. </Property>
  1819. </Properties>
  1820. <Properties>
  1821. <Property name='message' type='string' key='message'>
  1822. 返回的错误信息
  1823. </Property>
  1824. </Properties>
  1825. </Col>
  1826. <Col>
  1827. <CodeGroup title="Example">
  1828. ```json {{ title: 'Response' }}
  1829. {
  1830. "code": "no_file_uploaded",
  1831. "message": "Please upload your file.",
  1832. "status": 400
  1833. }
  1834. ```
  1835. </CodeGroup>
  1836. </Col>
  1837. </Row>
  1838. <hr className='ml-0 mr-0' />
  1839. <Heading
  1840. url='/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}'
  1841. method='PATCH'
  1842. title='更新文档子分段'
  1843. name='#update_child_chunk'
  1844. />
  1845. <Row>
  1846. <Col>
  1847. ### Path
  1848. <Properties>
  1849. <Property name='dataset_id' type='string' key='dataset_id'>
  1850. 知识库 ID
  1851. </Property>
  1852. <Property name='document_id' type='string' key='document_id'>
  1853. 文档 ID
  1854. </Property>
  1855. <Property name='segment_id' type='string' key='segment_id'>
  1856. 分段 ID
  1857. </Property>
  1858. <Property name='child_chunk_id' type='string' key='child_chunk_id'>
  1859. 子分段 ID
  1860. </Property>
  1861. </Properties>
  1862. ### Request Body
  1863. <Properties>
  1864. <Property name='content' type='string' key='content'>
  1865. 子分段内容
  1866. </Property>
  1867. </Properties>
  1868. </Col>
  1869. <Col sticky>
  1870. <CodeGroup
  1871. title="Request"
  1872. tag="PATCH"
  1873. label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}"
  1874. 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": "更新的子分段内容"}'`}
  1875. >
  1876. ```bash {{ title: 'cURL' }}
  1877. curl --location --request PATCH '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}' \
  1878. --header 'Authorization: Bearer {api_key}' \
  1879. --header 'Content-Type: application/json' \
  1880. --data-raw '{
  1881. "content": "更新的子分段内容"
  1882. }'
  1883. ```
  1884. </CodeGroup>
  1885. <CodeGroup title="Response">
  1886. ```json {{ title: 'Response' }}
  1887. {
  1888. "data": {
  1889. "id": "",
  1890. "segment_id": "",
  1891. "content": "更新的子分段内容",
  1892. "word_count": 25,
  1893. "tokens": 0,
  1894. "index_node_id": "",
  1895. "index_node_hash": "",
  1896. "status": "completed",
  1897. "created_by": "",
  1898. "created_at": 1695312007,
  1899. "indexing_at": 1695312007,
  1900. "completed_at": 1695312007,
  1901. "error": null,
  1902. "stopped_at": null
  1903. }
  1904. }
  1905. ```
  1906. </CodeGroup>
  1907. </Col>
  1908. </Row>
  1909. <hr className='ml-0 mr-0' />
  1910. <Heading
  1911. url='/datasets/{dataset_id}/documents/{document_id}/upload-file'
  1912. method='GET'
  1913. title='获取上传文件'
  1914. name='#get_upload_file'
  1915. />
  1916. <Row>
  1917. <Col>
  1918. ### Path
  1919. <Properties>
  1920. <Property name='dataset_id' type='string' key='dataset_id'>
  1921. 知识库 ID
  1922. </Property>
  1923. <Property name='document_id' type='string' key='document_id'>
  1924. 文档 ID
  1925. </Property>
  1926. </Properties>
  1927. </Col>
  1928. <Col sticky>
  1929. <CodeGroup
  1930. title="Request"
  1931. tag="GET"
  1932. label="/datasets/{dataset_id}/documents/{document_id}/upload-file"
  1933. 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'`}
  1934. >
  1935. ```bash {{ title: 'cURL' }}
  1936. curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/upload-file' \
  1937. --header 'Authorization: Bearer {api_key}' \
  1938. --header 'Content-Type: application/json'
  1939. ```
  1940. </CodeGroup>
  1941. <CodeGroup title="Response">
  1942. ```json {{ title: 'Response' }}
  1943. {
  1944. "id": "file_id",
  1945. "name": "file_name",
  1946. "size": 1024,
  1947. "extension": "txt",
  1948. "url": "preview_url",
  1949. "download_url": "download_url",
  1950. "mime_type": "text/plain",
  1951. "created_by": "user_id",
  1952. "created_at": 1728734540,
  1953. }
  1954. ```
  1955. </CodeGroup>
  1956. </Col>
  1957. </Row>
  1958. <hr className='ml-0 mr-0' />
  1959. <Heading
  1960. url='/datasets/{dataset_id}/retrieve'
  1961. method='POST'
  1962. title='检索知识库'
  1963. name='#dataset_retrieval'
  1964. />
  1965. <Row>
  1966. <Col>
  1967. ### Path
  1968. <Properties>
  1969. <Property name='dataset_id' type='string' key='dataset_id'>
  1970. 知识库 ID
  1971. </Property>
  1972. </Properties>
  1973. ### Request Body
  1974. <Properties>
  1975. <Property name='query' type='string' key='query'>
  1976. 检索关键词
  1977. </Property>
  1978. <Property name='retrieval_model' type='object' key='retrieval_model'>
  1979. 检索参数(选填,如不填,按照默认方式召回)
  1980. - <code>search_method</code> (text) 检索方法:以下四个关键字之一,必填
  1981. - <code>keyword_search</code> 关键字检索
  1982. - <code>semantic_search</code> 语义检索
  1983. - <code>full_text_search</code> 全文检索
  1984. - <code>hybrid_search</code> 混合检索
  1985. - <code>reranking_enable</code> (bool) 是否启用 Reranking,非必填,如果检索模式为 semantic_search 模式或者 hybrid_search 则传值
  1986. - <code>reranking_mode</code> (object) Rerank 模型配置,非必填,如果启用了 reranking 则传值
  1987. - <code>reranking_provider_name</code> (string) Rerank 模型提供商
  1988. - <code>reranking_model_name</code> (string) Rerank 模型名称
  1989. - <code>weights</code> (float) 混合检索模式下语意检索的权重设置
  1990. - <code>top_k</code> (integer) 返回结果数量,非必填
  1991. - <code>score_threshold_enabled</code> (bool) 是否开启 score 阈值
  1992. - <code>score_threshold</code> (float) Score 阈值
  1993. - <code>metadata_filtering_conditions</code> (object) 元数据过滤条件
  1994. - <code>logical_operator</code> (string) 逻辑运算符: <code>and</code> | <code>or</code>
  1995. - <code>conditions</code> (array[object]) 条件列表
  1996. - <code>name</code> (string) 元数据字段名
  1997. - <code>comparison_operator</code> (string) 比较运算符,可选值:
  1998. - 字符串比较:
  1999. - <code>contains</code>: 包含
  2000. - <code>not contains</code>: 不包含
  2001. - <code>start with</code>: 以...开头
  2002. - <code>end with</code>: 以...结尾
  2003. - <code>is</code>: 等于
  2004. - <code>is not</code>: 不等于
  2005. - <code>empty</code>: 为空
  2006. - <code>not empty</code>: 不为空
  2007. - 数值比较:
  2008. - <code>=</code>: 等于
  2009. - <code>≠</code>: 不等于
  2010. - <code>></code>: 大于
  2011. - <code> < </code>: 小于
  2012. - <code>≥</code>: 大于等于
  2013. - <code>≤</code>: 小于等于
  2014. - 时间比较:
  2015. - <code>before</code>: 早于
  2016. - <code>after</code>: 晚于
  2017. - <code>value</code> (string|number|null) 比较值
  2018. </Property>
  2019. <Property name='external_retrieval_model' type='object' key='external_retrieval_model'>
  2020. 未启用字段
  2021. </Property>
  2022. </Properties>
  2023. </Col>
  2024. <Col sticky>
  2025. <CodeGroup
  2026. title="Request"
  2027. tag="POST"
  2028. label="/datasets/{dataset_id}/retrieve"
  2029. 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 '{
  2030. "query": "test",
  2031. "retrieval_model": {
  2032. "search_method": "keyword_search",
  2033. "reranking_enable": false,
  2034. "reranking_mode": null,
  2035. "reranking_model": {
  2036. "reranking_provider_name": "",
  2037. "reranking_model_name": ""
  2038. },
  2039. "weights": null,
  2040. "top_k": 1,
  2041. "score_threshold_enabled": false,
  2042. "score_threshold": null,
  2043. "metadata_filtering_conditions": {
  2044. "logical_operator": "and",
  2045. "conditions": [
  2046. {
  2047. "name": "document_name",
  2048. "comparison_operator": "contains",
  2049. "value": "test"
  2050. }
  2051. ]
  2052. }
  2053. }
  2054. }'`}
  2055. >
  2056. ```bash {{ title: 'cURL' }}
  2057. curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/retrieve' \
  2058. --header 'Authorization: Bearer {api_key}' \
  2059. --header 'Content-Type: application/json' \
  2060. --data-raw '{
  2061. "query": "test",
  2062. "retrieval_model": {
  2063. "search_method": "keyword_search",
  2064. "reranking_enable": false,
  2065. "reranking_mode": null,
  2066. "reranking_model": {
  2067. "reranking_provider_name": "",
  2068. "reranking_model_name": ""
  2069. },
  2070. "weights": null,
  2071. "top_k": 2,
  2072. "score_threshold_enabled": false,
  2073. "score_threshold": null
  2074. }
  2075. }'
  2076. ```
  2077. </CodeGroup>
  2078. <CodeGroup title="Response">
  2079. ```json {{ title: 'Response' }}
  2080. {
  2081. "query": {
  2082. "content": "test"
  2083. },
  2084. "records": [
  2085. {
  2086. "segment": {
  2087. "id": "7fa6f24f-8679-48b3-bc9d-bdf28d73f218",
  2088. "position": 1,
  2089. "document_id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  2090. "content": "Operation guide",
  2091. "answer": null,
  2092. "word_count": 847,
  2093. "tokens": 280,
  2094. "keywords": [
  2095. "install",
  2096. "java",
  2097. "base",
  2098. "scripts",
  2099. "jdk",
  2100. "manual",
  2101. "internal",
  2102. "opens",
  2103. "add",
  2104. "vmoptions"
  2105. ],
  2106. "index_node_id": "39dd8443-d960-45a8-bb46-7275ad7fbc8e",
  2107. "index_node_hash": "0189157697b3c6a418ccf8264a09699f25858975578f3467c76d6bfc94df1d73",
  2108. "hit_count": 0,
  2109. "enabled": true,
  2110. "disabled_at": null,
  2111. "disabled_by": null,
  2112. "status": "completed",
  2113. "created_by": "dbcb1ab5-90c8-41a7-8b78-73b235eb6f6f",
  2114. "created_at": 1728734540,
  2115. "indexing_at": 1728734552,
  2116. "completed_at": 1728734584,
  2117. "error": null,
  2118. "stopped_at": null,
  2119. "document": {
  2120. "id": "a8c6c36f-9f5d-4d7a-8472-f5d7b75d71d2",
  2121. "data_source_type": "upload_file",
  2122. "name": "readme.txt",
  2123. }
  2124. },
  2125. "score": 3.730463140527718e-05,
  2126. "tsne_position": null
  2127. }
  2128. ]
  2129. }
  2130. ```
  2131. </CodeGroup>
  2132. </Col>
  2133. </Row>
  2134. <hr className='ml-0 mr-0' />
  2135. <Heading
  2136. url='/datasets/{dataset_id}/metadata'
  2137. method='POST'
  2138. title='新增元数据'
  2139. name='#create_metadata'
  2140. />
  2141. <Row>
  2142. <Col>
  2143. ### Params
  2144. <Properties>
  2145. <Property name='dataset_id' type='string' key='dataset_id'>
  2146. 知识库 ID
  2147. </Property>
  2148. </Properties>
  2149. ### Request Body
  2150. <Properties>
  2151. <Property name='segment' type='object' key='segment'>
  2152. - <code>type</code> (string) 元数据类型,必填
  2153. - <code>name</code> (string) 元数据名称,必填
  2154. </Property>
  2155. </Properties>
  2156. </Col>
  2157. <Col sticky>
  2158. <CodeGroup
  2159. title="Request"
  2160. tag="POST"
  2161. label="/datasets/{dataset_id}/metadata"
  2162. 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"}'`}
  2163. >
  2164. ```bash {{ title: 'cURL' }}
  2165. ```
  2166. </CodeGroup>
  2167. <CodeGroup title="Response">
  2168. ```json {{ title: 'Response' }}
  2169. {
  2170. "id": "abc",
  2171. "type": "string",
  2172. "name": "test",
  2173. }
  2174. ```
  2175. </CodeGroup>
  2176. </Col>
  2177. </Row>
  2178. <hr className='ml-0 mr-0' />
  2179. <Heading
  2180. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  2181. method='PATCH'
  2182. title='更新元数据'
  2183. name='#update_metadata'
  2184. />
  2185. <Row>
  2186. <Col>
  2187. ### Path
  2188. <Properties>
  2189. <Property name='dataset_id' type='string' key='dataset_id'>
  2190. 知识库 ID
  2191. </Property>
  2192. <Property name='metadata_id' type='string' key='metadata_id'>
  2193. 元数据 ID
  2194. </Property>
  2195. </Properties>
  2196. ### Request Body
  2197. <Properties>
  2198. <Property name='segment' type='object' key='segment'>
  2199. - <code>name</code> (string) 元数据名称,必填
  2200. </Property>
  2201. </Properties>
  2202. </Col>
  2203. <Col sticky>
  2204. <CodeGroup
  2205. title="Request"
  2206. tag="PATCH"
  2207. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  2208. 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"}'`}
  2209. >
  2210. ```bash {{ title: 'cURL' }}
  2211. ```
  2212. </CodeGroup>
  2213. <CodeGroup title="Response">
  2214. ```json {{ title: 'Response' }}
  2215. {
  2216. "id": "abc",
  2217. "type": "string",
  2218. "name": "test",
  2219. }
  2220. ```
  2221. </CodeGroup>
  2222. </Col>
  2223. </Row>
  2224. <hr className='ml-0 mr-0' />
  2225. <Heading
  2226. url='/datasets/{dataset_id}/metadata/{metadata_id}'
  2227. method='DELETE'
  2228. title='删除元数据'
  2229. name='#delete_metadata'
  2230. />
  2231. <Row>
  2232. <Col>
  2233. ### Path
  2234. <Properties>
  2235. <Property name='dataset_id' type='string' key='dataset_id'>
  2236. 知识库 ID
  2237. </Property>
  2238. <Property name='metadata_id' type='string' key='metadata_id'>
  2239. 元数据 ID
  2240. </Property>
  2241. </Properties>
  2242. </Col>
  2243. <Col sticky>
  2244. <CodeGroup
  2245. title="Request"
  2246. tag="DELETE"
  2247. label="/datasets/{dataset_id}/metadata/{metadata_id}"
  2248. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/{metadata_id}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2249. >
  2250. ```bash {{ title: 'cURL' }}
  2251. ```
  2252. </CodeGroup>
  2253. </Col>
  2254. </Row>
  2255. <hr className='ml-0 mr-0' />
  2256. <Heading
  2257. url='/datasets/{dataset_id}/metadata/built-in/{action}'
  2258. method='POST'
  2259. title='启用/禁用内置元数据'
  2260. name='#toggle_metadata'
  2261. />
  2262. <Row>
  2263. <Col>
  2264. ### Path
  2265. <Properties>
  2266. <Property name='dataset_id' type='string' key='dataset_id'>
  2267. 知识库 ID
  2268. </Property>
  2269. <Property name='action' type='string' key='action'>
  2270. disable/enable
  2271. </Property>
  2272. </Properties>
  2273. </Col>
  2274. <Col sticky>
  2275. <CodeGroup
  2276. title="Request"
  2277. tag="POST"
  2278. label="/datasets/{dataset_id}/metadata/built-in/{action}"
  2279. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata/built-in/{action}' \\\n--header 'Authorization: Bearer {api_key}'`}
  2280. >
  2281. ```bash {{ title: 'cURL' }}
  2282. ```
  2283. </CodeGroup>
  2284. </Col>
  2285. </Row>
  2286. <hr className='ml-0 mr-0' />
  2287. <Heading
  2288. url='/datasets/{dataset_id}/documents/metadata'
  2289. method='POST'
  2290. title='更新文档元数据'
  2291. name='#update_documents_metadata'
  2292. />
  2293. <Row>
  2294. <Col>
  2295. ### Path
  2296. <Properties>
  2297. <Property name='dataset_id' type='string' key='dataset_id'>
  2298. 知识库 ID
  2299. </Property>
  2300. </Properties>
  2301. ### Request Body
  2302. <Properties>
  2303. <Property name='operation_data' type='object list' key='segments'>
  2304. - <code>document_id</code> (string) 文档 ID
  2305. - <code>metadata_list</code> (list) 元数据列表
  2306. - <code>id</code> (string) 元数据 ID
  2307. - <code>value</code> (string) 元数据值
  2308. - <code>name</code> (string) 元数据名称
  2309. </Property>
  2310. </Properties>
  2311. </Col>
  2312. <Col sticky>
  2313. <CodeGroup
  2314. title="Request"
  2315. tag="POST"
  2316. label="/datasets/{dataset_id}/documents/metadata"
  2317. 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"}]}]}'`}
  2318. >
  2319. ```bash {{ title: 'cURL' }}
  2320. ```
  2321. </CodeGroup>
  2322. </Col>
  2323. </Row>
  2324. <hr className='ml-0 mr-0' />
  2325. <Heading
  2326. url='/datasets/{dataset_id}/metadata'
  2327. method='GET'
  2328. title='查询知识库元数据列表'
  2329. name='#dataset_metadata_list'
  2330. />
  2331. <Row>
  2332. <Col>
  2333. ### Path
  2334. <Properties>
  2335. <Property name='dataset_id' type='string' key='dataset_id'>
  2336. 知识库 ID
  2337. </Property>
  2338. </Properties>
  2339. </Col>
  2340. <Col sticky>
  2341. <CodeGroup
  2342. title="Request"
  2343. tag="GET"
  2344. label="/datasets/{dataset_id}/metadata"
  2345. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}'`}
  2346. >
  2347. ```bash {{ title: 'cURL' }}
  2348. ```
  2349. </CodeGroup>
  2350. <CodeGroup title="Response">
  2351. ```json {{ title: 'Response' }}
  2352. {
  2353. "doc_metadata": [
  2354. {
  2355. "id": "",
  2356. "name": "name",
  2357. "type": "string",
  2358. "use_count": 0,
  2359. },
  2360. ...
  2361. ],
  2362. "built_in_field_enabled": true
  2363. }
  2364. ```
  2365. </CodeGroup>
  2366. </Col>
  2367. </Row>
  2368. <hr className='ml-0 mr-0' />
  2369. <Heading
  2370. url='/workspaces/current/models/model-types/text-embedding'
  2371. method='GET'
  2372. title='获取嵌入模型列表'
  2373. name='#model_type_list'
  2374. />
  2375. <Row>
  2376. <Col>
  2377. ### Query
  2378. <Properties>
  2379. </Properties>
  2380. </Col>
  2381. <Col sticky>
  2382. <CodeGroup
  2383. title="Request"
  2384. tag="GET"
  2385. label="/datasets/{dataset_id}"
  2386. 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' `}
  2387. >
  2388. ```bash {{ title: 'cURL' }}
  2389. curl --location --request GET '${props.apiBaseUrl}/workspaces/current/models/model-types/text-embedding' \
  2390. --header 'Authorization: Bearer {api_key}' \
  2391. --header 'Content-Type: application/json' \
  2392. ```
  2393. </CodeGroup>
  2394. <CodeGroup title="Response">
  2395. ```json {{ title: 'Response' }}
  2396. {
  2397. "data": [
  2398. {
  2399. "provider": "zhipuai",
  2400. "label": {
  2401. "zh_Hans": "智谱 AI",
  2402. "en_US": "ZHIPU AI"
  2403. },
  2404. "icon_small": {
  2405. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/zh_Hans",
  2406. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_small/en_US"
  2407. },
  2408. "icon_large": {
  2409. "zh_Hans": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/zh_Hans",
  2410. "en_US": "http://127.0.0.1:5001/console/api/workspaces/current/model-providers/zhipuai/icon_large/en_US"
  2411. },
  2412. "status": "active",
  2413. "models": [
  2414. {
  2415. "model": "embedding-3",
  2416. "label": {
  2417. "zh_Hans": "embedding-3",
  2418. "en_US": "embedding-3"
  2419. },
  2420. "model_type": "text-embedding",
  2421. "features": null,
  2422. "fetch_from": "predefined-model",
  2423. "model_properties": {
  2424. "context_size": 8192
  2425. },
  2426. "deprecated": false,
  2427. "status": "active",
  2428. "load_balancing_enabled": false
  2429. },
  2430. {
  2431. "model": "embedding-2",
  2432. "label": {
  2433. "zh_Hans": "embedding-2",
  2434. "en_US": "embedding-2"
  2435. },
  2436. "model_type": "text-embedding",
  2437. "features": null,
  2438. "fetch_from": "predefined-model",
  2439. "model_properties": {
  2440. "context_size": 8192
  2441. },
  2442. "deprecated": false,
  2443. "status": "active",
  2444. "load_balancing_enabled": false
  2445. },
  2446. {
  2447. "model": "text_embedding",
  2448. "label": {
  2449. "zh_Hans": "text_embedding",
  2450. "en_US": "text_embedding"
  2451. },
  2452. "model_type": "text-embedding",
  2453. "features": null,
  2454. "fetch_from": "predefined-model",
  2455. "model_properties": {
  2456. "context_size": 512
  2457. },
  2458. "deprecated": false,
  2459. "status": "active",
  2460. "load_balancing_enabled": false
  2461. }
  2462. ]
  2463. }
  2464. ]
  2465. }
  2466. ```
  2467. </CodeGroup>
  2468. </Col>
  2469. </Row>
  2470. <hr className='ml-0 mr-0' />
  2471. <Heading
  2472. url='/datasets/tags'
  2473. method='POST'
  2474. title='新增知识库类型标签'
  2475. name='#create_new_knowledge_tag'
  2476. />
  2477. <Row>
  2478. <Col>
  2479. ### Request Body
  2480. <Properties>
  2481. <Property name='name' type='string'>
  2482. (text) 新标签名称,必填,最大长度为 50
  2483. </Property>
  2484. </Properties>
  2485. </Col>
  2486. <Col sticky>
  2487. <CodeGroup
  2488. title="Request"
  2489. tag="POST"
  2490. label="/datasets/tags"
  2491. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag1"}'`}
  2492. >
  2493. ```bash {{ title: 'cURL' }}
  2494. curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \
  2495. --header 'Authorization: Bearer {api_key}' \
  2496. --header 'Content-Type: application/json' \
  2497. --data-raw '{"name": "testtag1"}'
  2498. ```
  2499. </CodeGroup>
  2500. <CodeGroup title="Response">
  2501. ```json {{ title: 'Response' }}
  2502. {
  2503. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2504. "name": "testtag1",
  2505. "type": "knowledge",
  2506. "binding_count": 0
  2507. }
  2508. ```
  2509. </CodeGroup>
  2510. </Col>
  2511. </Row>
  2512. <hr className='ml-0 mr-0' />
  2513. <Heading
  2514. url='/datasets/tags'
  2515. method='GET'
  2516. title='获取知识库类型标签'
  2517. name='#get_knowledge_type_tags'
  2518. />
  2519. <Row>
  2520. <Col>
  2521. ### Request Body
  2522. </Col>
  2523. <Col sticky>
  2524. <CodeGroup
  2525. title="Request"
  2526. tag="GET"
  2527. label="/datasets/tags"
  2528. targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
  2529. >
  2530. ```bash {{ title: 'cURL' }}
  2531. curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \
  2532. --header 'Authorization: Bearer {api_key}' \
  2533. --header 'Content-Type: application/json'
  2534. ```
  2535. </CodeGroup>
  2536. <CodeGroup title="Response">
  2537. ```json {{ title: 'Response' }}
  2538. [
  2539. {
  2540. "id": "39d6934c-ed36-463d-b4a7-377fa1503dc0",
  2541. "name": "testtag1",
  2542. "type": "knowledge",
  2543. "binding_count": "0"
  2544. },
  2545. ...
  2546. ]
  2547. ```
  2548. </CodeGroup>
  2549. </Col>
  2550. </Row>
  2551. <hr className='ml-0 mr-0' />
  2552. <Heading
  2553. url='/datasets/tags'
  2554. method='PATCH'
  2555. title='修改知识库类型标签名称'
  2556. name='#modify_knowledge_tag_name'
  2557. />
  2558. <Row>
  2559. <Col>
  2560. ### Request Body
  2561. <Properties>
  2562. <Property name='name' type='string'>
  2563. (text) 修改后的标签名称,必填,最大长度为 50
  2564. </Property>
  2565. <Property name='tag_id' type='string'>
  2566. (text) 标签 ID,必填
  2567. </Property>
  2568. </Properties>
  2569. </Col>
  2570. <Col sticky>
  2571. <CodeGroup
  2572. title="Request"
  2573. tag="PATCH"
  2574. label="/datasets/tags"
  2575. targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
  2576. >
  2577. ```bash {{ title: 'cURL' }}
  2578. curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \
  2579. --header 'Authorization: Bearer {api_key}' \
  2580. --header 'Content-Type: application/json' \
  2581. --data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2582. ```
  2583. </CodeGroup>
  2584. <CodeGroup title="Response">
  2585. ```json {{ title: 'Response' }}
  2586. {
  2587. "id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
  2588. "name": "tag-renamed",
  2589. "type": "knowledge",
  2590. "binding_count": 0
  2591. }
  2592. ```
  2593. </CodeGroup>
  2594. </Col>
  2595. </Row>
  2596. <hr className='ml-0 mr-0' />
  2597. <Heading
  2598. url='/datasets/tags'
  2599. method='DELETE'
  2600. title='删除知识库类型标签'
  2601. name='#delete_knowledge_tag'
  2602. />
  2603. <Row>
  2604. <Col>
  2605. ### Request Body
  2606. <Properties>
  2607. <Property name='tag_id' type='string'>
  2608. (text) 标签 ID,必填
  2609. </Property>
  2610. </Properties>
  2611. </Col>
  2612. <Col sticky>
  2613. <CodeGroup
  2614. title="Request"
  2615. tag="DELETE"
  2616. label="/datasets/tags"
  2617. targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
  2618. >
  2619. ```bash {{ title: 'cURL' }}
  2620. curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \
  2621. --header 'Authorization: Bearer {api_key}' \
  2622. --header 'Content-Type: application/json' \
  2623. --data-raw '{"tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
  2624. ```
  2625. </CodeGroup>
  2626. <CodeGroup title="Response">
  2627. ```json {{ title: 'Response' }}
  2628. {"result": "success"}
  2629. ```
  2630. </CodeGroup>
  2631. </Col>
  2632. </Row>
  2633. <hr className='ml-0 mr-0' />
  2634. <Heading
  2635. url='/datasets/tags/binding'
  2636. method='POST'
  2637. title='绑定知识库到知识库类型标签'
  2638. name='#bind_dataset_to_knowledge_tag'
  2639. />
  2640. <Row>
  2641. <Col>
  2642. ### Request Body
  2643. <Properties>
  2644. <Property name='tag_ids' type='list'>
  2645. (list) 标签 ID 列表,必填
  2646. </Property>
  2647. <Property name='target_id' type='string'>
  2648. (text) 知识库 ID,必填
  2649. </Property>
  2650. </Properties>
  2651. </Col>
  2652. <Col sticky>
  2653. <CodeGroup
  2654. title="Request"
  2655. tag="POST"
  2656. label="/datasets/tags/binding"
  2657. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
  2658. >
  2659. ```bash {{ title: 'cURL' }}
  2660. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \
  2661. --header 'Authorization: Bearer {api_key}' \
  2662. --header 'Content-Type: application/json' \
  2663. --data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2664. ```
  2665. </CodeGroup>
  2666. <CodeGroup title="Response">
  2667. ```json {{ title: 'Response' }}
  2668. {"result": "success"}
  2669. ```
  2670. </CodeGroup>
  2671. </Col>
  2672. </Row>
  2673. <hr className='ml-0 mr-0' />
  2674. <Heading
  2675. url='/datasets/tags/unbinding'
  2676. method='POST'
  2677. title='解绑知识库和知识库类型标签'
  2678. name='#unbind_dataset_and_knowledge_tag'
  2679. />
  2680. <Row>
  2681. <Col>
  2682. ### Request Body
  2683. <Properties>
  2684. <Property name='tag_id' type='string'>
  2685. (text) 标签 ID,必填
  2686. </Property>
  2687. <Property name='target_id' type='string'>
  2688. (text) 知识库 ID,必填
  2689. </Property>
  2690. </Properties>
  2691. </Col>
  2692. <Col sticky>
  2693. <CodeGroup
  2694. title="Request"
  2695. tag="POST"
  2696. label="/datasets/tags/unbinding"
  2697. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
  2698. >
  2699. ```bash {{ title: 'cURL' }}
  2700. curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \
  2701. --header 'Authorization: Bearer {api_key}' \
  2702. --header 'Content-Type: application/json' \
  2703. --data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
  2704. ```
  2705. </CodeGroup>
  2706. <CodeGroup title="Response">
  2707. ```json {{ title: 'Response' }}
  2708. {"result": "success"}
  2709. ```
  2710. </CodeGroup>
  2711. </Col>
  2712. </Row>
  2713. <hr className='ml-0 mr-0' />
  2714. <Heading
  2715. url='/datasets/<uuid:dataset_id>/tags'
  2716. method='POST'
  2717. title='查询知识库已绑定的标签'
  2718. name='#query_dataset_tags'
  2719. />
  2720. <Row>
  2721. <Col>
  2722. ### Path
  2723. <Properties>
  2724. <Property name='dataset_id' type='string'>
  2725. (text) 知识库 ID
  2726. </Property>
  2727. </Properties>
  2728. </Col>
  2729. <Col sticky>
  2730. <CodeGroup
  2731. title="Request"
  2732. tag="POST"
  2733. label="/datasets/<uuid:dataset_id>/tags"
  2734. targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n`}
  2735. >
  2736. ```bash {{ title: 'cURL' }}
  2737. curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \
  2738. --header 'Authorization: Bearer {api_key}' \
  2739. --header 'Content-Type: application/json' \
  2740. ```
  2741. </CodeGroup>
  2742. <CodeGroup title="Response">
  2743. ```json {{ title: 'Response' }}
  2744. {
  2745. "data":
  2746. [
  2747. {"id": "4a601f4f-f8a2-4166-ae7c-58c3b252a524",
  2748. "name": "123"
  2749. },
  2750. ...
  2751. ],
  2752. "total": 3
  2753. }
  2754. ```
  2755. </CodeGroup>
  2756. </Col>
  2757. </Row>
  2758. <hr className='ml-0 mr-0' />
  2759. <Row>
  2760. <Col>
  2761. ### 错误信息
  2762. <Properties>
  2763. <Property name='code' type='string' key='code'>
  2764. 返回的错误代码
  2765. </Property>
  2766. </Properties>
  2767. <Properties>
  2768. <Property name='status' type='number' key='status'>
  2769. 返回的错误状态
  2770. </Property>
  2771. </Properties>
  2772. <Properties>
  2773. <Property name='message' type='string' key='message'>
  2774. 返回的错误信息
  2775. </Property>
  2776. </Properties>
  2777. </Col>
  2778. <Col>
  2779. <CodeGroup title="Example">
  2780. ```json {{ title: 'Response' }}
  2781. {
  2782. "code": "no_file_uploaded",
  2783. "message": "Please upload your file.",
  2784. "status": 400
  2785. }
  2786. ```
  2787. </CodeGroup>
  2788. </Col>
  2789. </Row>
  2790. <table className="max-w-auto border-collapse border border-slate-400" style={{ maxWidth: 'none', width: 'auto' }}>
  2791. <thead style={{ background: '#f9fafc' }}>
  2792. <tr>
  2793. <th className="p-2 border border-slate-300">code</th>
  2794. <th className="p-2 border border-slate-300">status</th>
  2795. <th className="p-2 border border-slate-300">message</th>
  2796. </tr>
  2797. </thead>
  2798. <tbody>
  2799. <tr>
  2800. <td className="p-2 border border-slate-300">no_file_uploaded</td>
  2801. <td className="p-2 border border-slate-300">400</td>
  2802. <td className="p-2 border border-slate-300">Please upload your file.</td>
  2803. </tr>
  2804. <tr>
  2805. <td className="p-2 border border-slate-300">too_many_files</td>
  2806. <td className="p-2 border border-slate-300">400</td>
  2807. <td className="p-2 border border-slate-300">Only one file is allowed.</td>
  2808. </tr>
  2809. <tr>
  2810. <td className="p-2 border border-slate-300">file_too_large</td>
  2811. <td className="p-2 border border-slate-300">413</td>
  2812. <td className="p-2 border border-slate-300">File size exceeded.</td>
  2813. </tr>
  2814. <tr>
  2815. <td className="p-2 border border-slate-300">unsupported_file_type</td>
  2816. <td className="p-2 border border-slate-300">415</td>
  2817. <td className="p-2 border border-slate-300">File type not allowed.</td>
  2818. </tr>
  2819. <tr>
  2820. <td className="p-2 border border-slate-300">high_quality_dataset_only</td>
  2821. <td className="p-2 border border-slate-300">400</td>
  2822. <td className="p-2 border border-slate-300">Current operation only supports 'high-quality' datasets.</td>
  2823. </tr>
  2824. <tr>
  2825. <td className="p-2 border border-slate-300">dataset_not_initialized</td>
  2826. <td className="p-2 border border-slate-300">400</td>
  2827. <td className="p-2 border border-slate-300">The dataset is still being initialized or indexing. Please wait a moment.</td>
  2828. </tr>
  2829. <tr>
  2830. <td className="p-2 border border-slate-300">archived_document_immutable</td>
  2831. <td className="p-2 border border-slate-300">403</td>
  2832. <td className="p-2 border border-slate-300">The archived document is not editable.</td>
  2833. </tr>
  2834. <tr>
  2835. <td className="p-2 border border-slate-300">dataset_name_duplicate</td>
  2836. <td className="p-2 border border-slate-300">409</td>
  2837. <td className="p-2 border border-slate-300">The dataset name already exists. Please modify your dataset name.</td>
  2838. </tr>
  2839. <tr>
  2840. <td className="p-2 border border-slate-300">invalid_action</td>
  2841. <td className="p-2 border border-slate-300">400</td>
  2842. <td className="p-2 border border-slate-300">Invalid action.</td>
  2843. </tr>
  2844. <tr>
  2845. <td className="p-2 border border-slate-300">document_already_finished</td>
  2846. <td className="p-2 border border-slate-300">400</td>
  2847. <td className="p-2 border border-slate-300">The document has been processed. Please refresh the page or go to the document details.</td>
  2848. </tr>
  2849. <tr>
  2850. <td className="p-2 border border-slate-300">document_indexing</td>
  2851. <td className="p-2 border border-slate-300">400</td>
  2852. <td className="p-2 border border-slate-300">The document is being processed and cannot be edited.</td>
  2853. </tr>
  2854. <tr>
  2855. <td className="p-2 border border-slate-300">invalid_metadata</td>
  2856. <td className="p-2 border border-slate-300">400</td>
  2857. <td className="p-2 border border-slate-300">The metadata content is incorrect. Please check and verify.</td>
  2858. </tr>
  2859. </tbody>
  2860. </table>
  2861. <div className="pb-4" />