@gientech/modual 1.9.3 → 1.9.4-fix.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/.editorconfig +38 -0
  2. package/.prettierignore +16 -0
  3. package/.prettierrc +17 -0
  4. package/USAGE.md +247 -0
  5. package/bash.exe.stackdump +40 -0
  6. package/components.json +21 -0
  7. package/dist/README.md +643 -0
  8. package/dist/assets/GientechStreamReader-DydY9Vu3.js +449 -0
  9. package/{assets/index-D72cKELw.js → dist/assets/index-4Ac00q5P.js} +1 -1
  10. package/{assets/index-BKe5FgcC.js → dist/assets/index-7FYeBShT.js} +1 -1
  11. package/dist/assets/index-B2rczyCX.js +1393 -0
  12. package/{assets/index-j0kQJd0a.js → dist/assets/index-CQMGllKT.js} +1 -1
  13. package/{assets/index-JwQuPQqQ.js → dist/assets/index-CwGOSlVC.js} +5 -5
  14. package/{assets/index-DwoTKC3G.js → dist/assets/index-DBPtDW8Y.js} +1 -1
  15. package/{assets/index-x8IlxRuv.js → dist/assets/index-DJPAws60.js} +72 -72
  16. package/{assets/index-g-SUxfJH.js → dist/assets/index-antI2hFx.js} +45 -45
  17. package/{assets/index-DdVFXD_y.js → dist/assets/index-q0nZjKAG.js} +1 -1
  18. package/{assets/index-CIwaLPGb.js → dist/assets/index-rkRJ-e_U.js} +1 -1
  19. package/{assets/plus-V9zUoSq6.js → dist/assets/plus-qlmqrjBc.js} +1 -1
  20. package/{assets/style-CGmZ5osp.js → dist/assets/style-BeYL_E4J.js} +1 -1
  21. package/dist/assets/style.css +1 -0
  22. package/dist/assets/style4.css +1 -0
  23. package/{assets/x-CnaaLGJF.js → dist/assets/x-DxuhxSb6.js} +1 -1
  24. package/dist/assistantConfig.js +1 -0
  25. package/dist/chat.js +815 -0
  26. package/{database.js → dist/database.js} +2 -2
  27. package/dist/databaseId.js +1 -0
  28. package/{databaseTable.js → dist/databaseTable.js} +1 -1
  29. package/dist/index.js +1 -0
  30. package/dist/modelManage.js +1 -0
  31. package/dist/package.json +68 -0
  32. package/{sensitive.js → dist/sensitive.js} +1 -1
  33. package/dist/streamFilesReader.js +1 -0
  34. package/doc_assets/2.png +0 -0
  35. package/doc_assets/demo.md +27 -0
  36. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +2 -0
  37. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +23699 -0
  38. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +1 -0
  39. package/doc_assets/demos/dist-app/index.html +14 -0
  40. package/doc_assets/demos/dist-app/vite.svg +1 -0
  41. package/doc_assets/images/1.png +0 -0
  42. package/doc_assets/images/3.png +0 -0
  43. package/doc_assets/images/component-screenshot.png +1 -0
  44. package/doc_assets/install.md +5 -0
  45. package/doc_assets//346/226/271/346/241/210//344/274/230/345/214/226/346/226/271/346/241/210-/345/244/232/344/274/232/350/257/235SSE/350/277/236/346/216/245/347/256/241/347/220/206.md +504 -0
  46. package/eslint.config.js +92 -0
  47. package/index.html +13 -0
  48. package/package.json +106 -43
  49. package/package.json.demo-backup +109 -0
  50. package/postcss.config.cjs +19 -0
  51. package/public/icons/answerAwartar.png +0 -0
  52. package/public/icons/docx-file.png +0 -0
  53. package/public/icons/folder.png +0 -0
  54. package/public/icons/html.png +0 -0
  55. package/public/icons/image.png +0 -0
  56. package/public/icons/jpg-file.png +0 -0
  57. package/public/icons/json.png +0 -0
  58. package/public/icons/md.png +0 -0
  59. package/public/icons/pdf.png +0 -0
  60. package/public/icons/pptx.png +0 -0
  61. package/public/icons/questionAwartar.png +0 -0
  62. package/public/icons/sheets.png +0 -0
  63. package/public/icons/txt.png +0 -0
  64. package/public/icons/xlsx.png +0 -0
  65. package/public/vite.svg +1 -0
  66. package/public/worker/pdf.worker.min.js +22 -0
  67. package/rag/assets/Doris.3ZRHc3Fu.png +0 -0
  68. package/rag/assets/PostgreSQL.DuLqLAFX.png +0 -0
  69. package/rag/assets/SQLServer.CWyNu24v.png +0 -0
  70. package/rag/assets/empty.BfkDKJsb.png +0 -0
  71. package/rag/assets/homeBg.Mr_kGuA9.png +0 -0
  72. package/rag/assets/index.Bd0tNzw0.js +2797 -0
  73. package/rag/assets/index.D6t67hlu.css +1 -0
  74. package/rag/assets/left.KBHV5h7q.jpg +0 -0
  75. package/rag/assets/logoImg.Gmp_tdkD.png +0 -0
  76. package/rag/assets/worker-BbpylX7l.DptbXke_.js +13 -0
  77. package/rag/icons/answerAwartar.png +0 -0
  78. package/rag/icons/docx-file.png +0 -0
  79. package/rag/icons/folder.png +0 -0
  80. package/rag/icons/html.png +0 -0
  81. package/rag/icons/image.png +0 -0
  82. package/rag/icons/jpg-file.png +0 -0
  83. package/rag/icons/json.png +0 -0
  84. package/rag/icons/md.png +0 -0
  85. package/rag/icons/pdf.png +0 -0
  86. package/rag/icons/pptx.png +0 -0
  87. package/rag/icons/questionAwartar.png +0 -0
  88. package/rag/icons/sheets.png +0 -0
  89. package/rag/icons/txt.png +0 -0
  90. package/rag/icons/xlsx.png +0 -0
  91. package/scripts/README.md +133 -0
  92. package/scripts/build-demo.js +88 -0
  93. package/scripts/decrypt-api-key.js +95 -0
  94. package/scripts/demo-selector.js +216 -0
  95. package/scripts/dev-demo.js +76 -0
  96. package/scripts/preview-demo.js +130 -0
  97. package/scripts/run-demo.bat +34 -0
  98. package/src/assets/img/close.png +0 -0
  99. package/src/assets/img/database.png +0 -0
  100. package/src/assets/img/downArrow.png +0 -0
  101. package/src/assets/img/downLoad.png +0 -0
  102. package/src/assets/img/excel.png +0 -0
  103. package/src/assets/img/graphIcon.png +0 -0
  104. package/src/assets/img/img.png +0 -0
  105. package/src/assets/img/pdf.png +0 -0
  106. package/src/assets/img/ppt.png +0 -0
  107. package/src/assets/img/singleQa.png +0 -0
  108. package/src/assets/img/txt.png +0 -0
  109. package/src/assets/img/webSearch.png +0 -0
  110. package/src/assets/img/word.png +0 -0
  111. package/src/assets/login/homeBg.png +0 -0
  112. package/src/assets/login/left.jpg +0 -0
  113. package/src/assets/login/logoImg.png +0 -0
  114. package/src/examples/ConversationAssistantPage/index.tsx +41 -0
  115. package/src/examples/Demo/index.tsx +12 -0
  116. package/src/examples/LoginPage/index.tsx +18 -0
  117. package/src/examples/chat/components/DrawerGraphPreview.tsx +78 -0
  118. package/src/examples/chat/index.tsx +162 -0
  119. package/src/examples/chat/logo03.png +0 -0
  120. package/src/examples/gientechStreamFilesReader/index.tsx +951 -0
  121. package/src/examples/headlessChat/index.tsx +218 -0
  122. package/src/examples/ragDatabaseDataPage/index.tsx +40 -0
  123. package/src/examples/ragDatabaseIdPage/index.tsx +47 -0
  124. package/src/examples/ragDatabasePage/index.tsx +36 -0
  125. package/src/examples/ragModelManagePage/index.tsx +37 -0
  126. package/src/examples/ragSearchPage/index.tsx +0 -0
  127. package/src/examples/ragSensitiveWordsPage/index.tsx +32 -0
  128. package/src/examples/streamFiles/index.tsx +417 -0
  129. package/src/lib_enter.ts +43 -0
  130. package/src/main.tsx +5 -0
  131. package/src/main.tsx.backup +5 -0
  132. package/src/modules/assistantConfig/assets/databse.svg +6 -0
  133. package/src/modules/assistantConfig/assets/empty.png +0 -0
  134. package/src/modules/assistantConfig/assets/graph.svg +4 -0
  135. package/src/modules/assistantConfig/assets/knowledge.svg +4 -0
  136. package/src/modules/assistantConfig/assets/sensitive.svg +5 -0
  137. package/src/modules/assistantConfig/components/Database.tsx +171 -0
  138. package/src/modules/assistantConfig/components/Graph.tsx +177 -0
  139. package/src/modules/assistantConfig/components/Knowledge.tsx +276 -0
  140. package/src/modules/assistantConfig/components/NotFoundContent.tsx +21 -0
  141. package/src/modules/assistantConfig/components/Paragraph.tsx +51 -0
  142. package/src/modules/assistantConfig/components/ParamsItem.tsx +39 -0
  143. package/src/modules/assistantConfig/components/ResourceBinderItem.tsx +133 -0
  144. package/src/modules/assistantConfig/components/SearchableSelector.tsx +500 -0
  145. package/src/modules/assistantConfig/components/Sensitive.tsx +221 -0
  146. package/src/modules/assistantConfig/components/SliderInput.tsx +65 -0
  147. package/src/modules/assistantConfig/constants.tsx +75 -0
  148. package/src/modules/assistantConfig/index.tsx +706 -0
  149. package/src/modules/assistantConfig/server.ts +262 -0
  150. package/src/modules/chat/Conversations/Item.tsx +167 -0
  151. package/src/modules/chat/Conversations/List.tsx +210 -0
  152. package/src/modules/chat/Conversations/groupByTime.ts +39 -0
  153. package/src/modules/chat/Conversations/index.tsx +252 -0
  154. package/src/modules/chat/ReferenceBar.tsx +622 -0
  155. package/src/modules/chat/constants.tsx +56 -0
  156. package/src/modules/chat/data.txt +82 -0
  157. package/src/modules/chat/index.tsx +2087 -0
  158. package/src/modules/chat/referenceCom/DeleteModal.tsx +75 -0
  159. package/src/modules/chat/referenceCom/DrawerContent.tsx +136 -0
  160. package/src/modules/chat/referenceCom/DrawerDatabase.tsx +102 -0
  161. package/src/modules/chat/referenceCom/DrawerGraphPreview.tsx +86 -0
  162. package/src/modules/chat/referenceCom/DrawerPreview.tsx +73 -0
  163. package/src/modules/chat/referenceCom/DrawerTitle.tsx +26 -0
  164. package/src/modules/chat/referenceCom/RenameModal.tsx +86 -0
  165. package/src/modules/chat/referenceCom/TagCom.tsx +30 -0
  166. package/src/modules/chat/style.less +3 -0
  167. package/src/modules/chat/types.ts +17 -0
  168. package/src/modules/chat/utils/index.ts +348 -0
  169. package/src/modules/database/CreateModal.tsx +403 -0
  170. package/src/modules/database/assets/Doris.png +0 -0
  171. package/src/modules/database/assets/PostgreSQL.png +0 -0
  172. package/src/modules/database/assets/SQLServer.png +0 -0
  173. package/src/modules/database/assets/database.svg +11 -0
  174. package/src/modules/database/assets/database_add.svg +53 -0
  175. package/src/modules/database/assets/database_connect.svg +66 -0
  176. package/src/modules/database/assets/database_upload.svg +29 -0
  177. package/src/modules/database/assets/empty.png +0 -0
  178. package/src/modules/database/assets/mysql.svg +14 -0
  179. package/src/modules/database/index.tsx +477 -0
  180. package/src/modules/database/server.ts +196 -0
  181. package/src/modules/databaseId/CustomCom.tsx +156 -0
  182. package/src/modules/databaseId/EditConfig.tsx +280 -0
  183. package/src/modules/databaseId/UploadDrawer.tsx +535 -0
  184. package/src/modules/databaseId/assets/aiOptimize.svg +10 -0
  185. package/src/modules/databaseId/assets/empty.png +0 -0
  186. package/src/modules/databaseId/assets/template.svg +6 -0
  187. package/src/modules/databaseId/assets/upload.svg +9 -0
  188. package/src/modules/databaseId/assets/useTemp.svg +6 -0
  189. package/src/modules/databaseId/index.tsx +769 -0
  190. package/src/modules/databaseId/server.ts +286 -0
  191. package/src/modules/databaseId/style.css +5 -0
  192. package/src/modules/databaseTable/EditRowDrawer.tsx +124 -0
  193. package/src/modules/databaseTable/index.tsx +359 -0
  194. package/src/modules/databaseTable/server.ts +180 -0
  195. package/src/modules/headlessChat/ReferenceBar.tsx +783 -0
  196. package/src/modules/headlessChat/constants.tsx +32 -0
  197. package/src/modules/headlessChat/index.tsx +1411 -0
  198. package/src/modules/headlessChat/referenceCom/DeleteModal.tsx +75 -0
  199. package/src/modules/headlessChat/referenceCom/DrawerContent.tsx +136 -0
  200. package/src/modules/headlessChat/referenceCom/DrawerDatabase.tsx +102 -0
  201. package/src/modules/headlessChat/referenceCom/DrawerGraphPreview.tsx +86 -0
  202. package/src/modules/headlessChat/referenceCom/DrawerPreview.tsx +73 -0
  203. package/src/modules/headlessChat/referenceCom/DrawerTitle.tsx +26 -0
  204. package/src/modules/headlessChat/referenceCom/RenameModal.tsx +86 -0
  205. package/src/modules/headlessChat/referenceCom/TagCom.tsx +30 -0
  206. package/src/modules/headlessChat/style.less +3 -0
  207. package/src/modules/headlessChat/types.ts +23 -0
  208. package/src/modules/headlessChat/utils/index.ts +348 -0
  209. package/src/modules/login/components/Login/LoginBox/index.tsx +102 -0
  210. package/src/modules/login/components/Login/RegisterBox/index.tsx +180 -0
  211. package/src/modules/login/components/Login/index.tsx +100 -0
  212. package/src/modules/login/index.tsx +106 -0
  213. package/src/modules/login/style.css +3 -0
  214. package/src/modules/login/useServices.ts +53 -0
  215. package/src/modules/login/utils.ts +42 -0
  216. package/src/modules/modelManage/ConfigDrawer.tsx +249 -0
  217. package/src/modules/modelManage/ReplaceModal.tsx +124 -0
  218. package/src/modules/modelManage/assets/empty.png +0 -0
  219. package/src/modules/modelManage/const.ts +51 -0
  220. package/src/modules/modelManage/index.tsx +599 -0
  221. package/src/modules/modelManage/server.ts +223 -0
  222. package/src/modules/nodegraph/index.tsx +1 -0
  223. package/src/modules/search/assets/Icon-history.svg +8 -0
  224. package/src/modules/search/assets/answerAwartar.png +0 -0
  225. package/src/modules/search/assets/doc.png +0 -0
  226. package/src/modules/search/assets/genera.gif +0 -0
  227. package/src/modules/search/assets/icon-robot.svg +9 -0
  228. package/src/modules/search/assets/icon-search-bar.svg +14 -0
  229. package/src/modules/search/assets/icon-sub-title.svg +3 -0
  230. package/src/modules/search/assets/icon-title.svg +9 -0
  231. package/src/modules/search/assets/icon-zoomOut.svg +9 -0
  232. package/src/modules/search/assets/iconAi.svg +9 -0
  233. package/src/modules/search/assets/pdf.png +0 -0
  234. package/src/modules/search/assets/ppt.png +0 -0
  235. package/src/modules/search/assets/search.svg +3 -0
  236. package/src/modules/search/assets/selected.svg +4 -0
  237. package/src/modules/search/assets/txt.png +0 -0
  238. package/src/modules/search/assets/xls.png +0 -0
  239. package/src/modules/search/components/AssisSelect.tsx +137 -0
  240. package/src/modules/search/components/Editor/ChatViewEditor.tsx +261 -0
  241. package/src/modules/search/components/Editor/aichat.css +1 -0
  242. package/src/modules/search/components/Editor/constant.ts +13 -0
  243. package/src/modules/search/components/Editor/index.tsx +113 -0
  244. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +332 -0
  245. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +20 -0
  246. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +38 -0
  247. package/src/modules/search/components/Editor/plugins/displayer.ts +298 -0
  248. package/src/modules/search/components/Editor/plugins/imageClick.tsx +32 -0
  249. package/src/modules/search/components/Editor/plugins/myplugin.tsx +98 -0
  250. package/src/modules/search/components/Editor/ui/avatar.tsx +19 -0
  251. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +21 -0
  252. package/src/modules/search/components/Editor/ui/button.tsx +58 -0
  253. package/src/modules/search/components/Editor/ui/calendar.tsx +68 -0
  254. package/src/modules/search/components/Editor/ui/caption.tsx +46 -0
  255. package/src/modules/search/components/Editor/ui/checkbox.tsx +27 -0
  256. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +188 -0
  257. package/src/modules/search/components/Editor/ui/code-block-element.css +434 -0
  258. package/src/modules/search/components/Editor/ui/code-block-element.tsx +39 -0
  259. package/src/modules/search/components/Editor/ui/code-leaf.tsx +24 -0
  260. package/src/modules/search/components/Editor/ui/code-line-element.tsx +10 -0
  261. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +21 -0
  262. package/src/modules/search/components/Editor/ui/column-element.tsx +30 -0
  263. package/src/modules/search/components/Editor/ui/column-group-element.tsx +94 -0
  264. package/src/modules/search/components/Editor/ui/command.tsx +75 -0
  265. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +22 -0
  266. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +37 -0
  267. package/src/modules/search/components/Editor/ui/comment-item.tsx +74 -0
  268. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +49 -0
  269. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +42 -0
  270. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +22 -0
  271. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +32 -0
  272. package/src/modules/search/components/Editor/ui/comment-value.tsx +34 -0
  273. package/src/modules/search/components/Editor/ui/comments-popover.tsx +63 -0
  274. package/src/modules/search/components/Editor/ui/date-element.tsx +83 -0
  275. package/src/modules/search/components/Editor/ui/dialog.tsx +63 -0
  276. package/src/modules/search/components/Editor/ui/draggable.tsx +177 -0
  277. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +180 -0
  278. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +85 -0
  279. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +28 -0
  280. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +76 -0
  281. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +8 -0
  282. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +51 -0
  283. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +77 -0
  284. package/src/modules/search/components/Editor/ui/heading-element.tsx +48 -0
  285. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +17 -0
  286. package/src/modules/search/components/Editor/ui/hr-element.tsx +30 -0
  287. package/src/modules/search/components/Editor/ui/icons.tsx +267 -0
  288. package/src/modules/search/components/Editor/ui/image-element.tsx +74 -0
  289. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +368 -0
  290. package/src/modules/search/components/Editor/ui/input.tsx +25 -0
  291. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +218 -0
  292. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +20 -0
  293. package/src/modules/search/components/Editor/ui/link-element.tsx +29 -0
  294. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +161 -0
  295. package/src/modules/search/components/Editor/ui/list-element.tsx +30 -0
  296. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +24 -0
  297. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +133 -0
  298. package/src/modules/search/components/Editor/ui/media-popover.tsx +97 -0
  299. package/src/modules/search/components/Editor/ui/mention-element.tsx +43 -0
  300. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +141 -0
  301. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +93 -0
  302. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +67 -0
  303. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +4 -0
  304. package/src/modules/search/components/Editor/ui/placeholder.tsx +52 -0
  305. package/src/modules/search/components/Editor/ui/popover.tsx +32 -0
  306. package/src/modules/search/components/Editor/ui/resizable.tsx +66 -0
  307. package/src/modules/search/components/Editor/ui/separator.tsx +25 -0
  308. package/src/modules/search/components/Editor/ui/style.less +12 -0
  309. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +143 -0
  310. package/src/modules/search/components/Editor/ui/table-element.tsx +243 -0
  311. package/src/modules/search/components/Editor/ui/table-row-element.tsx +22 -0
  312. package/src/modules/search/components/Editor/ui/tableValue.tsx +135 -0
  313. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +43 -0
  314. package/src/modules/search/components/Editor/ui/toggle-element.tsx +31 -0
  315. package/src/modules/search/components/Editor/ui/toolbar.tsx +157 -0
  316. package/src/modules/search/components/Editor/ui/tooltip.tsx +65 -0
  317. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +160 -0
  318. package/src/modules/search/components/Editor/ui/with-draggables.tsx +175 -0
  319. package/src/modules/search/components/FileList.tsx +287 -0
  320. package/src/modules/search/components/ImageGroupView/index.tsx +85 -0
  321. package/src/modules/search/components/ResultContent.tsx +232 -0
  322. package/src/modules/search/components/SearchInput.tsx +232 -0
  323. package/src/modules/search/components/SearchLanding.tsx +74 -0
  324. package/src/modules/search/components/SearchView.tsx +563 -0
  325. package/src/modules/search/components/SimpleEditor.tsx +158 -0
  326. package/src/modules/search/components/SimpleFileList.tsx +215 -0
  327. package/src/modules/search/index.tsx +10 -0
  328. package/src/modules/search/reademe.md +1 -0
  329. package/src/modules/search/servers/apis.tsx +19 -0
  330. package/src/modules/search/servers/index.ts +184 -0
  331. package/src/modules/search/style.less +503 -0
  332. package/src/modules/search/type.ts +22 -0
  333. package/src/modules/search/utils.ts +34 -0
  334. package/src/modules/sensitive/index.tsx +313 -0
  335. package/src/modules/sensitive/server.ts +122 -0
  336. package/src/modules/streamFilesReader/GientechStreamReader.tsx +1625 -0
  337. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  338. package/src/modules/streamFilesReader/components/Header/index.tsx +297 -0
  339. package/src/modules/streamFilesReader/index.tsx +3 -0
  340. package/src/style.css +6 -0
  341. package/src/type.d.ts +0 -0
  342. package/src/utils/commonFn.tsx +111 -0
  343. package/src/utils/decryptApiKey.ts +40 -0
  344. package/src/utils/gientechCommon/components/AppError.tsx +32 -0
  345. package/src/utils/gientechCommon/components/AppLoading.tsx +75 -0
  346. package/src/utils/gientechCommon/components/DeleteModal.tsx +75 -0
  347. package/src/utils/gientechCommon/components/DisplayError.tsx +33 -0
  348. package/src/utils/gientechCommon/components/DisplayLoading.tsx +38 -0
  349. package/src/utils/gientechCommon/components/FeedBackModal.tsx +318 -0
  350. package/src/utils/gientechCommon/components/FileCardCommon.tsx +82 -0
  351. package/src/utils/gientechCommon/components/FileManager/index.tsx +390 -0
  352. package/src/utils/gientechCommon/components/FileManager/style.css +5 -0
  353. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +581 -0
  354. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +339 -0
  355. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +245 -0
  356. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +209 -0
  357. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  358. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +148 -0
  359. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +14 -0
  360. package/src/utils/gientechCommon/components/RenameModal.tsx +86 -0
  361. package/src/utils/gientechCommon/components/style.less +11 -0
  362. package/src/utils/gientechCommon/configs/commonConfig.ts +2 -0
  363. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  364. package/src/utils/gientechCommon/configs/stylesConfig.ts +142 -0
  365. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +417 -0
  366. package/src/utils/gientechCommon/slate/converters/deserializers.ts +763 -0
  367. package/src/utils/gientechCommon/slate/converters/mockData.ts +232 -0
  368. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +258 -0
  369. package/src/utils/gientechCommon/slate/richElements/index.tsx +499 -0
  370. package/src/utils/gientechCommon/utils/request.ts +37 -0
  371. package/src/utils/gientechCommon/utils/serverFn.ts +172 -0
  372. package/src/utils/index.tsx +132 -0
  373. package/src/utils/testconfigs/demologin/index.tsx +32 -0
  374. package/src/utils/testconfigs/index.ts +59 -0
  375. package/src/vite-env.d.ts +11 -0
  376. package/stats.html +4949 -0
  377. package/tailwind.config.js +170 -0
  378. package/tsconfig.app.json +30 -0
  379. package/tsconfig.app.tsbuildinfo +11 -0
  380. package/tsconfig.json +13 -0
  381. package/tsconfig.node.json +22 -0
  382. package/tsconfig.node.tsbuildinfo +1 -0
  383. package/vite.config.app.ts +93 -0
  384. package/vite.config.ts +231 -0
  385. package/workflows/release.yml +60 -0
  386. package//346/215/242/350/241/214/346/240/274/345/274/217/344/277/235/346/214/201/344/274/230/345/214/226/346/226/271/346/241/210.md +359 -0
  387. package/assets/GientechStreamReader-DqJjNXCO.js +0 -449
  388. package/assets/index-BO-w4FPz.js +0 -1088
  389. package/assets/style.css +0 -1
  390. package/assets/style4.css +0 -1
  391. package/assistantConfig.js +0 -1
  392. package/chat.js +0 -829
  393. package/databaseId.js +0 -1
  394. package/index.js +0 -1
  395. package/modelManage.js +0 -1
  396. package/streamFilesReader.js +0 -1
  397. /package/{assets → dist/assets}/Doris.png +0 -0
  398. /package/{assets → dist/assets}/PostgreSQL.png +0 -0
  399. /package/{assets → dist/assets}/SQLServer.png +0 -0
  400. /package/{assets → dist/assets}/database.svg +0 -0
  401. /package/{assets → dist/assets}/database_add.svg +0 -0
  402. /package/{assets → dist/assets}/database_connect.svg +0 -0
  403. /package/{assets → dist/assets}/database_upload.svg +0 -0
  404. /package/{assets → dist/assets}/databse.svg +0 -0
  405. /package/{assets → dist/assets}/defaultWeLogo.svg +0 -0
  406. /package/{assets → dist/assets}/empty.png +0 -0
  407. /package/{assets → dist/assets}/graph.svg +0 -0
  408. /package/{assets → dist/assets}/homeBg.png +0 -0
  409. /package/{assets → dist/assets}/index-CpW6Dhpp.js +0 -0
  410. /package/{assets → dist/assets}/knowledge.svg +0 -0
  411. /package/{assets → dist/assets}/left.jpg +0 -0
  412. /package/{assets → dist/assets}/logoImg.png +0 -0
  413. /package/{assets/MySQL.svg → dist/assets/mysql.svg} +0 -0
  414. /package/{assets → dist/assets}/sensitive.svg +0 -0
  415. /package/{assets → dist/assets}/style2.css +0 -0
  416. /package/{assets → dist/assets}/style3.css +0 -0
  417. /package/{assets → dist/assets}/worker-BbpylX7l.js +0 -0
  418. /package/{assistantConfig.d.ts → dist/assistantConfig.d.ts} +0 -0
  419. /package/{chat.d.ts → dist/chat.d.ts} +0 -0
  420. /package/{database.d.ts → dist/database.d.ts} +0 -0
  421. /package/{databaseId.d.ts → dist/databaseId.d.ts} +0 -0
  422. /package/{databaseTable.d.ts → dist/databaseTable.d.ts} +0 -0
  423. /package/{icons → dist/icons}/answerAwartar.png +0 -0
  424. /package/{icons → dist/icons}/docx-file.png +0 -0
  425. /package/{icons → dist/icons}/folder.png +0 -0
  426. /package/{icons → dist/icons}/html.png +0 -0
  427. /package/{icons → dist/icons}/image.png +0 -0
  428. /package/{icons → dist/icons}/jpg-file.png +0 -0
  429. /package/{icons → dist/icons}/json.png +0 -0
  430. /package/{icons → dist/icons}/md.png +0 -0
  431. /package/{icons → dist/icons}/pdf.png +0 -0
  432. /package/{icons → dist/icons}/pptx.png +0 -0
  433. /package/{icons → dist/icons}/questionAwartar.png +0 -0
  434. /package/{icons → dist/icons}/sheets.png +0 -0
  435. /package/{icons → dist/icons}/txt.png +0 -0
  436. /package/{icons → dist/icons}/xlsx.png +0 -0
  437. /package/{index.d.ts → dist/index.d.ts} +0 -0
  438. /package/{modelManage.d.ts → dist/modelManage.d.ts} +0 -0
  439. /package/{sensitive.d.ts → dist/sensitive.d.ts} +0 -0
  440. /package/{streamFilesReader.d.ts → dist/streamFilesReader.d.ts} +0 -0
  441. /package/{vite.svg → dist/vite.svg} +0 -0
  442. /package/{worker → dist/worker}/pdf.worker.min.js +0 -0
@@ -1 +1 @@
1
- import*as n from"react";import U from"react";import{u as X,t as Y,e as Z,f as O,C as ee}from"./index-g-SUxfJH.js";function $(e){return["small","middle","large"].includes(e)}function I(e){return e?typeof e=="number"&&!Number.isNaN(e):!1}const P=U.createContext({latestIndex:0}),te=P.Provider,se=({className:e,index:l,children:s,split:t,style:a})=>{const{latestIndex:o}=n.useContext(P);return s==null?null:n.createElement(n.Fragment,null,n.createElement("div",{className:e,style:a},s),l<o&&t&&n.createElement("span",{className:`${e}-split`},t))};var ae=function(e,l){var s={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&l.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a<t.length;a++)l.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(s[t[a]]=e[t[a]]);return s};const ne=n.forwardRef((e,l)=>{var s;const{getPrefixCls:t,direction:a,size:o,className:j,style:w,classNames:E,styles:V}=X("space"),{size:i=o??"small",align:C,className:h,rootClassName:_,children:A,direction:S="horizontal",prefixCls:k,split:G,style:R,wrap:H=!1,classNames:x,styles:g}=e,L=ae(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[m,u]=Array.isArray(i)?i:[i,i],v=$(u),N=$(m),F=I(u),M=I(m),p=Y(A,{keepEmpty:!0}),b=C===void 0&&S==="horizontal"?"center":C,r=t("space",k),[W,q,B]=Z(r),D=O(r,j,q,`${r}-${S}`,{[`${r}-rtl`]:a==="rtl",[`${r}-align-${b}`]:b,[`${r}-gap-row-${u}`]:v,[`${r}-gap-col-${m}`]:N},h,_,B),z=O(`${r}-item`,(s=x==null?void 0:x.item)!==null&&s!==void 0?s:E.item),J=Object.assign(Object.assign({},V.item),g==null?void 0:g.item),K=p.map((c,f)=>{const y=(c==null?void 0:c.key)||`${z}-${f}`;return n.createElement(se,{className:z,key:y,index:f,split:G,style:J},c)}),Q=n.useMemo(()=>({latestIndex:p.reduce((f,y,T)=>y!=null?T:f,0)}),[p]);if(p.length===0)return null;const d={};return H&&(d.flexWrap="wrap"),!N&&M&&(d.columnGap=m),!v&&F&&(d.rowGap=u),W(n.createElement("div",Object.assign({ref:l,className:D,style:Object.assign(Object.assign(Object.assign({},d),w),R)},L),n.createElement(te,{value:Q},K)))}),re=ne;re.Compact=ee;export{re as S};
1
+ import*as n from"react";import U from"react";import{u as X,t as Y,e as Z,f as O,C as ee}from"./index-antI2hFx.js";function $(e){return["small","middle","large"].includes(e)}function I(e){return e?typeof e=="number"&&!Number.isNaN(e):!1}const P=U.createContext({latestIndex:0}),te=P.Provider,se=({className:e,index:l,children:s,split:t,style:a})=>{const{latestIndex:o}=n.useContext(P);return s==null?null:n.createElement(n.Fragment,null,n.createElement("div",{className:e,style:a},s),l<o&&t&&n.createElement("span",{className:`${e}-split`},t))};var ae=function(e,l){var s={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&l.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a<t.length;a++)l.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(s[t[a]]=e[t[a]]);return s};const ne=n.forwardRef((e,l)=>{var s;const{getPrefixCls:t,direction:a,size:o,className:j,style:w,classNames:E,styles:V}=X("space"),{size:i=o??"small",align:C,className:h,rootClassName:_,children:A,direction:S="horizontal",prefixCls:k,split:G,style:R,wrap:H=!1,classNames:x,styles:g}=e,L=ae(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[m,u]=Array.isArray(i)?i:[i,i],v=$(u),N=$(m),F=I(u),M=I(m),p=Y(A,{keepEmpty:!0}),b=C===void 0&&S==="horizontal"?"center":C,r=t("space",k),[W,q,B]=Z(r),D=O(r,j,q,`${r}-${S}`,{[`${r}-rtl`]:a==="rtl",[`${r}-align-${b}`]:b,[`${r}-gap-row-${u}`]:v,[`${r}-gap-col-${m}`]:N},h,_,B),z=O(`${r}-item`,(s=x==null?void 0:x.item)!==null&&s!==void 0?s:E.item),J=Object.assign(Object.assign({},V.item),g==null?void 0:g.item),K=p.map((c,f)=>{const y=(c==null?void 0:c.key)||`${z}-${f}`;return n.createElement(se,{className:z,key:y,index:f,split:G,style:J},c)}),Q=n.useMemo(()=>({latestIndex:p.reduce((f,y,T)=>y!=null?T:f,0)}),[p]);if(p.length===0)return null;const d={};return H&&(d.flexWrap="wrap"),!N&&M&&(d.columnGap=m),!v&&F&&(d.rowGap=u),W(n.createElement("div",Object.assign({ref:l,className:D,style:Object.assign(Object.assign(Object.assign({},d),w),R)},L),n.createElement(te,{value:Q},K)))}),re=ne;re.Compact=ee;export{re as S};
@@ -1,4 +1,4 @@
1
- import{jsxs as i,jsx as e,Fragment as Me}from"react/jsx-runtime";import qe,{useState as _,forwardRef as He,useEffect as W,useMemo as ie,useImperativeHandle as Ve,useRef as ne}from"react";import{a as ge,a8 as ve,b as Ke,B as se,d as q,c as We,h as ke,i as O,F as de,a9 as _e,I as fe,S as Y,aa as Ze,ab as Ue,q as te,R as re,a6 as oe}from"./index-g-SUxfJH.js";import{X as Xe}from"./x-CnaaLGJF.js";import{P as Fe}from"./plus-V9zUoSq6.js";import{M as Ee,s as Be}from"./style-CGmZ5osp.js";import{S as Ge}from"./index-j0kQJd0a.js";/**
1
+ import{jsxs as c,jsx as e,Fragment as Me}from"react/jsx-runtime";import qe,{useState as _,forwardRef as He,useEffect as W,useMemo as ie,useImperativeHandle as Ve,useRef as ne}from"react";import{a as ge,a8 as ve,b as Ke,B as se,d as q,c as We,h as ke,i as O,F as ce,a9 as _e,I as fe,S as Y,aa as Ze,ab as Ue,q as te,R as re,a6 as pe}from"./index-antI2hFx.js";import{X as Xe}from"./x-DxuhxSb6.js";import{P as Fe}from"./plus-qlmqrjBc.js";import{M as Ee,s as Be}from"./style-BeYL_E4J.js";import{S as Ge}from"./index-CQMGllKT.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,7 +18,7 @@ import{jsxs as i,jsx as e,Fragment as Me}from"react/jsx-runtime";import qe,{useS
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const Ye=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),ye=({title:n,defaultExpanded:s=!0,className:a,children:u})=>{const[h,F]=_(s);return i("div",{className:a,children:[i("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[i("div",{className:"flex items-center",children:[e("div",{style:{width:"3px",height:"12px",backgroundColor:"#4E6EF2",borderRadius:"6px",marginRight:"6px"}}),e("div",{className:"font-bold",children:n})]}),h?e(De,{onClick:()=>F(b=>!b),color:"#4E6EF2",size:18}):e(ve,{onClick:()=>F(b=>!b),color:"#4E5969",size:18})]}),u?e("div",{style:{display:h?"block":"none"},children:u}):null]})},ce=()=>i("div",{className:"w-full h-[80px] rounded-md flex flex-col justify-center items-center",children:[e("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:i("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),i("g",{"fill-rule":"nonzero",stroke:"#d9d9d9",children:[e("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),e("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})}),e("div",{children:"\u6682\u65E0\u53EF\u7528\u6A21\u578B"})]}),Qe="\u63D0\u793A\u8BCD\u7528\u4E8E\u6307\u5B9A\u804A\u5929\u7684\u80CC\u666F\u548C\u4E0A\u4E0B\u6587\uFF0C\u6216\u8005\u8BA9\u52A9\u624B\u91C7\u53D6\u67D0\u4E2A\u4EBA\u683C\u6765\u56DE\u7B54\u4F60\u7684\u95EE\u9898\uFF1B",eu="\u5F00\u5173\u5F00\u542F\uFF0C\u5219\u82E5\u7CFB\u7EDF\u672A\u5728\u77E5\u8BC6\u5E93\u3001\u6570\u636E\u5E93\u7B49\u4F01\u4E1A\u77E5\u8BC6\u6570\u636E\u8303\u56F4\u5185\u68C0\u7D22\u5230\u7B54\u6848\uFF0C\u5219\u76F4\u63A5\u62D2\u7EDD\u56DE\u7B54\u76F8\u5173\u95EE\u9898\uFF1B",uu='\u4F60\u662F\u4E00\u4E2A\u667A\u80FD\u52A9\u624B\uFF0C\u8BF7\u603B\u7ED3\u77E5\u8BC6\u5E93\u7684\u5185\u5BB9\u6765\u56DE\u7B54\u95EE\u9898,\u8BF7\u5217\u4E3E\u77E5\u8BC6\u5E93\u4E2D\u7684\u6570\u636E\u8BE6\u7EC6\u56DE\u7B54\u3002\u5F53\u6240\u6709\u77E5\u8BC6\u5E93\u5185\u5BB9\u90FD\u4E0E\u95EE\u9898\u65E0\u5173\u65F6\uFF0C\u4F60\u7684\u56DE\u7B54\u5FC5\u987B\u5305\u62EC"\u77E5\u8BC6\u5E93\u4E2D\u672A\u627E\u5230\u60A8\u8981\u7684\u7B54\u6848!"',tu="\u60A8\u597D\uFF01\u6211\u6CE8\u610F\u5230\u60A8\u7684\u6D88\u606F\u4E2D\u53EF\u80FD\u5305\u542B\u4E86\u4E00\u4E9B\u654F\u611F\u7684\u5185\u5BB9\u3002\u4E3A\u4E86\u4FDD\u8BC1\u793E\u533A\u7684\u53CB\u597D\u6C1B\u56F4\uFF0C\u6211\u4EEC\u65E0\u6CD5\u7EE7\u7EED\u5C31\u6B64\u8BDD\u9898\u8FDB\u884C\u8BA8\u8BBA\u3002\u5982\u679C\u60A8\u6709\u5176\u4ED6\u95EE\u9898\u6216\u9700\u8981\u5E2E\u52A9\uFF0C\u6211\u5F88\u4E50\u610F\u7EE7\u7EED\u4E3A\u60A8\u670D\u52A1\uFF01\u8C22\u8C22\u60A8\u7684\u7406\u89E3\u548C\u652F\u6301\u3002",ue={top_k:{default:10,min:1,max:15,step:1,tooltip:"top_k\u4EE3\u8868\u6A21\u578B\u6700\u7EC8\u53D6\u4FE1\u7684\u6587\u672C\u5757\u6570\uFF0C\u4F8B\u5982\u95E8\u69DBtop_p = 0.8\uFF0Ctop_k = 3\uFF0C\u610F\u5473\u7740\u6A21\u578B\u4F1A\u4F9D\u636E\u76F8\u4F3C\u5EA6\u9AD8\u4F4E\u53D6\u524D3\u4E2A\u5927\u4E8E0.8\u7684\u6587\u672C\u5757\uFF0C\u5373\u4F7F\u5F53\u524D\u53EF\u80FD\u6709\u5927\u4E8E3\u4E2A\u6587\u672C\u5757\u7684\u76F8\u4F3C\u5EA6\u5927\u4E8E0.8\uFF1B"},max_tokens:{default:4096,min:0,max:1e4,step:64,tooltip:"max_tokens\u4EE3\u8868\u6A21\u578B\u7A97\u53E3\u5927\u5C0F\uFF0C\u5373\u4E00\u6B21\u95EE\u7B54\u5927\u6A21\u578B\u4E00\u6B21\u80FD\u591F\u63A5\u53D7\u7684\u5B57\u7B26\u4E32\u6700\u5927\u957F\u5EA6\uFF0C\u5305\u62EC\u7528\u6237\u7684\u63D0\u95EE\u548C\u6A21\u578B\u7684\u56DE\u7B54\uFF1B\u591A\u8F6E\u5BF9\u8BDD\u4E2D\u5386\u53F2\u5BF9\u8BDD\u5185\u5BB9\u4E5F\u5305\u62EC\u5728\u5185\uFF1B\u6700\u5927\u503C\u53D6\u51B3\u4E8E\u5927\u6A21\u578B\u672C\u8EAB\u662F\u5426\u652F\u6301\uFF1B"},max_round:{default:5,min:0,max:32,step:1,tooltip:"\u4EA4\u4E92\u5BF9\u8BDD\u573A\u666F\u91CC\uFF0C\u7CFB\u7EDF\u80FD\u591F\u8BB0\u5FC6\u5E76\u6709\u6548\u5173\u8054\u7684\u7528\u6237\u4E0E\u6A21\u578B\u4E4B\u95F4\u6765\u56DE\u4EA4\u6D41\u7684\u6700\u5927\u6B21\u6570\uFF1B"},temperature:{default:.3,min:.1,max:1,step:.1,tooltip:"\u6E29\u5EA6\u662F\u6A21\u578B\u56DE\u7B54\u7684\u503E\u5411\u6027\uFF0C\u53D6\u503C\u8303\u56F4\u4E00\u822C\u662F0\uFF5E1; \u53D6\u503C\u8D8B\u8FD10\u4EE3\u8868\u7740\u6A21\u578B\u56DE\u7B54\u4F1A\u66F4\u4E25\u8C28\uFF0C\u9002\u5408\u56DE\u7B54\u68C0\u7D22\u7C7B\u95EE\u9898; \u53D6\u503C\u8D8B\u8FD11\u5219\u4EE3\u8868\u56DE\u7B54\u66F4\u53D1\u6563\uFF0C\u9002\u5408\u56DE\u7B54\u521B\u65B0\u6027\u7684\u95EE\u9898\uFF1B"},top_p:{default:.8,min:.1,max:1,step:.1,tooltip:"top_p \u7528\u4E8E\u63A7\u5236\u5927\u6A21\u578B\u751F\u6210\u7B56\u7565\uFF0C\u51B3\u5B9A\u4E86\u6A21\u578B\u5728\u751F\u6210\u4E0B\u4E00\u4E2A\u8BCD\u65F6\uFF0C\u4ECE\u7D2F\u79EF\u6982\u7387\u8FBE\u5230 p \u7684\u6700\u5C0F\u8BCD\u96C6\u5408\u4E2D\u8FDB\u884C\u91C7\u6837\u3002\u901A\u5E38\u8BBE\u7F6E\u57280.8 - 0.95\u4E4B\u95F4\uFF0Ctop_p\u8D8A\u4F4E\u6A21\u578B\u7528\u8BCD\u8D8A\u4FDD\u5B88\uFF0C\u8D8A\u9AD8\u8D8A\u6D3B\u8DC3\u3002"},score_threshold:{default:.1,min:.1,max:1,step:.1,tooltip:"score_threshold\u53C2\u6570\u662F\u6A21\u578B\u8FDB\u884C\u91CD\u6392\u5E8F\u65F6\uFF0C\u5BF9\u4E8E\u6587\u672C\u5757\u53D6\u820D\u7684\u95E8\u69DB\u503C\uFF1B"}},nu={search_policy:1,enabled_rerank:!0,need_trace_source:!0,trace_by_llm:!0,is_download:!1,dependOnKb:0,enabled_faq:!1,enabled_graph:!1,enabled_question_rewrite:!1,isDefault:0},su=[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],ru=[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],he=({url:n,token:s,role:a,eventsEmit:u})=>{const h=Ke.create({baseURL:n,timeout:1e6});return h.interceptors.request.use(l=>{let t=s;return!t&&!["user/login","user/kaptcha","user/regist"].some(d=>l.url.includes(d))?(u&&u("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(l.headers.Authorization=t||"",l.headers.userName=a==="\u672A\u767B\u5F55\u7528\u6237"?"":a,l)}),h.interceptors.response.use(l=>{const t=["user/kaptcha"],r=l.data;if(t.some(D=>l.config.url&&l.config.url.includes(D))||r.size&&r.type)return r;const{success:d,errorMsg:E,errorCode:m}=r;if(d)return r;u&&u("request:error_business",{errorCode:m,errorMsg:E||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r})},l=>{var t,r,d,E,m,D,k,I,Z;if(l.message==="canceled")return Promise.reject(l);if(u){let g="request:error_network",A={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:l};((t=l==null?void 0:l.response)==null?void 0:t.status)===401?(g="request:error_auth",A={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:l,redirect:"/login"}):(((d=(r=l==null?void 0:l.response)==null?void 0:r.data)==null?void 0:d.errorCode)==="30013"||((m=(E=l==null?void 0:l.response)==null?void 0:E.data)==null?void 0:m.errorCode)==="30023")&&(g="request:error_business",A={errorCode:(k=(D=l==null?void 0:l.response)==null?void 0:D.data)==null?void 0:k.errorCode,errorMsg:((Z=(I=l==null?void 0:l.response)==null?void 0:I.data)==null?void 0:Z.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:l}),u(g,A)}return Promise.reject(l)}),{getConfigById:async l=>{try{const t=await h.get(`/qa/search/config/getById?configId=${l}`),{success:r,data:d}=t;return r?d:!1}catch(t){console.error("getConfigById",t)}},fetchDatabases:async()=>{try{const l=await h.get("/index/database/queryAllDBList"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchDatabases",l)}},fetchModels:async l=>{try{const t=await h.get(`/index/modelInfo/allPage?${new URLSearchParams(l).toString()}`),{success:r,data:d}=t;return r?d:!1}catch(t){return console.log("fetchModels error",t),!1}},fetchSensitiveLibrary:async l=>{try{const t=await h.get(`/sensitive/library?${new URLSearchParams(l).toString()}`),{success:r,data:d}=t;return r?d:!1}catch(t){return console.log("fetchSensitiveLibrary error",t),!1}},fetchConfigItemLimit:async()=>{try{const l=await h.get("/qa/search/config/configItemLimit"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchConfigItemLimit error",l)}},fetchKnowledgeBase:async l=>{try{const t=l?`?userName=${l}`:"";console.log("+++",t);const r=await h.get(`/index/knowledgeBase/searchList${t}`),{success:d,data:E}=r;return d?E:!1}catch(t){console.log("e",t)}},fetchGraphs:async()=>{try{const l=await h.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchGraphs",l)}},checkName:async(l,t)=>{try{const r=await h.get(`/qa/search/config/checkName?configName=${l}${t?`&configId=${t}`:""}`),{success:d,data:E}=r;if(d)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}},getBizLabelLabels:async l=>{try{const t=await h.post("/index/bizLabel/labels",l),{success:r,data:d}=t;if(r)return d}catch(t){return console.log("updateConversationAssistant error:",t),!1}},addConversationAssistant:async l=>{try{const t=await h.post("/qa/search/config/add",{...l}),{success:r,data:d}=t;if(r)return d}catch(t){return console.log("addConversationAssistant error:",t),!1}},updateConversationAssistant:async(l,t)=>{try{const r=await h.put("/qa/search/config/update",{id:l,...t}),{success:d,data:E}=r;if(d)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}}}},Ce=({countText:n,eventsEmit:s,data:a})=>{const[u,h]=_(!0);return i("div",{style:{marginTop:8},children:[n&&i("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:u?"#4E6EF2":"#4E5969"},children:n}),u?e(De,{onClick:()=>h(F=>!F),color:"#4E6EF2",size:14}):e(ve,{onClick:()=>h(F=>!F),color:"#4E5969",size:14})]}),e("div",{style:{display:u?"block":"none"},children:a.map(F=>e(au,{item:F,eventsEmit:s},F.key))})]})},au=({item:n,eventsEmit:s})=>{var h,F,b;const[a,u]=_(!0);return i("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[i("div",{children:[i("div",{style:{color:"#1D2129"},className:"flex items-center",children:[n.label,((h=n==null?void 0:n.tags)==null?void 0:h.length)>0&&i(Me,{children:[i("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(F=n==null?void 0:n.tags)==null?void 0:F.length,"\u4E2A\u6807\u7B7E)"]}),a?e(De,{onClick:()=>u(p=>!p),color:"#4E6EF2",size:14}):e(ve,{onClick:()=>u(p=>!p),color:"#4E5969",size:14})]})]}),((b=n==null?void 0:n.tags)==null?void 0:b.length)>0&&e("div",{className:"flex flex-wrap gap-4",style:{display:a?"block":"none",marginTop:8},children:((n==null?void 0:n.tags)||[]).map(p=>e(se,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(Xe,{size:14,color:"#86909C",onClick:()=>{const c={...n,tags:n.tags.filter(B=>B!==p)};s("removeTag",c)}}),children:p},p))})]}),e(se,{type:"text",icon:e(Oe,{size:14}),onClick:()=>s("removeItem",n)})]},n.key)},lu=q.div`
21
+ */const Ye=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),ye=({title:n,defaultExpanded:s=!0,className:a,children:u})=>{const[h,F]=_(s);return c("div",{className:a,children:[c("div",{className:"flex items-center justify-between",style:{marginBottom:"10px"},children:[c("div",{className:"flex items-center",children:[e("div",{style:{width:"3px",height:"12px",backgroundColor:"#4E6EF2",borderRadius:"6px",marginRight:"6px"}}),e("div",{className:"font-bold",children:n})]}),h?e(De,{onClick:()=>F(b=>!b),color:"#4E6EF2",size:18}):e(ve,{onClick:()=>F(b=>!b),color:"#4E5969",size:18})]}),u?e("div",{style:{display:h?"block":"none"},children:u}):null]})},oe=()=>c("div",{className:"w-full h-[80px] rounded-md flex flex-col justify-center items-center",children:[e("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:c("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd",children:[e("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),c("g",{"fill-rule":"nonzero",stroke:"#d9d9d9",children:[e("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),e("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})}),e("div",{children:"\u6682\u65E0\u53EF\u7528\u6A21\u578B"})]}),Qe="\u63D0\u793A\u8BCD\u7528\u4E8E\u6307\u5B9A\u804A\u5929\u7684\u80CC\u666F\u548C\u4E0A\u4E0B\u6587\uFF0C\u6216\u8005\u8BA9\u52A9\u624B\u91C7\u53D6\u67D0\u4E2A\u4EBA\u683C\u6765\u56DE\u7B54\u4F60\u7684\u95EE\u9898\uFF1B",eu="\u5F00\u5173\u5F00\u542F\uFF0C\u5219\u82E5\u7CFB\u7EDF\u672A\u5728\u77E5\u8BC6\u5E93\u3001\u6570\u636E\u5E93\u7B49\u4F01\u4E1A\u77E5\u8BC6\u6570\u636E\u8303\u56F4\u5185\u68C0\u7D22\u5230\u7B54\u6848\uFF0C\u5219\u76F4\u63A5\u62D2\u7EDD\u56DE\u7B54\u76F8\u5173\u95EE\u9898\uFF1B",uu='\u4F60\u662F\u4E00\u4E2A\u667A\u80FD\u52A9\u624B\uFF0C\u8BF7\u603B\u7ED3\u77E5\u8BC6\u5E93\u7684\u5185\u5BB9\u6765\u56DE\u7B54\u95EE\u9898,\u8BF7\u5217\u4E3E\u77E5\u8BC6\u5E93\u4E2D\u7684\u6570\u636E\u8BE6\u7EC6\u56DE\u7B54\u3002\u5F53\u6240\u6709\u77E5\u8BC6\u5E93\u5185\u5BB9\u90FD\u4E0E\u95EE\u9898\u65E0\u5173\u65F6\uFF0C\u4F60\u7684\u56DE\u7B54\u5FC5\u987B\u5305\u62EC"\u77E5\u8BC6\u5E93\u4E2D\u672A\u627E\u5230\u60A8\u8981\u7684\u7B54\u6848!"',tu="\u60A8\u597D\uFF01\u6211\u6CE8\u610F\u5230\u60A8\u7684\u6D88\u606F\u4E2D\u53EF\u80FD\u5305\u542B\u4E86\u4E00\u4E9B\u654F\u611F\u7684\u5185\u5BB9\u3002\u4E3A\u4E86\u4FDD\u8BC1\u793E\u533A\u7684\u53CB\u597D\u6C1B\u56F4\uFF0C\u6211\u4EEC\u65E0\u6CD5\u7EE7\u7EED\u5C31\u6B64\u8BDD\u9898\u8FDB\u884C\u8BA8\u8BBA\u3002\u5982\u679C\u60A8\u6709\u5176\u4ED6\u95EE\u9898\u6216\u9700\u8981\u5E2E\u52A9\uFF0C\u6211\u5F88\u4E50\u610F\u7EE7\u7EED\u4E3A\u60A8\u670D\u52A1\uFF01\u8C22\u8C22\u60A8\u7684\u7406\u89E3\u548C\u652F\u6301\u3002",ue={top_k:{default:10,min:1,max:15,step:1,tooltip:"top_k\u4EE3\u8868\u6A21\u578B\u6700\u7EC8\u53D6\u4FE1\u7684\u6587\u672C\u5757\u6570\uFF0C\u4F8B\u5982\u95E8\u69DBtop_p = 0.8\uFF0Ctop_k = 3\uFF0C\u610F\u5473\u7740\u6A21\u578B\u4F1A\u4F9D\u636E\u76F8\u4F3C\u5EA6\u9AD8\u4F4E\u53D6\u524D3\u4E2A\u5927\u4E8E0.8\u7684\u6587\u672C\u5757\uFF0C\u5373\u4F7F\u5F53\u524D\u53EF\u80FD\u6709\u5927\u4E8E3\u4E2A\u6587\u672C\u5757\u7684\u76F8\u4F3C\u5EA6\u5927\u4E8E0.8\uFF1B"},max_tokens:{default:4096,min:0,max:1e4,step:64,tooltip:"max_tokens\u4EE3\u8868\u6A21\u578B\u7A97\u53E3\u5927\u5C0F\uFF0C\u5373\u4E00\u6B21\u95EE\u7B54\u5927\u6A21\u578B\u4E00\u6B21\u80FD\u591F\u63A5\u53D7\u7684\u5B57\u7B26\u4E32\u6700\u5927\u957F\u5EA6\uFF0C\u5305\u62EC\u7528\u6237\u7684\u63D0\u95EE\u548C\u6A21\u578B\u7684\u56DE\u7B54\uFF1B\u591A\u8F6E\u5BF9\u8BDD\u4E2D\u5386\u53F2\u5BF9\u8BDD\u5185\u5BB9\u4E5F\u5305\u62EC\u5728\u5185\uFF1B\u6700\u5927\u503C\u53D6\u51B3\u4E8E\u5927\u6A21\u578B\u672C\u8EAB\u662F\u5426\u652F\u6301\uFF1B"},max_round:{default:5,min:0,max:32,step:1,tooltip:"\u4EA4\u4E92\u5BF9\u8BDD\u573A\u666F\u91CC\uFF0C\u7CFB\u7EDF\u80FD\u591F\u8BB0\u5FC6\u5E76\u6709\u6548\u5173\u8054\u7684\u7528\u6237\u4E0E\u6A21\u578B\u4E4B\u95F4\u6765\u56DE\u4EA4\u6D41\u7684\u6700\u5927\u6B21\u6570\uFF1B"},temperature:{default:.3,min:.1,max:1,step:.1,tooltip:"\u6E29\u5EA6\u662F\u6A21\u578B\u56DE\u7B54\u7684\u503E\u5411\u6027\uFF0C\u53D6\u503C\u8303\u56F4\u4E00\u822C\u662F0\uFF5E1; \u53D6\u503C\u8D8B\u8FD10\u4EE3\u8868\u7740\u6A21\u578B\u56DE\u7B54\u4F1A\u66F4\u4E25\u8C28\uFF0C\u9002\u5408\u56DE\u7B54\u68C0\u7D22\u7C7B\u95EE\u9898; \u53D6\u503C\u8D8B\u8FD11\u5219\u4EE3\u8868\u56DE\u7B54\u66F4\u53D1\u6563\uFF0C\u9002\u5408\u56DE\u7B54\u521B\u65B0\u6027\u7684\u95EE\u9898\uFF1B"},top_p:{default:.8,min:.1,max:1,step:.1,tooltip:"top_p \u7528\u4E8E\u63A7\u5236\u5927\u6A21\u578B\u751F\u6210\u7B56\u7565\uFF0C\u51B3\u5B9A\u4E86\u6A21\u578B\u5728\u751F\u6210\u4E0B\u4E00\u4E2A\u8BCD\u65F6\uFF0C\u4ECE\u7D2F\u79EF\u6982\u7387\u8FBE\u5230 p \u7684\u6700\u5C0F\u8BCD\u96C6\u5408\u4E2D\u8FDB\u884C\u91C7\u6837\u3002\u901A\u5E38\u8BBE\u7F6E\u57280.8 - 0.95\u4E4B\u95F4\uFF0Ctop_p\u8D8A\u4F4E\u6A21\u578B\u7528\u8BCD\u8D8A\u4FDD\u5B88\uFF0C\u8D8A\u9AD8\u8D8A\u6D3B\u8DC3\u3002"},score_threshold:{default:.1,min:.1,max:1,step:.1,tooltip:"score_threshold\u53C2\u6570\u662F\u6A21\u578B\u8FDB\u884C\u91CD\u6392\u5E8F\u65F6\uFF0C\u5BF9\u4E8E\u6587\u672C\u5757\u53D6\u820D\u7684\u95E8\u69DB\u503C\uFF1B"}},nu={search_policy:1,enabled_rerank:!0,need_trace_source:!0,trace_by_llm:!0,is_download:!1,dependOnKb:0,enabled_faq:!1,enabled_graph:!1,enabled_question_rewrite:!1,isDefault:0},su=[{label:"\u6DF7\u5408\u68C0\u7D22",value:1},{label:"\u5168\u6587\u68C0\u7D22",value:2},{label:"\u8BED\u4E49\u68C0\u7D22",value:3}],ru=[{label:"\u89C4\u5219\u6EAF\u6E90",value:!1},{label:"\u5927\u6A21\u578B\u6EAF\u6E90",value:!0}],de=({url:n,token:s,role:a,eventsEmit:u})=>{const h=Ke.create({baseURL:n,timeout:1e6});return h.interceptors.request.use(l=>{let t=s;return!t&&!["user/login","user/kaptcha","user/regist"].some(d=>l.url.includes(d))?(u&&u("request:error_auth",{errorMsg:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F",redirect:"/login"}),Promise.reject(new Error("\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))):(l.headers.Authorization=t||"",l.headers.userName=a==="\u672A\u767B\u5F55\u7528\u6237"?"":a,l)}),h.interceptors.response.use(l=>{const t=["user/kaptcha"],r=l.data;if(t.some(D=>l.config.url&&l.config.url.includes(D))||r.size&&r.type)return r;const{success:d,errorMsg:E,errorCode:m}=r;if(d)return r;u&&u("request:error_business",{errorCode:m,errorMsg:E||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",response:r})},l=>{var t,r,d,E,m,D,k,I,Z;if(l.message==="canceled")return Promise.reject(l);if(u){let g="request:error_network",A={errorMsg:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25",error:l};((t=l==null?void 0:l.response)==null?void 0:t.status)===401?(g="request:error_auth",A={errorMsg:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",error:l,redirect:"/login"}):(((d=(r=l==null?void 0:l.response)==null?void 0:r.data)==null?void 0:d.errorCode)==="30013"||((m=(E=l==null?void 0:l.response)==null?void 0:E.data)==null?void 0:m.errorCode)==="30023")&&(g="request:error_business",A={errorCode:(k=(D=l==null?void 0:l.response)==null?void 0:D.data)==null?void 0:k.errorCode,errorMsg:((Z=(I=l==null?void 0:l.response)==null?void 0:I.data)==null?void 0:Z.errorMsg)||"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",error:l}),u(g,A)}return Promise.reject(l)}),{getConfigById:async l=>{try{const t=await h.get(`/qa/search/config/getById?configId=${l}`),{success:r,data:d}=t;return r?d:!1}catch(t){console.error("getConfigById",t)}},fetchDatabases:async()=>{try{const l=await h.get("/index/database/queryAllDBList"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchDatabases",l)}},fetchModels:async l=>{try{const t=await h.get(`/index/modelInfo/allPage?${new URLSearchParams(l).toString()}`),{success:r,data:d}=t;return r?d:!1}catch(t){return console.log("fetchModels error",t),!1}},fetchSensitiveLibrary:async l=>{try{const t=await h.get(`/sensitive/library?${new URLSearchParams(l).toString()}`),{success:r,data:d}=t;return r?d:!1}catch(t){return console.log("fetchSensitiveLibrary error",t),!1}},fetchConfigItemLimit:async()=>{try{const l=await h.get("/qa/search/config/configItemLimit"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchConfigItemLimit error",l)}},fetchKnowledgeBase:async l=>{try{const t=l?`?userName=${l}`:"";console.log("+++",t);const r=await h.get(`/index/knowledgeBase/searchList${t}`),{success:d,data:E}=r;return d?E:!1}catch(t){console.log("e",t)}},fetchGraphs:async()=>{try{const l=await h.get("/index/graph/platform/querySnapshotList?pageSize=999&pageNo=1"),{success:t,data:r}=l;return t?r:!1}catch(l){console.error("fetchGraphs",l)}},checkName:async(l,t)=>{try{const r=await h.get(`/qa/search/config/checkName?configName=${l}${t?`&configId=${t}`:""}`),{success:d,data:E}=r;if(d)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}},getBizLabelLabels:async l=>{try{const t=await h.post("/index/bizLabel/labels",l),{success:r,data:d}=t;if(r)return d}catch(t){return console.log("updateConversationAssistant error:",t),!1}},addConversationAssistant:async l=>{try{const t=await h.post("/qa/search/config/add",{...l}),{success:r,data:d}=t;if(r)return d}catch(t){return console.log("addConversationAssistant error:",t),!1}},updateConversationAssistant:async(l,t)=>{try{const r=await h.put("/qa/search/config/update",{id:l,...t}),{success:d,data:E}=r;if(d)return E}catch(r){return console.log("updateConversationAssistant error:",r),!1}}}},Ce=({countText:n,eventsEmit:s,data:a})=>{const[u,h]=_(!0);return c("div",{style:{marginTop:8},children:[n&&c("div",{className:"flex items-center gap-2",children:[e("span",{style:{color:u?"#4E6EF2":"#4E5969"},children:n}),u?e(De,{onClick:()=>h(F=>!F),color:"#4E6EF2",size:14}):e(ve,{onClick:()=>h(F=>!F),color:"#4E5969",size:14})]}),e("div",{style:{display:u?"block":"none"},children:a.map(F=>e(au,{item:F,eventsEmit:s},F.key))})]})},au=({item:n,eventsEmit:s})=>{var h,F,b;const[a,u]=_(!0);return c("div",{className:"flex items-center justify-between",style:{padding:"8px 12px",borderRadius:6},children:[c("div",{children:[c("div",{style:{color:"#1D2129"},className:"flex items-center",children:[n.label,((h=n==null?void 0:n.tags)==null?void 0:h.length)>0&&c(Me,{children:[c("span",{style:{color:"#4E5969",marginLeft:"6px",marginRight:6},children:["(",(F=n==null?void 0:n.tags)==null?void 0:F.length,"\u4E2A\u6807\u7B7E)"]}),a?e(De,{onClick:()=>u(p=>!p),color:"#4E6EF2",size:14}):e(ve,{onClick:()=>u(p=>!p),color:"#4E5969",size:14})]})]}),((b=n==null?void 0:n.tags)==null?void 0:b.length)>0&&e("div",{className:"flex flex-wrap gap-4",style:{display:a?"block":"none",marginTop:8},children:((n==null?void 0:n.tags)||[]).map(p=>e(se,{iconPosition:"end",type:"text",style:{backgroundColor:"#F0F0F0",padding:"2px 6px",height:22,borderRadius:2,color:"#1D2129",margin:5},icon:e(Xe,{size:14,color:"#86909C",onClick:()=>{const i={...n,tags:n.tags.filter(B=>B!==p)};s("removeTag",i)}}),children:p},p))})]}),e(se,{type:"text",icon:e(Oe,{size:14}),onClick:()=>s("removeItem",n)})]},n.key)},lu=q.div`
22
22
  display: flex;
23
23
  background-color: #ffffff;
24
24
  border: 1px solid ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.border)==null?void 0:u.default)||"#e5e7eb"}};
@@ -44,11 +44,11 @@ import{jsxs as i,jsx as e,Fragment as Me}from"react/jsx-runtime";import qe,{useS
44
44
  align-items: center;
45
45
  justify-content: space-between;
46
46
  color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.primary)||"#4E5969"}};
47
- `,cu=q.div`
47
+ `,iu=q.div`
48
48
  font-weight: 400;
49
49
  font-size: 14px;
50
50
  color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.text)==null?void 0:u.primary)||"#4E6EF2"}};
51
- `,iu=q.div`
51
+ `,cu=q.div`
52
52
  padding: 12px;
53
53
  background-color: ${n=>{var s,a,u;return((u=(a=(s=n.$theme)==null?void 0:s.colors)==null?void 0:a.background)==null?void 0:u.default)||"#ffffff"}};
54
54
  `,du=q.input`
@@ -154,4 +154,4 @@ import{jsxs as i,jsx as e,Fragment as Me}from"react/jsx-runtime";import qe,{useS
154
154
  font-size: 12px;
155
155
  font-weight: 500;
156
156
  margin-left: 8px;
157
- `;const me=He(({dataSource:n,value:s=[],onConfirm:a,maxCount:u=0,searchPlaceholder:h="\u641C\u7D22...",title:F="",showSearch:b=!0,filterOption:p,renderItem:c,renderSelectedItem:B,className:z,style:y,styles:f,height:R,width:x},j)=>{const l=We(),t=ke(ke({theme:O,mode:"light"},l),f),[r,d]=_(s),[E,m]=_("");W(()=>{d(s)},[s]),ie(()=>new Set(s.map(o=>o.key)),[s]);const D=ie(()=>new Set(r.map(o=>o.key)),[r]);Ve(j,()=>({getSelectedItems:()=>r,confirm:()=>{a==null||a(r)}}),[r,a]);const I=p||((o,v)=>{var H;if(!o)return!0;const w=o.toLowerCase();return v.label.toLowerCase().includes(w)||((H=v.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(w)))||!1}),Z=ie(()=>(n||[]).filter(o=>I(E,o)),[n,E,I]),g=o=>{const v=D.has(o.key);let w;if(v)w=(r||[]).filter(H=>H.key!==o.key);else{if(u>0&&r.length>=u)return;w=[...r,o]}d(w)},A=(o,v)=>{d(w=>w.map(V=>V.key==o?{...V,tags:v}:V))},N=o=>{const v=(r||[]).filter(w=>w.key!==o.key);d(v)},$=o=>D.has(o);return u>0&&r.length>=u,i(lu,{$theme:t.theme||O,$width:x,$height:R,className:z,style:y,children:[i(Se,{$theme:t.theme||O,style:{flex:1},children:[b&&e(iu,{$theme:t.theme||O,children:i("div",{style:{position:"relative"},children:[e(hu,{children:e(Ye,{size:16})}),e(du,{$theme:t.theme||O,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ne,{children:Z.length===0?e(ze,{$theme:t.theme||O,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):Z.map(o=>{const v=$(o.key);return i($e,{$theme:t.theme||O,$selected:v,children:[e(Ie,{$theme:t.theme||O,children:c?c(o):o.label}),v&&e(Le,{$theme:t.theme||O,onClick:w=>{w.stopPropagation(),N(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!v&&e(Le,{$theme:t.theme||O,onClick:w=>{w.stopPropagation(),g(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),i(Se,{$theme:t.theme||O,style:{flex:1},children:[i(ou,{$theme:t.theme||O,children:[u>0?`\u5DF2\u9009\uFF1A${r.length}/${u}\u4E2A${F}`:`\u5DF2\u9009\uFF1A${r.length}\u4E2A${F}`,e(cu,{$theme:t.theme||O,onClick:o=>{o.stopPropagation(),d([])},children:"\u6E05\u7A7A"})]}),e(Ne,{children:r.length===0?e(ze,{$theme:t.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):r.map(o=>{var w,H,V;const v=Q=>A(o.key,Q);return i($e,{$theme:t.theme||O,children:[e(Ie,{$theme:t.theme||O,children:B?B(o,v):o.label}),e(Oe,{size:14,color:((V=(H=(w=t.theme)==null?void 0:w.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:Q=>{Q.stopPropagation(),N(o)}})]},o.key)})})]})]})});me.displayName="SearchableSelector";const be="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%23FFCC3C'/%3e%3cpath%20d='M13.3263%2012.7917H7.53763C7.33426%2012.8116%207.17923%2012.9825%207.17923%2013.1867C7.17923%2013.3909%207.33426%2013.5618%207.53763%2013.5817H13.3277C13.3828%2013.5871%2013.4384%2013.5809%2013.4909%2013.5634C13.5435%2013.546%2013.5918%2013.5178%2013.6328%2013.4806C13.6738%2013.4434%2013.7066%2013.3981%2013.729%2013.3474C13.7514%2013.2968%2013.763%2013.2421%2013.763%2013.1867C13.763%2013.1313%2013.7514%2013.0766%2013.729%2013.026C13.7066%2012.9753%2013.6738%2012.93%2013.6328%2012.8928C13.5918%2012.8556%2013.5435%2012.8274%2013.4909%2012.8099C13.4384%2012.7925%2013.3828%2012.7863%2013.3277%2012.7917H13.3263ZM9.19742%207.60418L8.84232%208.55193H9.57339L9.19742%207.60418Z'%20fill='white'/%3e%3cpath%20d='M15.3211%2014.7707V6.9692H14.4704V14.3543H6.70511C6.06668%2014.3392%205.55704%2013.8173%205.55704%2013.1788C5.55704%2012.5402%206.06668%2012.0184%206.70511%2012.0033H13.352C13.4644%2012.0075%2013.5735%2011.9648%2013.653%2011.8852C13.6923%2011.8459%2013.7231%2011.7988%2013.7434%2011.747C13.7638%2011.6952%2013.7731%2011.6398%2013.771%2011.5842V5.20102C13.7736%205.14526%2013.7646%205.08958%2013.7445%205.03752C13.7244%204.98546%2013.6936%204.93816%2013.6542%204.89865C13.6148%204.85915%2013.5675%204.82832%2013.5155%204.80812C13.4634%204.78792%2013.4077%204.7788%2013.352%204.78134H6.70511C5.60281%204.80136%204.71609%205.69369%204.70291%206.79599V13.1759C4.71609%2014.283%205.61038%2015.1773%206.71756%2015.1905H14.8893C15.0042%2015.1994%2015.1173%2015.1585%2015.1999%2015.0782C15.2407%2015.0385%2015.2727%2014.9905%2015.2936%2014.9375C15.3145%2014.8845%2015.3239%2014.8276%2015.3211%2014.7707ZM8.98782%206.78585H9.44888L10.7213%209.92562H10.2475L9.9075%209.06759H8.51871L8.19742%209.92562H7.72354L8.98782%206.78585Z'%20fill='white'/%3e%3c/svg%3e",{Item:mu}=de,pu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h,defaultAnswer:F,form:b})=>{const[p,c]=_([]),[B,z]=_([]),[y,f]=_(!1),[R,x]=_(!1),j=ne(null),{fetchSensitiveLibrary:l}=he({url:n,token:s,role:a,eventsEmit:u});W(()=>{t()},[]),W(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],D=[];m.forEach(k=>{const I=(p||[]).find(Z=>Z.key===k);I&&D.push({key:I.key,label:I.label})}),z(D)}},[h,p]),W(()=>{F&&x(!0)},[F]);const t=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const D=((m==null?void 0:m.records)||[]).map(k=>({key:k.id+"",label:k.name}));c(D)}}catch(m){console.error(m)}},r=(m,D)=>{switch(m){case"removeItem":const k=B.filter(I=>I.key!==D.key);z([...k]),d(k);break}},d=m=>{const D=m.map(k=>(k==null?void 0:k.key)||"").filter(k=>k).join(",");u&&u("sensitive_selected",D)},E=()=>{var D;const m=((D=j.current)==null?void 0:D.getSelectedItems())||[];z(m),f(!1),d(m)};return i("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[i("div",{className:"flex items-center justify-between",children:[i("div",{className:"flex items-center",children:[e("img",{src:be}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>f(!0),children:"\u6DFB\u52A0"})]}),e(_e,{checked:R,onChange:m=>{x(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:tu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),R&&e(mu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(Ce,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:r,data:B}),e(Ee,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:y,onOk:E,onCancel:()=>f(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(me,{ref:j,dataSource:p,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:m=>i("div",{className:"flex ",children:[e("img",{src:be,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m.label,children:m.label})]}),renderSelectedItem:(m,D)=>i("div",{className:"flex items-center",children:[e("img",{src:be,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:m.label})})]})})})]})},Ae="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%2300B2F9'/%3e%3cpath%20d='M5.3125%2013.9672V13.975C5.32812%2014.6938%205.89922%2015.2734%206.61875%2015.2734H13.9062C14.3375%2015.2734%2014.6875%2014.9289%2014.6875%2014.4977V5.50703C14.6875%205.40447%2014.6673%205.30292%2014.628%205.20818C14.5887%205.11344%2014.5312%205.02736%2014.4586%204.95488C14.3861%204.8824%2014.2999%204.82492%2014.2052%204.78575C14.1104%204.74657%2014.0088%204.72646%2013.9062%204.72656H6.875C6.01172%204.72656%205.3125%205.42031%205.3125%206.28359V13.9672ZM7.5%209.24531V6.25C7.5%206.07813%207.64062%205.9375%207.8125%205.9375H9.6875C9.86016%205.9375%2010%206.07813%2010%206.25V9.24531C10%209.30716%209.98175%209.36762%209.94741%209.41906C9.91308%209.47049%209.86425%209.51058%209.80712%209.53426C9.74999%209.55793%209.68712%209.56412%209.62647%209.55204C9.56581%209.53996%209.51011%209.51016%209.46641%209.46641L8.97109%208.97109C8.94207%208.94204%208.90761%208.91899%208.86967%208.90326C8.83173%208.88754%208.79107%208.87944%208.75%208.87944C8.70893%208.87944%208.66827%208.88754%208.63033%208.90326C8.59239%208.91899%208.55793%208.94204%208.52891%208.97109L8.03359%209.46641C7.98989%209.51016%207.93418%209.53996%207.87353%209.55204C7.81288%209.56412%207.75001%209.55793%207.69288%209.53426C7.63575%209.51058%207.58692%209.47049%207.55259%209.41906C7.51825%209.36762%207.49995%209.30716%207.5%209.24531ZM6.54375%2014.2063C6.45208%2014.1156%206.40625%2014.0052%206.40625%2013.875C6.40625%2013.7458%206.45208%2013.6354%206.54375%2013.5438C6.6349%2013.4521%206.74531%2013.4062%206.875%2013.4062H13.5938V14.3438H6.875C6.74531%2014.3438%206.6349%2014.2979%206.54375%2014.2063Z'%20fill='white'/%3e%3c/svg%3e",fu=({url:n,token:s,role:a,sectionData:u,createBy:h,eventsEmit:F})=>{const[b,p]=_(),[c,B]=_([]),[z,y]=_(!1),f=ne(null),[R,x]=_(!1),[j,l]=_([]),t=ne(new Map).current,{fetchKnowledgeBase:r,getBizLabelLabels:d}=he({url:n,token:s,role:a,eventsEmit:F}),E=ne(!1);W(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),W(()=>{if(u&&(b==null?void 0:b.length)>0){const g=u==null?void 0:u.knowledge_base_name_source,A=g&&(Array.isArray(g)?g:g.split(";"));let N=[];(A||[]).forEach($=>{const o=((u==null?void 0:u.selectedKnowledgeBase)||[]).find(w=>w.name==$),v=(b||[]).find(w=>w.knowledge_base_name_source===$);if(v){const{key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:Q}=v;N.push({key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:Q,tags:o==null?void 0:o.labels})}}),B(N)}},[u,b]);const m=async g=>{try{const A=await r(g);if(A){const N=(A||[]).map($=>({key:$.id,label:$.kbName,knowledge_base_name:$.primitiveName,knowledge_base_name_source:$.kbName}));p(N)}}catch(A){console.error(A)}},D=(g,A)=>{switch(g){case"removeItem":const N=c.filter(o=>o.key!==A.key);B([...N]),k(N);break;case"removeTag":const $=c.findIndex(o=>o.key==A.key);$!==-1&&(c[$]=A),B([...c]),k(c);break}},k=g=>{const A=(g||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),N=(g||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),$=(g||[]).filter(o=>{var v;return Array.isArray(o==null?void 0:o.tags)&&((v=o.tags)==null?void 0:v.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name_source,labels:o.tags}));F&&F("knowledge_selected",{knowledge_base_name:A,knowledge_base_name_source:N,selectedKnowledgeBase:$})},I=()=>{var A;const g=((A=f.current)==null?void 0:A.getSelectedItems())||[];B(g),y(!1),k(g)},Z=async(g,A)=>{if(g){const N=t.get(A);if(N){l(N);return}if(!R)try{x(!0);const $=await d({kbNames:[A]});if(Array.isArray($)){const o=$.length?$[0].label:"",v=o?(o||"").split(",").map(w=>({label:w,value:w})):[];t.set(A,v),l(v)}x(!1)}catch($){console.error("Error fetching data:",$),x(!1)}}};return i("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[i("div",{className:"flex items-center justify-between",children:[i("div",{className:"flex items-center",children:[e("img",{src:Ae}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>y(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(Ce,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:D,data:c}),e(Ee,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:z,onOk:I,onCancel:()=>y(!1),destroyOnHidden:!0,children:e(me,{ref:f,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:g=>i("div",{className:"flex ",children:[e("img",{src:Ae,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g.label,children:g.label})]}),renderSelectedItem:(g,A)=>i("div",{className:"flex ",children:[e("img",{src:Ae,alt:"add"}),i("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:g.label}),e(Y,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:g.tags||[],onChange:N=>{A(N)},style:{width:250},options:j,loading:R,onOpenChange:N=>{Z(N,g.knowledge_base_name)}})]})]})})})]})},gu=qe.memo(fu),we="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%23925BFF'/%3e%3cpath%20d='M11.9971%2011.265C15.249%2011.265%2017.8891%2010.443%2017.8891%209.423V7.95288C17.8891%206.93291%2015.2492%206.11084%2011.9971%206.11084C8.74513%206.11084%206.10504%206.93276%206.10504%207.95288V9.42285C6.10504%2010.437%208.73898%2011.265%2011.9971%2011.265Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2014.577C15.249%2014.577%2017.8891%2013.7551%2017.8891%2012.7349V10.527C17.8891%2011.5469%2015.2492%2012.369%2011.9971%2012.369C8.74513%2012.369%206.10504%2011.5471%206.10504%2010.527V12.7349C6.10504%2013.749%208.73898%2014.577%2011.9971%2014.577Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2015.681C8.7451%2015.681%206.11102%2014.859%206.11102%2013.839V16.0469C6.11102%2017.0609%208.74496%2017.889%2012.0031%2017.889C15.255%2017.889%2017.8951%2017.0671%2017.8951%2016.0469V13.8391C17.889%2014.859%2015.249%2015.681%2011.9971%2015.681Z'%20fill='white'/%3e%3c/svg%3e",Pe=10,Fu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h,disabled:F})=>{const[b,p]=_([]),[c,B]=_([]),[z,y]=_(!1),f=ne(null),{fetchDatabases:R}=he({url:n,token:s,role:a,eventsEmit:u});W(()=>{x()},[]),W(()=>{if(h){let t=[];(h||[]).map(r=>{const d=(b||[]).find(E=>E.key===r.key);if(d){const{key:E,label:m}=d;t.push({key:E,label:m})}}),B(t)}},[h,b]);const x=async()=>{try{const t=await R();if(t){const r=(t||[]).map(d=>({key:d.primitiveName,label:d.name}));p(r)}}catch(t){console.error(t)}},j=(t,r)=>{switch(t){case"removeItem":const d=c.filter(E=>E.key!==r.key);B([...d]),u&&u("database_selected",d);break}},l=()=>{var r;const t=((r=f.current)==null?void 0:r.getSelectedItems())||[];B(t),y(!1),u&&u("database_selected",t)};return i("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[i("div",{className:"flex items-center justify-between",children:[i("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>y(!0),disabled:c.length>=Pe||F,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(Ce,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:j,data:c}),e(Ee,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:z,onOk:l,onCancel:()=>y(!1),destroyOnHidden:!0,children:e(me,{ref:f,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Pe,renderItem:t=>i("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.label,children:t.label})]}),renderSelectedItem:(t,r)=>i("div",{className:"flex items-center",children:[e("img",{src:we,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:t.label})})]})})})]})},xe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%2300C1B8'/%3e%3cpath%20d='M17.9887%2012.582C18.1207%2013.6621%2017.2267%2014.5801%2016.1526%2014.4901C15.3306%2014.4181%2014.6645%2013.7521%2014.6045%2012.924C14.5745%2012.558%2014.6645%2012.21%2014.8445%2011.9159C14.9285%2011.7779%2014.9045%2011.6039%2014.8025%2011.4899L14.3885%2011.0339C14.2805%2010.9139%2014.1005%2010.8839%2013.9565%2010.9559C13.6144%2011.1239%2013.2304%2011.2199%2012.8224%2011.2199C12.6244%2011.2199%2012.4324%2011.1959%2012.2464%2011.1539C12.0963%2011.1179%2011.9463%2011.1779%2011.8563%2011.3039L11.2803%2012.1259C11.1783%2012.276%2011.1963%2012.474%2011.3223%2012.606C11.8983%2013.188%2012.2464%2013.9921%2012.2284%2014.8741C12.1924%2016.4702%2010.9203%2017.7963%209.32417%2017.9043C7.45804%2018.0243%205.90994%2016.4942%206.00595%2014.6281C6.08995%2013.038%207.38604%2011.7599%208.97614%2011.6879C9.42017%2011.6699%209.8402%2011.7419%2010.2302%2011.8919C10.3922%2011.9519%2010.5722%2011.8979%2010.6743%2011.7599L11.1663%2011.0579C11.2743%2010.9019%2011.2503%2010.6919%2011.1123%2010.5658C10.5302%2010.0498%2010.1882%209.26976%2010.2662%208.4177C10.3742%207.18162%2011.3823%206.18556%2012.6244%206.09555C14.1245%205.98154%2015.3846%207.17562%2015.3846%208.65172C15.3846%209.20376%2015.2106%209.70779%2014.9105%2010.1278C14.8085%2010.2658%2014.8205%2010.4578%2014.9345%2010.5898L15.3786%2011.0819C15.4746%2011.1899%2015.6306%2011.2259%2015.7626%2011.1779C16.0086%2011.0939%2016.2786%2011.0639%2016.5606%2011.1119C17.3047%2011.2259%2017.8987%2011.8319%2017.9887%2012.582Z'%20fill='white'/%3e%3c/svg%3e",Eu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h})=>{const[F,b]=_([]),[p,c]=_([]),[B,z]=_(!1),y=ne(null),{fetchGraphs:f}=he({url:n,token:s,role:a,eventsEmit:u});W(()=>{R()},[]),W(()=>{if(h){let t=[];(h||[]).map(r=>{const d=(F||[]).find(E=>E.key===r.index_name);if(d){const{key:E,label:m}=d;t.push({key:E,label:m})}}),c(t)}},[h,F]);const R=async()=>{try{const t=await f();if(t!=null&&t.dataList){const r=((t==null?void 0:t.dataList)||[]).map(d=>({key:d.schemaId,label:d.name}));b(r)}}catch(t){console.error(t)}},x=(t,r)=>{switch(t){case"removeItem":const d=p.filter(E=>E.key!==r.key);c([...d]),j(d);break}},j=t=>{const r=(t||[]).map(d=>({graph_name:d.label,index_name:d.key}));u&&u("graph_selected",r)},l=()=>{var r;const t=((r=y.current)==null?void 0:r.getSelectedItems())||[];c(t),z(!1),j(t)};return i("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[i("div",{className:"flex items-center justify-between",children:[i("div",{className:"flex items-center",children:[e("img",{src:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>z(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(Ce,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:x,data:p}),e(Ee,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>z(!1),children:e(me,{ref:y,dataSource:F,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:t=>i("div",{className:"flex ",children:[e("img",{src:xe,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.label,children:t.label})]}),renderSelectedItem:t=>i("div",{className:"flex items-center",children:[e("img",{src:xe,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:t.label})})]})})})]})},Cu=({value:n,onChange:s,min:a,max:u,step:h,disabled:F,sliderStyle:b,inputStyle:p,inputWidth:c=90})=>{const B=y=>{const f=Array.isArray(y)?y[0]:y;s==null||s(f)},z=y=>{s==null||s(y)};return i(Ge,{style:{width:"100%"},children:[e(Ze,{min:a,max:u,step:h,disabled:F,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Ue,{min:a,max:u,step:h,disabled:F,controls:!1,value:n,onChange:z,style:{width:c,...p}})]})},{Item:Bu}=de,ae=({label:n,name:s,configScale:a})=>{const u=ie(()=>a[s],[a]),h=(F,b)=>({validator(p,c){return c==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+c!="number"||isNaN(+c)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):c<F||c>b?Promise.reject(`\u8BF7\u8F93\u5165${F}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(te,{span:12,children:e(Bu,{label:n,name:s,tooltip:u.tooltip,rules:[{required:!0,message:""},h(u.min,u.max)],children:e(Cu,{min:u.min,max:u.max,step:u.step})})})},{Item:M}=de,Du=({url:n,token:s,role:a,id:u,showDatabase:h,showGraph:F,isShare:b,disabled:p,eventsEmit:c,CustomComponents:B})=>{const{ContentLoading:z}=B,[y]=de.useForm(),[f,R]=_(),[x,j]=_(),[l,t]=_(),[r,d]=_(),[E,m]=_(!0),[D,k]=_(!1),[I,Z]=_(ue),g=ne({}),{getConfigById:A,fetchModels:N,fetchConfigItemLimit:$,checkName:o,addConversationAssistant:v,updateConversationAssistant:w}=he({url:n,token:s,role:a,eventsEmit:c});W(()=>{H()},[u]),W(()=>{u?(Array.isArray(x)&&Array.isArray(l)&&y.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name"]),Array.isArray(r)&&y.validateFields(["multi_model_name"])):(Array.isArray(x)&&(x==null?void 0:x.length)==0&&y.validateFields(["model_name","plan_model_name","recommend_model_name"]),Array.isArray(l)&&(l==null?void 0:l.length)==0&&y.validateFields(["rerank_model_name"]),Array.isArray(r)&&(r==null?void 0:r.length)==0&&y.validateFields(["multi_model_name"]))},[l,x,r,u]);const H=async()=>{let C;if(u){E||m(!0);try{const S=await A(u);if(S){const{configJson:L,...X}=S,K=L&&JSON.parse(L),{knowledge_base_name:ee,knowledge_base_name_source:G,selectedKnowledgeBase:J,sensitiveWordIds:T,database_name:P,graph_nb_name:U}=K;C={...X,...K},g.current={knowledge_base_name:ee,knowledge_base_name_source:G,selectedKnowledgeBase:J,sensitiveWordIds:T,database_name:P,graph_nb_name:U},R(C),console.log("_configData--->",C),y.setFieldsValue(C),m(!1)}}catch{}}else m(!1);await V(C)},V=async C=>{var S,L,X;try{const[K,ee,G,J]=await Promise.allSettled([N({pageNum:1,pageSize:9999,status:1,type:1}),N({pageNum:1,pageSize:9999,status:1,type:3}),N({pageNum:1,pageSize:9999,status:1,type:4}),$()]);if(K.status==="fulfilled"&&K.value){const P=(((S=K.value)==null?void 0:S.records)||[]).map(U=>({...U,label:U.modelName,value:U.modelName}));j(P)}if(ee.status==="fulfilled"&&ee.value){const T=(((L=ee.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));t(T),T.length>0&&!(C!=null&&C.rerank_model_name)&&y.setFieldsValue({rerank_model_name:T[0].value})}if(G.status==="fulfilled"&&G.value){const T=(((X=G.value)==null?void 0:X.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));d(T),T.length>0&&!(C!=null&&C.multi_model_name)&&y.setFieldsValue({multi_model_name:T[0].value})}if(J.status==="fulfilled"&&J.value&&J.value){const T=J.value;Object.keys(ue).forEach(P=>{if(T.hasOwnProperty(P)){const{max:U,min:je}=T[P];ue[P]={...ue[P],min:je,max:U}}}),Z(ue)}}catch(K){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",K)}},Q=async(C,S)=>await o(S,u)?(Be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),le=(C,S)=>({validator(L,X){return X?Array.isArray(C)&&C.length===0||!C.find(K=>K.value==X)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(C)&&C.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject(S)}}),pe=(C,S)=>{switch(console.log("++++\u52A9\u624B\u914D\u7F6E",C,S),C){case"knowledge_selected":g.current={...g.current,...S};break;case"sensitive_selected":g.current={...g.current,sensitiveWordIds:S};break;case"database_selected":g.current={...g.current,database_name:S};break;case"graph_selected":g.current={...g.current,graph_nb_name:S};break}},Te=async()=>{var S;let C={};try{k(!0);const L=await y.validateFields(),{knowledge_base_name:X,knowledge_base_name_source:K,selectedKnowledgeBase:ee,sensitiveWordIds:G,database_name:J,graph_nb_name:T}=g.current;L.thinking=((S=x.find(U=>U.modelName==L.model_name))==null?void 0:S.thinking)||!1,C={configJson:JSON.stringify({...L,knowledge_base_name:X,knowledge_base_name_source:K,selectedKnowledgeBase:ee,sensitiveWordIds:G,...h?{database_name:J}:{},...F?{graph_nb_name:T}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:G},u?await w(u,C)&&(Be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await v(C)&&(Be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(L){console.error("submit error",L)}finally{k(!1)}},Re=ie(()=>{const C={};return Object.keys(ue).forEach(S=>{var L;C[S]=(L=ue[S])==null?void 0:L.default}),{...nu,...C}},[]);return i("div",{style:{height:"100%",width:"100%"},children:[i("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[i("div",{className:"flex items-center",children:[e(Je,{color:"#2468F2",onClick:()=>c&&c("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:u?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!E&&e(se,{type:"primary",onClick:()=>Te(),loading:D,disabled:p,children:"\u786E\u5B9A"})]}),E?z&&e(z,{}):e(de,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:y,layout:"vertical",initialValues:Re,disabled:p,colon:!1,children:i(re,{gutter:24,style:{height:"100%"},children:[i(te,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:Q}],children:e(fe,{placeholder:"\u8BF7\u8F93\u5165"})}),i(re,{gutter:16,children:[e(te,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},le(x,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:x,notFoundContent:e(ce,{})})})}),e(te,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},le(x,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:x,notFoundContent:e(ce,{})})})})]}),i(re,{gutter:16,children:[e(te,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},le(r,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:r,notFoundContent:e(ce,{})})})}),e(te,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},le(l,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:l,notFoundContent:e(ce,{})})})})]}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:Qe,children:e(fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${uu}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:C=>C===!0?1:0,children:e(_e,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),i(te,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[i(ye,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},le(x,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:x,notFoundContent:e(ce,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(Y,{options:su,placeholder:"\u8BF7\u9009\u62E9"})}),i(re,{gutter:16,children:[e(ae,{label:"\u6E29\u5EA6",name:"temperature",configScale:I}),e(ae,{label:"\u591A\u6837\u6027",name:"top_p",configScale:I})]}),i(re,{gutter:16,children:[e(ae,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:I}),e(ae,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:I})]}),i(re,{gutter:16,children:[e(ae,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:I}),e(ae,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:I})]})]}),i(ye,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:eu,normalize:C=>C===!0?1:0,children:e(oe,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(oe,{})}),e(M,{noStyle:!0,shouldUpdate:(C,S)=>C.need_trace_source!==S.need_trace_source,children:({getFieldValue:C})=>C("need_trace_source")?i(Me,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:ru})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(_e,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),i(ye,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(pu,{url:n,token:s,role:a,sectionData:f==null?void 0:f.sensitiveWordIds,eventsEmit:pe,defaultAnswer:f==null?void 0:f.defaultAnswer,form:y}),e(gu,{url:n,token:s,role:a,sectionData:{knowledge_base_name:f==null?void 0:f.knowledge_base_name,knowledge_base_name_source:f==null?void 0:f.knowledge_base_name_source,selectedKnowledgeBase:f==null?void 0:f.selectedKnowledgeBase},createBy:b?f==null?void 0:f.createBy:void 0,eventsEmit:pe}),h&&e(Fu,{url:n,token:s,role:a,disabled:p,sectionData:f==null?void 0:f.database_name,eventsEmit:pe}),F&&e(Eu,{url:n,token:s,role:a,sectionData:f==null?void 0:f.graph_nb_name,eventsEmit:pe})]})]})]})})]})};export{Du as C,Ye as S};
157
+ `;const he=He(({dataSource:n,value:s=[],onConfirm:a,maxCount:u=0,searchPlaceholder:h="\u641C\u7D22...",title:F="",showSearch:b=!0,filterOption:p,renderItem:i,renderSelectedItem:B,className:z,style:y,styles:f,height:R,width:x},j)=>{const l=We(),t=ke(ke({theme:O,mode:"light"},l),f),[r,d]=_(s),[E,m]=_("");W(()=>{d(s)},[s]),ie(()=>new Set(s.map(o=>o.key)),[s]);const D=ie(()=>new Set(r.map(o=>o.key)),[r]);Ve(j,()=>({getSelectedItems:()=>r,confirm:()=>{a==null||a(r)}}),[r,a]);const I=p||((o,v)=>{var H;if(!o)return!0;const w=o.toLowerCase();return v.label.toLowerCase().includes(w)||((H=v.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(w)))||!1}),Z=ie(()=>(n||[]).filter(o=>I(E,o)),[n,E,I]),g=o=>{const v=D.has(o.key);let w;if(v)w=(r||[]).filter(H=>H.key!==o.key);else{if(u>0&&r.length>=u)return;w=[...r,o]}d(w)},A=(o,v)=>{d(w=>w.map(V=>V.key==o?{...V,tags:v}:V))},N=o=>{const v=(r||[]).filter(w=>w.key!==o.key);d(v)},$=o=>D.has(o);return u>0&&r.length>=u,c(lu,{$theme:t.theme||O,$width:x,$height:R,className:z,style:y,children:[c(Se,{$theme:t.theme||O,style:{flex:1},children:[b&&e(cu,{$theme:t.theme||O,children:c("div",{style:{position:"relative"},children:[e(hu,{children:e(Ye,{size:16})}),e(du,{$theme:t.theme||O,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ne,{children:Z.length===0?e(ze,{$theme:t.theme||O,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):Z.map(o=>{const v=$(o.key);return c($e,{$theme:t.theme||O,$selected:v,children:[e(Ie,{$theme:t.theme||O,children:i?i(o):o.label}),v&&e(Le,{$theme:t.theme||O,onClick:w=>{w.stopPropagation(),N(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!v&&e(Le,{$theme:t.theme||O,onClick:w=>{w.stopPropagation(),g(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),c(Se,{$theme:t.theme||O,style:{flex:1},children:[c(ou,{$theme:t.theme||O,children:[u>0?`\u5DF2\u9009\uFF1A${r.length}/${u}\u4E2A${F}`:`\u5DF2\u9009\uFF1A${r.length}\u4E2A${F}`,e(iu,{$theme:t.theme||O,onClick:o=>{o.stopPropagation(),d([])},children:"\u6E05\u7A7A"})]}),e(Ne,{children:r.length===0?e(ze,{$theme:t.theme||O,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):r.map(o=>{var w,H,V;const v=Q=>A(o.key,Q);return c($e,{$theme:t.theme||O,children:[e(Ie,{$theme:t.theme||O,children:B?B(o,v):o.label}),e(Oe,{size:14,color:((V=(H=(w=t.theme)==null?void 0:w.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:Q=>{Q.stopPropagation(),N(o)}})]},o.key)})})]})]})});he.displayName="SearchableSelector";const be="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%23FFCC3C'/%3e%3cpath%20d='M13.3263%2012.7917H7.53763C7.33426%2012.8116%207.17923%2012.9825%207.17923%2013.1867C7.17923%2013.3909%207.33426%2013.5618%207.53763%2013.5817H13.3277C13.3828%2013.5871%2013.4384%2013.5809%2013.4909%2013.5634C13.5435%2013.546%2013.5918%2013.5178%2013.6328%2013.4806C13.6738%2013.4434%2013.7066%2013.3981%2013.729%2013.3474C13.7514%2013.2968%2013.763%2013.2421%2013.763%2013.1867C13.763%2013.1313%2013.7514%2013.0766%2013.729%2013.026C13.7066%2012.9753%2013.6738%2012.93%2013.6328%2012.8928C13.5918%2012.8556%2013.5435%2012.8274%2013.4909%2012.8099C13.4384%2012.7925%2013.3828%2012.7863%2013.3277%2012.7917H13.3263ZM9.19742%207.60418L8.84232%208.55193H9.57339L9.19742%207.60418Z'%20fill='white'/%3e%3cpath%20d='M15.3211%2014.7707V6.9692H14.4704V14.3543H6.70511C6.06668%2014.3392%205.55704%2013.8173%205.55704%2013.1788C5.55704%2012.5402%206.06668%2012.0184%206.70511%2012.0033H13.352C13.4644%2012.0075%2013.5735%2011.9648%2013.653%2011.8852C13.6923%2011.8459%2013.7231%2011.7988%2013.7434%2011.747C13.7638%2011.6952%2013.7731%2011.6398%2013.771%2011.5842V5.20102C13.7736%205.14526%2013.7646%205.08958%2013.7445%205.03752C13.7244%204.98546%2013.6936%204.93816%2013.6542%204.89865C13.6148%204.85915%2013.5675%204.82832%2013.5155%204.80812C13.4634%204.78792%2013.4077%204.7788%2013.352%204.78134H6.70511C5.60281%204.80136%204.71609%205.69369%204.70291%206.79599V13.1759C4.71609%2014.283%205.61038%2015.1773%206.71756%2015.1905H14.8893C15.0042%2015.1994%2015.1173%2015.1585%2015.1999%2015.0782C15.2407%2015.0385%2015.2727%2014.9905%2015.2936%2014.9375C15.3145%2014.8845%2015.3239%2014.8276%2015.3211%2014.7707ZM8.98782%206.78585H9.44888L10.7213%209.92562H10.2475L9.9075%209.06759H8.51871L8.19742%209.92562H7.72354L8.98782%206.78585Z'%20fill='white'/%3e%3c/svg%3e",{Item:mu}=ce,pu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h,defaultAnswer:F,form:b})=>{const[p,i]=_([]),[B,z]=_([]),[y,f]=_(!1),[R,x]=_(!1),j=ne(null),{fetchSensitiveLibrary:l}=de({url:n,token:s,role:a,eventsEmit:u});W(()=>{t()},[]),W(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],D=[];m.forEach(k=>{const I=(p||[]).find(Z=>Z.key===k);I&&D.push({key:I.key,label:I.label})}),z(D)}},[h,p]),W(()=>{F&&x(!0)},[F]);const t=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const D=((m==null?void 0:m.records)||[]).map(k=>({key:k.id+"",label:k.name}));i(D)}}catch(m){console.error(m)}},r=(m,D)=>{switch(m){case"removeItem":const k=B.filter(I=>I.key!==D.key);z([...k]),d(k);break}},d=m=>{const D=m.map(k=>(k==null?void 0:k.key)||"").filter(k=>k).join(",");u&&u("sensitive_selected",D)},E=()=>{var D;const m=((D=j.current)==null?void 0:D.getSelectedItems())||[];z(m),f(!1),d(m)};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:be}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>f(!0),children:"\u6DFB\u52A0"})]}),e(_e,{checked:R,onChange:m=>{x(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:tu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),R&&e(mu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(Ce,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:r,data:B}),e(Ee,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:y,onOk:E,onCancel:()=>f(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(he,{ref:j,dataSource:p,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:m=>c("div",{className:"flex ",children:[e("img",{src:be,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m.label,children:m.label})]}),renderSelectedItem:(m,D)=>c("div",{className:"flex items-center",children:[e("img",{src:be,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:m.label})})]})})})]})},Ae="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%2300B2F9'/%3e%3cpath%20d='M5.3125%2013.9672V13.975C5.32812%2014.6938%205.89922%2015.2734%206.61875%2015.2734H13.9062C14.3375%2015.2734%2014.6875%2014.9289%2014.6875%2014.4977V5.50703C14.6875%205.40447%2014.6673%205.30292%2014.628%205.20818C14.5887%205.11344%2014.5312%205.02736%2014.4586%204.95488C14.3861%204.8824%2014.2999%204.82492%2014.2052%204.78575C14.1104%204.74657%2014.0088%204.72646%2013.9062%204.72656H6.875C6.01172%204.72656%205.3125%205.42031%205.3125%206.28359V13.9672ZM7.5%209.24531V6.25C7.5%206.07813%207.64062%205.9375%207.8125%205.9375H9.6875C9.86016%205.9375%2010%206.07813%2010%206.25V9.24531C10%209.30716%209.98175%209.36762%209.94741%209.41906C9.91308%209.47049%209.86425%209.51058%209.80712%209.53426C9.74999%209.55793%209.68712%209.56412%209.62647%209.55204C9.56581%209.53996%209.51011%209.51016%209.46641%209.46641L8.97109%208.97109C8.94207%208.94204%208.90761%208.91899%208.86967%208.90326C8.83173%208.88754%208.79107%208.87944%208.75%208.87944C8.70893%208.87944%208.66827%208.88754%208.63033%208.90326C8.59239%208.91899%208.55793%208.94204%208.52891%208.97109L8.03359%209.46641C7.98989%209.51016%207.93418%209.53996%207.87353%209.55204C7.81288%209.56412%207.75001%209.55793%207.69288%209.53426C7.63575%209.51058%207.58692%209.47049%207.55259%209.41906C7.51825%209.36762%207.49995%209.30716%207.5%209.24531ZM6.54375%2014.2063C6.45208%2014.1156%206.40625%2014.0052%206.40625%2013.875C6.40625%2013.7458%206.45208%2013.6354%206.54375%2013.5438C6.6349%2013.4521%206.74531%2013.4062%206.875%2013.4062H13.5938V14.3438H6.875C6.74531%2014.3438%206.6349%2014.2979%206.54375%2014.2063Z'%20fill='white'/%3e%3c/svg%3e",fu=({url:n,token:s,role:a,sectionData:u,createBy:h,eventsEmit:F})=>{const[b,p]=_(),[i,B]=_([]),[z,y]=_(!1),f=ne(null),[R,x]=_(!1),[j,l]=_([]),t=ne(new Map).current,{fetchKnowledgeBase:r,getBizLabelLabels:d}=de({url:n,token:s,role:a,eventsEmit:F}),E=ne(!1);W(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),W(()=>{if(u&&(b==null?void 0:b.length)>0){const g=u==null?void 0:u.knowledge_base_name_source,A=g&&(Array.isArray(g)?g:g.split(";"));let N=[];(A||[]).forEach($=>{const o=((u==null?void 0:u.selectedKnowledgeBase)||[]).find(w=>w.name==$),v=(b||[]).find(w=>w.knowledge_base_name_source===$);if(v){const{key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:Q}=v;N.push({key:w,label:H,knowledge_base_name:V,knowledge_base_name_source:Q,tags:o==null?void 0:o.labels})}}),B(N)}},[u,b]);const m=async g=>{try{const A=await r(g);if(A){const N=(A||[]).map($=>({key:$.id,label:$.kbName,knowledge_base_name:$.primitiveName,knowledge_base_name_source:$.kbName}));p(N)}}catch(A){console.error(A)}},D=(g,A)=>{switch(g){case"removeItem":const N=i.filter(o=>o.key!==A.key);B([...N]),k(N);break;case"removeTag":const $=i.findIndex(o=>o.key==A.key);$!==-1&&(i[$]=A),B([...i]),k(i);break}},k=g=>{const A=(g||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),N=(g||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),$=(g||[]).filter(o=>{var v;return Array.isArray(o==null?void 0:o.tags)&&((v=o.tags)==null?void 0:v.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name_source,labels:o.tags}));F&&F("knowledge_selected",{knowledge_base_name:A,knowledge_base_name_source:N,selectedKnowledgeBase:$})},I=()=>{var A;const g=((A=f.current)==null?void 0:A.getSelectedItems())||[];B(g),y(!1),k(g)},Z=async(g,A)=>{if(g){const N=t.get(A);if(N){l(N);return}if(!R)try{x(!0);const $=await d({kbNames:[A]});if(Array.isArray($)){const o=$.length?$[0].label:"",v=o?(o||"").split(",").map(w=>({label:w,value:w})):[];t.set(A,v),l(v)}x(!1)}catch($){console.error("Error fetching data:",$),x(!1)}}};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:Ae}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>y(!0),children:"\u6DFB\u52A0"})})]}),(i==null?void 0:i.length)>0&&e(Ce,{countText:(i==null?void 0:i.length)>0?`\u5DF2\u9009\uFF1A${i==null?void 0:i.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:D,data:i}),e(Ee,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:z,onOk:I,onCancel:()=>y(!1),destroyOnHidden:!0,children:e(he,{ref:f,dataSource:b,value:i,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:g=>c("div",{className:"flex ",children:[e("img",{src:Ae,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:g.label,children:g.label})]}),renderSelectedItem:(g,A)=>c("div",{className:"flex ",children:[e("img",{src:Ae,alt:"add"}),c("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:g.label}),e(Y,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:g.tags||[],onChange:N=>{A(N)},style:{width:250},options:j,loading:R,onOpenChange:N=>{Z(N,g.knowledge_base_name)}})]})]})})})]})},gu=qe.memo(fu),we="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%23925BFF'/%3e%3cpath%20d='M11.9971%2011.265C15.249%2011.265%2017.8891%2010.443%2017.8891%209.423V7.95288C17.8891%206.93291%2015.2492%206.11084%2011.9971%206.11084C8.74513%206.11084%206.10504%206.93276%206.10504%207.95288V9.42285C6.10504%2010.437%208.73898%2011.265%2011.9971%2011.265Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2014.577C15.249%2014.577%2017.8891%2013.7551%2017.8891%2012.7349V10.527C17.8891%2011.5469%2015.2492%2012.369%2011.9971%2012.369C8.74513%2012.369%206.10504%2011.5471%206.10504%2010.527V12.7349C6.10504%2013.749%208.73898%2014.577%2011.9971%2014.577Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2015.681C8.7451%2015.681%206.11102%2014.859%206.11102%2013.839V16.0469C6.11102%2017.0609%208.74496%2017.889%2012.0031%2017.889C15.255%2017.889%2017.8951%2017.0671%2017.8951%2016.0469V13.8391C17.889%2014.859%2015.249%2015.681%2011.9971%2015.681Z'%20fill='white'/%3e%3c/svg%3e",Pe=10,Fu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h,disabled:F})=>{const[b,p]=_([]),[i,B]=_([]),[z,y]=_(!1),f=ne(null),{fetchDatabases:R}=de({url:n,token:s,role:a,eventsEmit:u});W(()=>{x()},[]),W(()=>{if(h){let t=[];(h||[]).map(r=>{const d=(b||[]).find(E=>E.key===r.key);if(d){const{key:E,label:m}=d;t.push({key:E,label:m})}}),B(t)}},[h,b]);const x=async()=>{try{const t=await R();if(t){const r=(t||[]).map(d=>({key:d.primitiveName,label:d.name}));p(r)}}catch(t){console.error(t)}},j=(t,r)=>{switch(t){case"removeItem":const d=i.filter(E=>E.key!==r.key);B([...d]),u&&u("database_selected",d);break}},l=()=>{var r;const t=((r=f.current)==null?void 0:r.getSelectedItems())||[];B(t),y(!1),u&&u("database_selected",t)};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>y(!0),disabled:i.length>=Pe||F,children:"\u6DFB\u52A0"})})]}),(i==null?void 0:i.length)>0&&e(Ce,{countText:(i==null?void 0:i.length)>0?`\u5DF2\u9009\uFF1A${i==null?void 0:i.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:j,data:i}),e(Ee,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:z,onOk:l,onCancel:()=>y(!1),destroyOnHidden:!0,children:e(he,{ref:f,dataSource:b,value:i,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Pe,renderItem:t=>c("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.label,children:t.label})]}),renderSelectedItem:(t,r)=>c("div",{className:"flex items-center",children:[e("img",{src:we,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:t.label})})]})})})]})},xe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%2300C1B8'/%3e%3cpath%20d='M17.9887%2012.582C18.1207%2013.6621%2017.2267%2014.5801%2016.1526%2014.4901C15.3306%2014.4181%2014.6645%2013.7521%2014.6045%2012.924C14.5745%2012.558%2014.6645%2012.21%2014.8445%2011.9159C14.9285%2011.7779%2014.9045%2011.6039%2014.8025%2011.4899L14.3885%2011.0339C14.2805%2010.9139%2014.1005%2010.8839%2013.9565%2010.9559C13.6144%2011.1239%2013.2304%2011.2199%2012.8224%2011.2199C12.6244%2011.2199%2012.4324%2011.1959%2012.2464%2011.1539C12.0963%2011.1179%2011.9463%2011.1779%2011.8563%2011.3039L11.2803%2012.1259C11.1783%2012.276%2011.1963%2012.474%2011.3223%2012.606C11.8983%2013.188%2012.2464%2013.9921%2012.2284%2014.8741C12.1924%2016.4702%2010.9203%2017.7963%209.32417%2017.9043C7.45804%2018.0243%205.90994%2016.4942%206.00595%2014.6281C6.08995%2013.038%207.38604%2011.7599%208.97614%2011.6879C9.42017%2011.6699%209.8402%2011.7419%2010.2302%2011.8919C10.3922%2011.9519%2010.5722%2011.8979%2010.6743%2011.7599L11.1663%2011.0579C11.2743%2010.9019%2011.2503%2010.6919%2011.1123%2010.5658C10.5302%2010.0498%2010.1882%209.26976%2010.2662%208.4177C10.3742%207.18162%2011.3823%206.18556%2012.6244%206.09555C14.1245%205.98154%2015.3846%207.17562%2015.3846%208.65172C15.3846%209.20376%2015.2106%209.70779%2014.9105%2010.1278C14.8085%2010.2658%2014.8205%2010.4578%2014.9345%2010.5898L15.3786%2011.0819C15.4746%2011.1899%2015.6306%2011.2259%2015.7626%2011.1779C16.0086%2011.0939%2016.2786%2011.0639%2016.5606%2011.1119C17.3047%2011.2259%2017.8987%2011.8319%2017.9887%2012.582Z'%20fill='white'/%3e%3c/svg%3e",Eu=({url:n,token:s,role:a,eventsEmit:u,sectionData:h})=>{const[F,b]=_([]),[p,i]=_([]),[B,z]=_(!1),y=ne(null),{fetchGraphs:f}=de({url:n,token:s,role:a,eventsEmit:u});W(()=>{R()},[]),W(()=>{if(h){let t=[];(h||[]).map(r=>{const d=(F||[]).find(E=>E.key===r.index_name);if(d){const{key:E,label:m}=d;t.push({key:E,label:m})}}),i(t)}},[h,F]);const R=async()=>{try{const t=await f();if(t!=null&&t.dataList){const r=((t==null?void 0:t.dataList)||[]).map(d=>({key:d.schemaId,label:d.name}));b(r)}}catch(t){console.error(t)}},x=(t,r)=>{switch(t){case"removeItem":const d=p.filter(E=>E.key!==r.key);i([...d]),j(d);break}},j=t=>{const r=(t||[]).map(d=>({graph_name:d.label,index_name:d.key}));u&&u("graph_selected",r)},l=()=>{var r;const t=((r=y.current)==null?void 0:r.getSelectedItems())||[];i(t),z(!1),j(t)};return c("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[c("div",{className:"flex items-center justify-between",children:[c("div",{className:"flex items-center",children:[e("img",{src:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(se,{color:"primary",variant:"outlined",size:"small",icon:e(Fe,{size:14}),onClick:()=>z(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(Ce,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:x,data:p}),e(Ee,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>z(!1),children:e(he,{ref:y,dataSource:F,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:t=>c("div",{className:"flex ",children:[e("img",{src:xe,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.label,children:t.label})]}),renderSelectedItem:t=>c("div",{className:"flex items-center",children:[e("img",{src:xe,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:t.label})})]})})})]})},Cu=({value:n,onChange:s,min:a,max:u,step:h,disabled:F,sliderStyle:b,inputStyle:p,inputWidth:i=90})=>{const B=y=>{const f=Array.isArray(y)?y[0]:y;s==null||s(f)},z=y=>{s==null||s(y)};return c(Ge,{style:{width:"100%"},children:[e(Ze,{min:a,max:u,step:h,disabled:F,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Ue,{min:a,max:u,step:h,disabled:F,controls:!1,value:n,onChange:z,style:{width:i,...p}})]})},{Item:Bu}=ce,ae=({label:n,name:s,configScale:a})=>{const u=ie(()=>a[s],[a]),h=(F,b)=>({validator(p,i){return i==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+i!="number"||isNaN(+i)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):i<F||i>b?Promise.reject(`\u8BF7\u8F93\u5165${F}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(te,{span:12,children:e(Bu,{label:n,name:s,tooltip:u.tooltip,rules:[{required:!0,message:""},h(u.min,u.max)],children:e(Cu,{min:u.min,max:u.max,step:u.step})})})},{Item:M}=ce,Du=({url:n,token:s,role:a,id:u,showDatabase:h,showGraph:F,isShare:b,disabled:p,eventsEmit:i,CustomComponents:B})=>{const{ContentLoading:z}=B,[y]=ce.useForm(),[f,R]=_(),[x,j]=_(),[l,t]=_(),[r,d]=_(),[E,m]=_(!0),[D,k]=_(!1),[I,Z]=_(ue),g=ne({}),{getConfigById:A,fetchModels:N,fetchConfigItemLimit:$,checkName:o,addConversationAssistant:v,updateConversationAssistant:w}=de({url:n,token:s,role:a,eventsEmit:i});W(()=>{H()},[u]),W(()=>{u?(Array.isArray(x)&&Array.isArray(l)&&y.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name"]),Array.isArray(r)&&y.validateFields(["multi_model_name"])):(Array.isArray(x)&&(x==null?void 0:x.length)==0&&y.validateFields(["model_name","plan_model_name","recommend_model_name"]),Array.isArray(l)&&(l==null?void 0:l.length)==0&&y.validateFields(["rerank_model_name"]),Array.isArray(r)&&(r==null?void 0:r.length)==0&&y.validateFields(["multi_model_name"]))},[l,x,r,u]);const H=async()=>{let C;if(u){E||m(!0);try{const S=await A(u);if(S){const{configJson:L,...X}=S,K=L&&JSON.parse(L),{knowledge_base_name:ee,knowledge_base_name_source:G,selectedKnowledgeBase:J,sensitiveWordIds:T,database_name:P,graph_nb_name:U}=K;C={...X,...K},g.current={knowledge_base_name:ee,knowledge_base_name_source:G,selectedKnowledgeBase:J,sensitiveWordIds:T,database_name:P,graph_nb_name:U},R(C),console.log("_configData--->",C),y.setFieldsValue(C),m(!1)}}catch{}}else m(!1);await V(C)},V=async C=>{var S,L,X;try{const[K,ee,G,J]=await Promise.allSettled([N({pageNum:1,pageSize:9999,status:1,type:1}),N({pageNum:1,pageSize:9999,status:1,type:3}),N({pageNum:1,pageSize:9999,status:1,type:4}),$()]);if(K.status==="fulfilled"&&K.value){const P=(((S=K.value)==null?void 0:S.records)||[]).map(U=>({...U,label:U.modelName,value:U.modelName}));j(P)}if(ee.status==="fulfilled"&&ee.value){const T=(((L=ee.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));t(T),T.length>0&&!(C!=null&&C.rerank_model_name)&&y.setFieldsValue({rerank_model_name:T[0].value})}if(G.status==="fulfilled"&&G.value){const T=(((X=G.value)==null?void 0:X.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));d(T),T.length>0&&!(C!=null&&C.multi_model_name)&&y.setFieldsValue({multi_model_name:T[0].value})}if(J.status==="fulfilled"&&J.value&&J.value){const T=J.value;Object.keys(ue).forEach(P=>{if(T.hasOwnProperty(P)){const{max:U,min:je}=T[P];ue[P]={...ue[P],min:je,max:U}}}),Z(ue)}}catch(K){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",K)}},Q=async(C,S)=>await o(S,u)?(Be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),le=(C,S)=>({validator(L,X){return X?Array.isArray(C)&&C.length===0||!C.find(K=>K.value==X)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(C)&&C.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject(S)}}),me=(C,S)=>{switch(console.log("++++\u52A9\u624B\u914D\u7F6E",C,S),C){case"knowledge_selected":g.current={...g.current,...S};break;case"sensitive_selected":g.current={...g.current,sensitiveWordIds:S};break;case"database_selected":g.current={...g.current,database_name:S};break;case"graph_selected":g.current={...g.current,graph_nb_name:S};break}},Te=async()=>{var S;let C={};try{k(!0);const L=await y.validateFields(),{knowledge_base_name:X,knowledge_base_name_source:K,selectedKnowledgeBase:ee,sensitiveWordIds:G,database_name:J,graph_nb_name:T}=g.current;L.thinking=((S=x.find(U=>U.modelName==L.model_name))==null?void 0:S.thinking)||!1,C={configJson:JSON.stringify({...L,knowledge_base_name:X,knowledge_base_name_source:K,selectedKnowledgeBase:ee,sensitiveWordIds:G,...h?{database_name:J}:{},...F?{graph_nb_name:T}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:G},u?await w(u,C)&&(Be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),i&&i("go_back")):await v(C)&&(Be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),i&&i("go_back"))}catch(L){console.error("submit error",L)}finally{k(!1)}},Re=ie(()=>{const C={};return Object.keys(ue).forEach(S=>{var L;C[S]=(L=ue[S])==null?void 0:L.default}),{...nu,...C}},[]);return c("div",{style:{height:"100%",width:"100%"},children:[c("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[c("div",{className:"flex items-center",children:[e(Je,{color:"#2468F2",onClick:()=>i&&i("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:u?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!E&&e(se,{type:"primary",onClick:()=>Te(),loading:D,disabled:p,children:"\u786E\u5B9A"})]}),E?z&&e(z,{}):e(ce,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:y,layout:"vertical",initialValues:Re,disabled:p,colon:!1,children:c(re,{gutter:24,style:{height:"100%"},children:[c(te,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:Q}],children:e(fe,{placeholder:"\u8BF7\u8F93\u5165"})}),c(re,{gutter:16,children:[e(te,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},le(x,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:x,notFoundContent:e(oe,{})})})}),e(te,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},le(x,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:x,notFoundContent:e(oe,{})})})})]}),c(re,{gutter:16,children:[e(te,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},le(r,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:r,notFoundContent:e(oe,{})})})}),e(te,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},le(l,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:l,notFoundContent:e(oe,{})})})})]}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:Qe,children:e(fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${uu}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:C=>C===!0?1:0,children:e(_e,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),c(te,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[c(ye,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},le(x,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:x,notFoundContent:e(oe,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(Y,{options:su,placeholder:"\u8BF7\u9009\u62E9"})}),c(re,{gutter:16,children:[e(ae,{label:"\u6E29\u5EA6",name:"temperature",configScale:I}),e(ae,{label:"\u591A\u6837\u6027",name:"top_p",configScale:I})]}),c(re,{gutter:16,children:[e(ae,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:I}),e(ae,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:I})]}),c(re,{gutter:16,children:[e(ae,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:I}),e(ae,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:I})]})]}),c(ye,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(pe,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:eu,normalize:C=>C===!0?1:0,children:e(pe,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(pe,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(pe,{})}),e(M,{noStyle:!0,shouldUpdate:(C,S)=>C.need_trace_source!==S.need_trace_source,children:({getFieldValue:C})=>C("need_trace_source")?c(Me,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(Y,{placeholder:"\u8BF7\u9009\u62E9",options:ru})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(_e,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),c(ye,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(pu,{url:n,token:s,role:a,sectionData:f==null?void 0:f.sensitiveWordIds,eventsEmit:me,defaultAnswer:f==null?void 0:f.defaultAnswer,form:y}),e(gu,{url:n,token:s,role:a,sectionData:{knowledge_base_name:f==null?void 0:f.knowledge_base_name,knowledge_base_name_source:f==null?void 0:f.knowledge_base_name_source,selectedKnowledgeBase:f==null?void 0:f.selectedKnowledgeBase},createBy:b?f==null?void 0:f.createBy:void 0,eventsEmit:me}),h&&e(Fu,{url:n,token:s,role:a,disabled:p,sectionData:f==null?void 0:f.database_name,eventsEmit:me}),F&&e(Eu,{url:n,token:s,role:a,sectionData:f==null?void 0:f.graph_nb_name,eventsEmit:me})]})]})]})})]})};export{Du as C,Ye as S};
@@ -1,4 +1,4 @@
1
- import{jsxs as Ee,jsx as B,Fragment as _l}from"react/jsx-runtime";import*as p from"react";import X,{forwardRef as sr,createElement as Ya,version as dm,useMemo as _t,useState as vt,useRef as Pe,useCallback as Xe,useEffect as wt,useImperativeHandle as Ki,createContext as Li,useContext as An,Children as fm,useLayoutEffect as pm,isValidElement as mm}from"react";import{l as gm,b as hm,a as vm,J as ym,i as bm}from"./index-x8IlxRuv.js";import{d as Ht,c as xm,h as Cm,i as Js}from"./index-g-SUxfJH.js";import"./style-CGmZ5osp.js";import*as wm from"react-dom";import $s,{flushSync as Xa,createPortal as dd,unstable_batchedUpdates as km}from"react-dom";var Gr=(e=>(e.FLAT="files",e.NAV="nav",e))(Gr||{});const Em=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-2xl font-bold",children:"\u5E94\u7528\u52A0\u8F7D\u4E2D..."})}),Sm=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-2xl font-bold",children:"\u5E94\u7528\u9519\u8BEF"})}),Am=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-lg font-medium",children:"\u5BB9\u5668\u52A0\u8F7D\u4E2D..."})}),Om=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-lg font-medium",children:"\u5BB9\u5668\u9519\u8BEF"})}),Im=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-base font-medium",children:"\u5185\u5BB9\u52A0\u8F7D\u4E2D..."})}),Nm=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-base font-medium",children:"\u5185\u5BB9\u9519\u8BEF"})}),Mm=({viewType:e,cardType:t})=>Ee("div",{className:"main relative h-full w-full flex flex-col items-center justify-center",children:[B("div",{className:"text-6xl mb-4",style:{color:"#d1d5db"},children:"\u{1F4ED}"}),B("div",{className:"text-lg font-medium mb-2",style:{color:"#6b7280"},children:e==="card"?"\u6682\u65E0\u6570\u636E":e==="table"?"\u6682\u65E0\u8868\u683C\u6570\u636E":"\u6682\u65E0\u6570\u636E"}),B("div",{className:"text-sm",style:{color:"#9ca3af"},children:e==="card"?"\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\u6DFB\u52A0\u6570\u636E":e==="table"?"\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5230\u8868\u683C\u4E2D":"\u8BF7\u5148\u6DFB\u52A0\u6570\u636E"})]}),xn=(e,t)=>{console.log("[findNodeById] Searching for id:",t,"in nodes:",e);for(const n of e){if(console.log("[findNodeById] Checking node:",n),n.id===t)return console.log("[findNodeById] Found node:",n),n;if(n.children){const r=Array.isArray(n.children)?n.children:Object.values(n.children);console.log("[findNodeById] Searching in children:",r);const o=xn(r,t);if(o)return console.log("[findNodeById] Found in children:",o),o}}return console.log("[findNodeById] Node not found for id:",t),null},Za=e=>{for(const t of e){if(t.type)return t.id;if(t.children){const n=Array.isArray(t.children)?t.children:Object.values(t.children),r=Za(n);if(r)return r}}},Pm=e=>{const t=n=>{let r=[];return n.children&&(r=Array.isArray(n.children)?n.children:Object.values(n.children)),{title:n.label,key:n.id,children:r.length>0?r.map(t):void 0,selectable:!0}};return e.map(t)},Fm=(e,t)=>Array.isArray(e)?t==="table"?e.filter(n=>n&&n.data&&Array.isArray(n.data)):e:e&&typeof e=="object"?[e]:[],Rm=e=>{const t=new Set;return e.forEach(n=>{n.adding&&t.add(n.id)}),t},Bm=(e,t)=>{const[n,r]=vt(()=>{const g=Array.isArray(e)?e:[];return console.log("[useAppState] \u521D\u59CB\u5316innerData:",g),g}),[o,i]=vt(new Set),[a,s]=vt(new Set),[l,c]=vt(""),[u,d]=vt([]);wt(()=>{if(console.log("[useAppState] \u6570\u636E\u6E90\u53D8\u5316:",{dataSource:e,activeNodeType:t}),t==="form"){const f=Array.isArray(e)?e:[];r(f);return}const g=Fm(e,t);console.log("[useAppState] \u9A8C\u8BC1\u540E\u7684\u6570\u636E:",g),r(g);const v=Rm(g);s(v),d([])},[e,t]);const m=Xe(()=>{d([]),c(""),i(new Set)},[]);return{innerData:n,setInnerData:r,pendingIds:o,setPendingIds:i,addingIds:a,setAddingIds:s,fuzzyValue:l,setFuzzyValue:c,selectedIds:u,setSelectedIds:d,resetStateOnNodeChange:m}},jm=(e,t,n,r,o,i,a)=>{const s=Xe((S,M)=>{const{tableId:P,...O}=M||{};M!=null&&M.animate?(r(S.id),e(N=>{if(P)return N.map(R=>{if(R.id===P){const T=[...R.children||[],{...S,adding:!0}];return{...R,children:T}}return R});const F={...S,adding:!0};if((O==null?void 0:O.position)==="start"||(O==null?void 0:O.position)===void 0)return[F,...N];if(typeof(O==null?void 0:O.position)=="number"){const R=[...N];return R.splice(O.position,0,F),R}return[F,...N]})):e(N=>{if(P)return N.map(F=>{if(F.id===P){const R=[...F.children||[],S];return{...F,children:R}}return F});if((O==null?void 0:O.position)==="start")return[S,...N];if(typeof(O==null?void 0:O.position)=="number"){const F=[...N];return F.splice(O.position,0,S),F}return[...N,S]})},[e,r]),l=Xe((S,M)=>{S&&e(P=>{if(!Array.isArray(P))return console.warn("[useAppFunctions] removeItem: prev\u4E0D\u662F\u6570\u7EC4\uFF0C\u91CD\u7F6E\u4E3A\u7A7A\u6570\u7EC4"),[];if(M)return P.map(N=>{if(N.id===M&&N.children){const F=N.children.map(R=>R.id===S?{...R,removing:!0}:R);return{...N,children:F}}return N});const O=P.map(N=>N.id===S?{...N,removing:!0}:N);return console.log("[useAppFunctions] removeItem \u8BBE\u7F6Eremoving",S,O),O})},[e]),c=Xe((S,M)=>{e(P=>Array.isArray(P)?P.map(O=>{if(O.id===M&&O.children){const N=O.children.filter(F=>F.id!==S);if(N.length===0){const{children:F,...R}=O;return R}return{...O,children:N}}return O}):[])},[e]),u=Xe((S,M)=>{!S||S.length===0||e(P=>{if(!Array.isArray(P))return console.warn("[useAppFunctions] removeItems: prev\u4E0D\u662F\u6570\u7EC4\uFF0C\u91CD\u7F6E\u4E3A\u7A7A\u6570\u7EC4"),[];if(M)return P.map(N=>{if(N.id===M&&N.children){const F=N.children.map(R=>S.includes(R.id)?{...R,removing:!0}:R);return{...N,children:F}}return N});const O=P.map(N=>S.includes(N.id)?{...N,removing:!0}:N);return console.log("[useAppFunctions] removeItems \u8BBE\u7F6Eremoving",S,O),O})},[e]),d=Xe(S=>{e(M=>{const P=M.find(O=>O.id===S);return P?P.hasOwnProperty("children")?(console.error(`[addSubTable] \u884C ${S} \u5DF2\u7ECF\u6709\u5B50table\u529F\u80FD\uFF0C\u65E0\u9700\u91CD\u590D\u6DFB\u52A0`),M):M.map(O=>O.id===S?{...O,children:[]}:O):(console.error(`[addSubTable] \u672A\u627E\u5230ID\u4E3A ${S} \u7684\u884C`),M)})},[e]),m=Xe(S=>{e(M=>{const P=M.find(N=>N.id===S);if(!P)return console.error(`[deleteSubTable] \u672A\u627E\u5230ID\u4E3A ${S} \u7684\u884C`),M;if(!P.hasOwnProperty("children"))return console.error(`[deleteSubTable] \u884C ${S} \u6CA1\u6709\u5B50table\u529F\u80FD`),M;const O=(P.children||[]).filter(N=>!N.removing).length;return O>0?(console.error(`[deleteSubTable] \u884C ${S} \u7684\u5B50table\u8FD8\u6709 ${O} \u6761\u6570\u636E\uFF0C\u65E0\u6CD5\u5220\u9664\u5B50table\u529F\u80FD\u3002\u8BF7\u5148\u5220\u9664\u6240\u6709\u5B50table\u6570\u636E\u3002`),M):M.map(N=>{if(N.id===S&&N.hasOwnProperty("children")){const{children:F,...R}=N;return R}return N})})},[e]),g=Xe((S,M,P)=>{M&&e(O=>O.map(N=>P&&N.id===P&&N.children?{...N,children:N.children.map(F=>F.id===M&&typeof F=="object"?v(F,S):F)}:N.id===M&&typeof N=="object"?v(N,S):N))},[e]),v=Xe((S,M)=>{if(Array.isArray(M)){const P=[...S.data];return M.forEach(O=>{const N=P.findIndex(F=>F.columnId===O.columnId);N>=0?P[N]={...P[N],value:O.value}:P.push(O)}),{...S,data:P}}else if(typeof M=="object")return{...S,...M};return S},[]),f=Xe(S=>{if(!S)return;const M=document.querySelector(`[data-item-id="${S}"]`);M&&M.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},[]),h=Xe((S,M)=>{e(M?P=>P.map(O=>{if(O.id!==M)return O;if(!O.hasOwnProperty("children"))return console.warn(`[useAppFunctions] \u884C ${M} \u6CA1\u6709children\u5B57\u6BB5\uFF0C\u8DF3\u8FC7\u66F4\u65B0`),O;const N=O.children||[],F=N.findIndex(R=>R.id===S.id);if(F>=0){const R=[...N];return R[F]=S,{...O,children:R}}else return{...O,children:[...N,S]}}):Array.isArray(S)?S:[])},[e]);Xe(S=>{e(M=>Array.isArray(M)?Array.isArray(S)?[...M,...S]:M:Array.isArray(S)?S:[])},[e]);const y=Xe(S=>{t(S)},[t]),x=Xe(S=>{e(M=>M.map(P=>P.id===S?{...P,tableLoading:!0}:P))},[e]),b=Xe(S=>{e(M=>M.map(P=>P.id===S?{...P,tableLoading:!1}:P))},[e]),E=Xe(S=>{n(S)},[n]),w=Xe(S=>i.has(S),[i]),k=Xe(S=>{r(S)},[r]),A=Xe(S=>{o(S)},[o]),C=Xe(S=>a.has(S),[a]);return{addItem:s,removeItem:l,removeItems:u,updateItem:g,scrollToItem:f,syncSourceData:h,addPending:y,removePending:E,isPending:w,addAdding:k,removeAdding:A,isAdding:C,tablePending:x,removeTablePending:b,addSubTable:d,deleteSubTable:m,removeSubTableRow:c}};/**
1
+ import{jsxs as Ee,jsx as B,Fragment as _l}from"react/jsx-runtime";import*as p from"react";import X,{forwardRef as sr,createElement as Ya,version as dm,useMemo as _t,useState as vt,useRef as Pe,useCallback as Xe,useEffect as wt,useImperativeHandle as Ki,createContext as Li,useContext as An,Children as fm,useLayoutEffect as pm,isValidElement as mm}from"react";import{l as gm,b as hm,a as vm,J as ym,i as bm}from"./index-DJPAws60.js";import{d as Ht,c as xm,h as Cm,i as Js}from"./index-antI2hFx.js";import"./style-BeYL_E4J.js";import*as wm from"react-dom";import $s,{flushSync as Xa,createPortal as dd,unstable_batchedUpdates as km}from"react-dom";var Gr=(e=>(e.FLAT="files",e.NAV="nav",e))(Gr||{});const Em=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-2xl font-bold",children:"\u5E94\u7528\u52A0\u8F7D\u4E2D..."})}),Sm=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-2xl font-bold",children:"\u5E94\u7528\u9519\u8BEF"})}),Am=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-lg font-medium",children:"\u5BB9\u5668\u52A0\u8F7D\u4E2D..."})}),Om=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-lg font-medium",children:"\u5BB9\u5668\u9519\u8BEF"})}),Im=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-base font-medium",children:"\u5185\u5BB9\u52A0\u8F7D\u4E2D..."})}),Nm=()=>B("div",{className:"main relative h-full w-full flex items-center justify-center",children:B("div",{className:"text-base font-medium",children:"\u5185\u5BB9\u9519\u8BEF"})}),Mm=({viewType:e,cardType:t})=>Ee("div",{className:"main relative h-full w-full flex flex-col items-center justify-center",children:[B("div",{className:"text-6xl mb-4",style:{color:"#d1d5db"},children:"\u{1F4ED}"}),B("div",{className:"text-lg font-medium mb-2",style:{color:"#6b7280"},children:e==="card"?"\u6682\u65E0\u6570\u636E":e==="table"?"\u6682\u65E0\u8868\u683C\u6570\u636E":"\u6682\u65E0\u6570\u636E"}),B("div",{className:"text-sm",style:{color:"#9ca3af"},children:e==="card"?"\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\u6DFB\u52A0\u6570\u636E":e==="table"?"\u8BF7\u5148\u6DFB\u52A0\u6570\u636E\u5230\u8868\u683C\u4E2D":"\u8BF7\u5148\u6DFB\u52A0\u6570\u636E"})]}),xn=(e,t)=>{console.log("[findNodeById] Searching for id:",t,"in nodes:",e);for(const n of e){if(console.log("[findNodeById] Checking node:",n),n.id===t)return console.log("[findNodeById] Found node:",n),n;if(n.children){const r=Array.isArray(n.children)?n.children:Object.values(n.children);console.log("[findNodeById] Searching in children:",r);const o=xn(r,t);if(o)return console.log("[findNodeById] Found in children:",o),o}}return console.log("[findNodeById] Node not found for id:",t),null},Za=e=>{for(const t of e){if(t.type)return t.id;if(t.children){const n=Array.isArray(t.children)?t.children:Object.values(t.children),r=Za(n);if(r)return r}}},Pm=e=>{const t=n=>{let r=[];return n.children&&(r=Array.isArray(n.children)?n.children:Object.values(n.children)),{title:n.label,key:n.id,children:r.length>0?r.map(t):void 0,selectable:!0}};return e.map(t)},Fm=(e,t)=>Array.isArray(e)?t==="table"?e.filter(n=>n&&n.data&&Array.isArray(n.data)):e:e&&typeof e=="object"?[e]:[],Rm=e=>{const t=new Set;return e.forEach(n=>{n.adding&&t.add(n.id)}),t},Bm=(e,t)=>{const[n,r]=vt(()=>{const g=Array.isArray(e)?e:[];return console.log("[useAppState] \u521D\u59CB\u5316innerData:",g),g}),[o,i]=vt(new Set),[a,s]=vt(new Set),[l,c]=vt(""),[u,d]=vt([]);wt(()=>{if(console.log("[useAppState] \u6570\u636E\u6E90\u53D8\u5316:",{dataSource:e,activeNodeType:t}),t==="form"){const f=Array.isArray(e)?e:[];r(f);return}const g=Fm(e,t);console.log("[useAppState] \u9A8C\u8BC1\u540E\u7684\u6570\u636E:",g),r(g);const v=Rm(g);s(v),d([])},[e,t]);const m=Xe(()=>{d([]),c(""),i(new Set)},[]);return{innerData:n,setInnerData:r,pendingIds:o,setPendingIds:i,addingIds:a,setAddingIds:s,fuzzyValue:l,setFuzzyValue:c,selectedIds:u,setSelectedIds:d,resetStateOnNodeChange:m}},jm=(e,t,n,r,o,i,a)=>{const s=Xe((S,M)=>{const{tableId:P,...O}=M||{};M!=null&&M.animate?(r(S.id),e(N=>{if(P)return N.map(R=>{if(R.id===P){const T=[...R.children||[],{...S,adding:!0}];return{...R,children:T}}return R});const F={...S,adding:!0};if((O==null?void 0:O.position)==="start"||(O==null?void 0:O.position)===void 0)return[F,...N];if(typeof(O==null?void 0:O.position)=="number"){const R=[...N];return R.splice(O.position,0,F),R}return[F,...N]})):e(N=>{if(P)return N.map(F=>{if(F.id===P){const R=[...F.children||[],S];return{...F,children:R}}return F});if((O==null?void 0:O.position)==="start")return[S,...N];if(typeof(O==null?void 0:O.position)=="number"){const F=[...N];return F.splice(O.position,0,S),F}return[...N,S]})},[e,r]),l=Xe((S,M)=>{S&&e(P=>{if(!Array.isArray(P))return console.warn("[useAppFunctions] removeItem: prev\u4E0D\u662F\u6570\u7EC4\uFF0C\u91CD\u7F6E\u4E3A\u7A7A\u6570\u7EC4"),[];if(M)return P.map(N=>{if(N.id===M&&N.children){const F=N.children.map(R=>R.id===S?{...R,removing:!0}:R);return{...N,children:F}}return N});const O=P.map(N=>N.id===S?{...N,removing:!0}:N);return console.log("[useAppFunctions] removeItem \u8BBE\u7F6Eremoving",S,O),O})},[e]),c=Xe((S,M)=>{e(P=>Array.isArray(P)?P.map(O=>{if(O.id===M&&O.children){const N=O.children.filter(F=>F.id!==S);if(N.length===0){const{children:F,...R}=O;return R}return{...O,children:N}}return O}):[])},[e]),u=Xe((S,M)=>{!S||S.length===0||e(P=>{if(!Array.isArray(P))return console.warn("[useAppFunctions] removeItems: prev\u4E0D\u662F\u6570\u7EC4\uFF0C\u91CD\u7F6E\u4E3A\u7A7A\u6570\u7EC4"),[];if(M)return P.map(N=>{if(N.id===M&&N.children){const F=N.children.map(R=>S.includes(R.id)?{...R,removing:!0}:R);return{...N,children:F}}return N});const O=P.map(N=>S.includes(N.id)?{...N,removing:!0}:N);return console.log("[useAppFunctions] removeItems \u8BBE\u7F6Eremoving",S,O),O})},[e]),d=Xe(S=>{e(M=>{const P=M.find(O=>O.id===S);return P?P.hasOwnProperty("children")?(console.error(`[addSubTable] \u884C ${S} \u5DF2\u7ECF\u6709\u5B50table\u529F\u80FD\uFF0C\u65E0\u9700\u91CD\u590D\u6DFB\u52A0`),M):M.map(O=>O.id===S?{...O,children:[]}:O):(console.error(`[addSubTable] \u672A\u627E\u5230ID\u4E3A ${S} \u7684\u884C`),M)})},[e]),m=Xe(S=>{e(M=>{const P=M.find(N=>N.id===S);if(!P)return console.error(`[deleteSubTable] \u672A\u627E\u5230ID\u4E3A ${S} \u7684\u884C`),M;if(!P.hasOwnProperty("children"))return console.error(`[deleteSubTable] \u884C ${S} \u6CA1\u6709\u5B50table\u529F\u80FD`),M;const O=(P.children||[]).filter(N=>!N.removing).length;return O>0?(console.error(`[deleteSubTable] \u884C ${S} \u7684\u5B50table\u8FD8\u6709 ${O} \u6761\u6570\u636E\uFF0C\u65E0\u6CD5\u5220\u9664\u5B50table\u529F\u80FD\u3002\u8BF7\u5148\u5220\u9664\u6240\u6709\u5B50table\u6570\u636E\u3002`),M):M.map(N=>{if(N.id===S&&N.hasOwnProperty("children")){const{children:F,...R}=N;return R}return N})})},[e]),g=Xe((S,M,P)=>{M&&e(O=>O.map(N=>P&&N.id===P&&N.children?{...N,children:N.children.map(F=>F.id===M&&typeof F=="object"?v(F,S):F)}:N.id===M&&typeof N=="object"?v(N,S):N))},[e]),v=Xe((S,M)=>{if(Array.isArray(M)){const P=[...S.data];return M.forEach(O=>{const N=P.findIndex(F=>F.columnId===O.columnId);N>=0?P[N]={...P[N],value:O.value}:P.push(O)}),{...S,data:P}}else if(typeof M=="object")return{...S,...M};return S},[]),f=Xe(S=>{if(!S)return;const M=document.querySelector(`[data-item-id="${S}"]`);M&&M.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},[]),h=Xe((S,M)=>{e(M?P=>P.map(O=>{if(O.id!==M)return O;if(!O.hasOwnProperty("children"))return console.warn(`[useAppFunctions] \u884C ${M} \u6CA1\u6709children\u5B57\u6BB5\uFF0C\u8DF3\u8FC7\u66F4\u65B0`),O;const N=O.children||[],F=N.findIndex(R=>R.id===S.id);if(F>=0){const R=[...N];return R[F]=S,{...O,children:R}}else return{...O,children:[...N,S]}}):Array.isArray(S)?S:[])},[e]);Xe(S=>{e(M=>Array.isArray(M)?Array.isArray(S)?[...M,...S]:M:Array.isArray(S)?S:[])},[e]);const y=Xe(S=>{t(S)},[t]),x=Xe(S=>{e(M=>M.map(P=>P.id===S?{...P,tableLoading:!0}:P))},[e]),b=Xe(S=>{e(M=>M.map(P=>P.id===S?{...P,tableLoading:!1}:P))},[e]),E=Xe(S=>{n(S)},[n]),w=Xe(S=>i.has(S),[i]),k=Xe(S=>{r(S)},[r]),A=Xe(S=>{o(S)},[o]),C=Xe(S=>a.has(S),[a]);return{addItem:s,removeItem:l,removeItems:u,updateItem:g,scrollToItem:f,syncSourceData:h,addPending:y,removePending:E,isPending:w,addAdding:k,removeAdding:A,isAdding:C,tablePending:x,removeTablePending:b,addSubTable:d,deleteSubTable:m,removeSubTableRow:c}};/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.