@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
@@ -0,0 +1,51 @@
1
+ export const MODEL_TYPE_OPTIONS = [
2
+ { value: 1, label: 'Baichuan' },
3
+ { value: 2, label: 'Qwen' },
4
+ { value: 3, label: 'GLM' },
5
+ { value: 4, label: 'openAI' },
6
+ ];
7
+
8
+ export const MODEL_USE_TYPE_OPTIONS = [
9
+ { value: 1, label: 'LLM大语言模型' },
10
+ { value: 2, label: 'Embedding嵌入' },
11
+ { value: 3, label: 'rerank排序' },
12
+ { value: 4, label: 'MultiModel图片解析' },
13
+ ];
14
+
15
+ export const statusColorMap = {
16
+ success: 'green',
17
+ error: 'red',
18
+ warning: 'orange',
19
+ processing: 'blue',
20
+ info: 'cyan',
21
+ default: 'default',
22
+ };
23
+
24
+ export const statusArr = [
25
+ { statusType: 'success', value: '可用', status: 1 },
26
+ { statusType: 'error', value: '不可用', status: 0 },
27
+ { statusType: 'warning', value: '检测中', status: 2 },
28
+ ];
29
+
30
+ type StatusColorKey = keyof typeof statusColorMap;
31
+
32
+ export const getStatusColor = (statusType: unknown): string => {
33
+ if (typeof statusType === 'string' && (statusType as string) in statusColorMap) {
34
+ return statusColorMap[statusType as StatusColorKey];
35
+ }
36
+ return statusColorMap.default;
37
+ };
38
+
39
+ export enum OPT_BTN {
40
+ DATE = 0,
41
+ VIEW,
42
+ ERROR,
43
+ AUTHORIZE,
44
+ DELETE,
45
+ ANALYSIS_OR_EXTRACT,
46
+ DOWNLOAD,
47
+ EDIT,
48
+ ADD,
49
+ ANALYSIS_CONFIG,
50
+ AUTHORIZE_CONFIG,
51
+ }
@@ -0,0 +1,599 @@
1
+ import React, { useMemo, useState, useEffect, useRef } from 'react';
2
+ import { message, Modal, Badge, Tooltip } from 'antd';
3
+ import { Plus } from 'lucide-react';
4
+ import { DashboardContainer, defaultTheme, Styles, Button } from '@mxmweb/zui';
5
+ import { Xviwer, CustomComponents } from '@mxmweb/xviewer';
6
+
7
+ import EmptyImg from './assets/empty.png';
8
+ import AxiosInstance from './server';
9
+ import ConfigDrawer from './ConfigDrawer';
10
+ import ReplaceModal from './ReplaceModal';
11
+ import { getStatusColor, statusArr, OPT_BTN } from './const';
12
+
13
+ import '@mxmweb/zui/style.css';
14
+ import '@mxmweb/rtext/style.css';
15
+
16
+ const { confirm } = Modal;
17
+
18
+ const initPage = {
19
+ pageNum: 1,
20
+ pageSize: 1000,
21
+ };
22
+ interface ModelManageViewProps {
23
+ url?: string;
24
+ token?: string;
25
+ role?: string;
26
+ styles?: Styles;
27
+ CustomComponents?: CustomComponents;
28
+ eventsEmit?: (name: string, data: any) => void;
29
+ getBtnDisabled?: (type: OPT_BTN, permission: number) => boolean;
30
+ }
31
+
32
+ const StatusComponent = (props: any) => {
33
+ const { value, cell } = props;
34
+ const color = getStatusColor(props.cell.statusType);
35
+ if (value == '不可用') {
36
+ return (
37
+ <Tooltip title={cell.errorMsg}>
38
+ <div className="flex items-center gap-2">
39
+ <Badge color={color} text={value} />
40
+ </div>
41
+ </Tooltip>
42
+ );
43
+ } else {
44
+ return <Badge color={color} text={value} />;
45
+ }
46
+ };
47
+
48
+ export default function ModelManageView(props: ModelManageViewProps) {
49
+ const { url, token, role, CustomComponents, eventsEmit, getBtnDisabled } = props;
50
+
51
+ const [status, setStatus] = useState<any>({
52
+ container: 'ready',
53
+ content: 'ready',
54
+ });
55
+
56
+ // 创建ref来访问核心组件实例
57
+ const coreRef = useRef<any>(null);
58
+ const [data, setData] = useState<
59
+ {
60
+ id: string;
61
+ data?: any[];
62
+ }[]
63
+ >(); // 存储核心组件渲染的模型列表
64
+
65
+ // 轮询定时器引用,避免重复定时与内存泄漏
66
+ const pollTimerRef = useRef<any>(null);
67
+
68
+ // 检测状态按钮loading
69
+ const [testBtnLoading, setTestBtnLoading] = useState(false);
70
+ const [modalVisible, setModalVisible] = useState(false);
71
+ const [modelList, setModalList] = useState([]); //原始列表
72
+ // 抽屉状态管理
73
+ const [drawerVisible, setDrawerVisible] = useState(false);
74
+ const [drawerTitle, setDrawerTitle] = useState('');
75
+ const [modelInfo, setModelInfo] = useState<any>();
76
+
77
+ // 使用类型options
78
+ const [modelUseTypeOpt, setModelUseTypeOpt] = useState<{ label: string; value: string }[]>([]);
79
+ const [modelProtocolsOpt, setModelProtocolsOpt] = useState<{ label: string; value: string }[]>(
80
+ []
81
+ );
82
+ const {
83
+ getModelList,
84
+ delModelById,
85
+ createModel,
86
+ updateModelById,
87
+ getUseTypeList,
88
+ getModelProtocolsList,
89
+ testStatus,
90
+ replaceModel,
91
+ checkModel,
92
+ } = AxiosInstance({
93
+ url,
94
+ token,
95
+ role,
96
+ eventsEmit: eventsEmit,
97
+ });
98
+
99
+ // 模拟应用初始化过程
100
+ useEffect(() => {
101
+ setStatus((prev: any) => ({ ...prev, content: 'loading' }));
102
+ // handleModelList();
103
+ pollFetchList();
104
+ handleFetchList();
105
+ }, []);
106
+
107
+ useEffect(() => {
108
+ if (drawerVisible) {
109
+ }
110
+ }, [drawerVisible]);
111
+
112
+ const handleData = (data: any[]) => {
113
+ return (data || []).map((_t, i) => {
114
+ let status = statusArr.find((s: any) => s.status == _t.status);
115
+ return {
116
+ id: _t.id,
117
+ data: [
118
+ { columnId: 'modelName', value: _t.modelName },
119
+ {
120
+ columnId: 'modelProtocol',
121
+ value: _t.modelProtocol,
122
+ type: 'customized',
123
+ },
124
+ { columnId: 'type', value: _t.type, type: 'customized' },
125
+ { columnId: 'dec', value: _t.dec },
126
+ {
127
+ columnId: 'status',
128
+ ...status,
129
+ type: 'customized',
130
+ errorMsg: _t.errorMsg,
131
+ },
132
+ {
133
+ columnId: 'actions',
134
+ value: 'edit',
135
+ label: '编辑',
136
+ status: _t.status,
137
+ type: 'action',
138
+ disabled: getBtnDisabled && getBtnDisabled(OPT_BTN.EDIT, _t.permission),
139
+ },
140
+ {
141
+ columnId: 'actions',
142
+ value: 'auth',
143
+ label: '授权',
144
+ type: 'action',
145
+ status: _t.status,
146
+ disabled: getBtnDisabled && getBtnDisabled(OPT_BTN.AUTHORIZE, _t.permission),
147
+ },
148
+ {
149
+ columnId: 'actions',
150
+ value: 'delete',
151
+ label: '删除',
152
+ type: 'action',
153
+ status: _t.status,
154
+ disabled: getBtnDisabled && getBtnDisabled(OPT_BTN.AUTHORIZE, _t.permission),
155
+ },
156
+ { columnId: 'url', value: _t.url },
157
+ { columnId: 'apiKey', value: _t.apiKey },
158
+ { columnId: 'modelIde', value: _t.modelIde },
159
+ { columnId: 'thinking', value: _t.thinking },
160
+ ],
161
+ };
162
+ });
163
+ };
164
+
165
+ const handleFetchList = async () => {
166
+ try {
167
+ const [useTypeRes, modelProtocolsRes] = await Promise.allSettled([
168
+ getUseTypeList(),
169
+ getModelProtocolsList(),
170
+ ]);
171
+
172
+ if (useTypeRes.status === 'fulfilled' && useTypeRes.value) {
173
+ setModelUseTypeOpt(
174
+ (useTypeRes.value || []).map((o: any) => ({ ...o, value: Number(o.value) }))
175
+ );
176
+ }
177
+
178
+ if (modelProtocolsRes.status === 'fulfilled' && modelProtocolsRes.value) {
179
+ setModelProtocolsOpt(
180
+ (modelProtocolsRes.value || []).map((o: any) => ({ ...o, value: Number(o.value) }))
181
+ );
182
+ }
183
+ } catch (e) {
184
+ console.error('[TableApiError] getTableList:', e);
185
+ }
186
+ };
187
+
188
+ const handleModelList = async () => {
189
+ try {
190
+ const res = await getModelList(initPage);
191
+
192
+ if (res.records) {
193
+ const _data = handleData(res.records);
194
+ const _list = (res.records || []).map((c: any) => ({
195
+ value: c.id,
196
+ label: c.modelName,
197
+ useType: c.type,
198
+ status: c.status,
199
+ }));
200
+ setModalList(_list);
201
+ setData(_data || []);
202
+ setStatus((prev: any) => ({ ...prev, content: 'ready' }));
203
+ return _data || [];
204
+ }
205
+ } catch (e) {
206
+ console.error('[TableApiError] getTableList:', e);
207
+ }
208
+ };
209
+
210
+ // 轮询 handleFetchList,直到所有 status 完成
211
+ const pollFetchList = async () => {
212
+ const latest = await handleModelList();
213
+ const finished = isAllFinished(latest || []);
214
+ if (!finished) {
215
+ if (pollTimerRef.current) {
216
+ clearTimeout(pollTimerRef.current);
217
+ pollTimerRef.current = null;
218
+ }
219
+ pollTimerRef.current = setTimeout(() => {
220
+ pollFetchList();
221
+ }, 5000);
222
+ } else {
223
+ if (pollTimerRef.current) {
224
+ clearTimeout(pollTimerRef.current);
225
+ pollTimerRef.current = null;
226
+ }
227
+ }
228
+ };
229
+
230
+ // 检查所有数据及其 children 的 status 是否都不是 '11' 或 '20'
231
+ function isAllFinished(data: any[]): boolean {
232
+ if (!Array.isArray(data)) return true;
233
+
234
+ for (const item of data) {
235
+ if (item.data) {
236
+ const statusCell = item.data.find((d: any) => d.columnId === 'status');
237
+ // 导入中 20,导入中未建表 11,自动生成描述生成中,这三个状态时,轮询
238
+ if (statusCell && statusCell.status === 2) {
239
+ return false;
240
+ }
241
+ }
242
+ }
243
+ return true;
244
+ }
245
+
246
+ const viewConfig = useMemo(
247
+ () => ({
248
+ label: '数据库表格',
249
+ defaultActiveId: 'model-table',
250
+ model: null,
251
+ views: [
252
+ {
253
+ label: '模型',
254
+ id: 'model-table',
255
+ type: 'table' as const,
256
+ viewBehavior: 'pagination' as const, //or pagination
257
+ allowMultiSelect: false,
258
+ viewPageSize: 10,
259
+ columns: [
260
+ { id: 'modelName', title: '模型名称', type: 'label' },
261
+ {
262
+ id: 'modelProtocol',
263
+ title: '模型传输协议',
264
+ type: 'customized',
265
+ component: (props: any) => {
266
+ const { value } = props;
267
+ const modelProtocol = modelProtocolsOpt.find((o: any) => o.value == value)?.label;
268
+ return <span>{modelProtocol}</span>;
269
+ },
270
+ },
271
+ {
272
+ id: 'type',
273
+ title: '使用类型',
274
+ type: 'customized',
275
+ component: (props: any) => {
276
+ const { value } = props;
277
+ const type = modelUseTypeOpt.find((o: any) => o.value == value)?.label;
278
+ return <span>{type}</span>;
279
+ },
280
+ },
281
+ { id: 'dec', title: '说明', type: 'paragraph' },
282
+ {
283
+ id: 'status',
284
+ title: '状态',
285
+ type: 'customized',
286
+ component: <StatusComponent />,
287
+ helpText:
288
+ '当前模型状态为初次新增校验状态,若模型下线,此状态不会主动更新,需手动执行模型删除',
289
+ },
290
+ {
291
+ id: 'actions',
292
+ title: '操作',
293
+ type: 'customized',
294
+ component: (props: any) => {
295
+ const { value, cell, row } = props;
296
+ const { disabled, label, status } = cell;
297
+ if (status == 2) {
298
+ return (
299
+ <Tooltip title="检测中,请稍后">
300
+ <Button mode="text" label={label} disabled={true} />
301
+ </Tooltip>
302
+ );
303
+ } else if (disabled) {
304
+ return (
305
+ <Tooltip title="角色无权限操作">
306
+ <Button mode="text" label={label} disabled={disabled} />
307
+ </Tooltip>
308
+ );
309
+ } else {
310
+ return (
311
+ <Button
312
+ mode="text"
313
+ label={label}
314
+ onClick={() => handleEventsEmit(`table_action_${value}`, row, undefined)}
315
+ />
316
+ );
317
+ }
318
+ },
319
+ },
320
+ ],
321
+ toolbar: [
322
+ {
323
+ type: 'button' as const,
324
+ btnType: 'primary' as const,
325
+ key: 'add',
326
+ label: '新建',
327
+ icon: <Plus />,
328
+ },
329
+ // {
330
+ // type: 'customized' as const,
331
+ // key: 'test',
332
+ // render: () => {
333
+ // return (
334
+ // <Button
335
+ // loading={testBtnLoading}
336
+ // mode="primary"
337
+ // label="模型状态检测"
338
+ // onClick={() => {
339
+ // handleEventsEmit('toolbar_test');
340
+ // }}
341
+ // />
342
+ // );
343
+ // },
344
+ // },
345
+ // {
346
+ // type: 'button' as const,
347
+ // btnType: 'primary' as const,
348
+ // key: 'replace',
349
+ // label: '模型替换',
350
+ // },
351
+ ],
352
+ },
353
+ ],
354
+ }),
355
+ [data, modelUseTypeOpt, modelProtocolsOpt, testBtnLoading]
356
+ );
357
+
358
+ // 自定义空数据组件
359
+ const EmptyData: React.FC = () => (
360
+ <div className="flex flex-col items-center justify-center h-full">
361
+ <div className="text-xl font-semibold mb-3" style={{ color: '#374151' }}>
362
+ <img src={EmptyImg} width={120} />
363
+ </div>
364
+ <div className="text-base mb-6" style={{ color: '#6b7280' }}>
365
+ 暂无数据,请先新建模型
366
+ </div>
367
+ <div className="flex gap-3">
368
+ <Button
369
+ mode="primary"
370
+ label="新建模型"
371
+ onClick={() => {
372
+ setDrawerTitle('新建');
373
+ setDrawerVisible(true);
374
+ }}
375
+ />
376
+ </div>
377
+ </div>
378
+ );
379
+
380
+ // 事件分流函数,先处理核心层UI/动画,再决定是否向上透传
381
+ async function handleEventsEmit(name: string, data?: any, appFn?: any) {
382
+ console.log('[adopter] mergedEventsEmit', name, data, appFn);
383
+ // 1. 先处理核心层UI/动画/数据
384
+ switch (name) {
385
+ case 'toolbar_add': {
386
+ setDrawerTitle('新建');
387
+ setDrawerVisible(true);
388
+ break;
389
+ }
390
+ case 'toolbar_test': {
391
+ setTestBtnLoading(true);
392
+ const res = await testStatus();
393
+ if (res) {
394
+ setTestBtnLoading(false);
395
+ await pollFetchList();
396
+ message.success('模型检测中,请耐心等待状态更新!');
397
+ }
398
+ break;
399
+ }
400
+ case 'toolbar_replace': {
401
+ setModalVisible(true);
402
+
403
+ break;
404
+ }
405
+ case 'table_action_delete': {
406
+ try {
407
+ const name = data.data.find((d: any) => d.columnId == 'modelName').value;
408
+ // const res = await checkModel(name);
409
+ // if (res > 0) {
410
+ // confirm({
411
+ // title: '删除模型',
412
+ // content: (
413
+ // <div style={{ marginRight: '20px' }}>
414
+ // 当前模型在系统内已被配置使用,删除可能影响文档解析、问答、多模态能力使用等,请您先使用“模型一键替换”能力将该模型替换为同类型模型,再删除模型
415
+ // </div>
416
+ // ),
417
+ // okText: '确认',
418
+ // cancelText: '取消',
419
+ // });
420
+ // } else {
421
+ confirm({
422
+ title: '确认删除?',
423
+ content: `确定要删除模型 “${name}” 吗?此操作不可恢复。`,
424
+ okText: '删除',
425
+ cancelText: '取消',
426
+ async onOk() {
427
+ const res = await delModelById(data.id);
428
+ if (res && coreRef?.current) {
429
+ coreRef?.current.appFn.removeItem(data.id);
430
+ message.success(`删除成功`);
431
+ }
432
+ },
433
+ });
434
+ // }
435
+ } catch (e) {
436
+ console.error('删除表数据失败', e);
437
+ }
438
+ break;
439
+ }
440
+ case 'table_action_edit': {
441
+ setDrawerTitle('编辑');
442
+ setDrawerVisible(true);
443
+ setModelInfo(data);
444
+ break;
445
+ }
446
+ //新增模型
447
+ case 'form_submitted_add': {
448
+ try {
449
+ const _data = data.fields.reduce((acc: any, item: any) => {
450
+ acc[item.name] = item.value;
451
+ return acc;
452
+ }, {});
453
+ const res = await createModel({
454
+ ..._data,
455
+ });
456
+ if (res) {
457
+ let status = statusArr.find((s: any) => s.status == res.status);
458
+ const newModel = {
459
+ id: res.id,
460
+ data: [
461
+ ...(Object.keys(res) || []).map((key: any) => {
462
+ return {
463
+ columnId: key,
464
+ value: (res as any)[key],
465
+ ...((key == 'modelProtocol' || key == 'type') && {
466
+ type: 'customized',
467
+ }),
468
+ ...(key == 'status' && {
469
+ ...status,
470
+ type: 'customized',
471
+ errorMsg: (res as any).errorMsg,
472
+ }),
473
+ };
474
+ }),
475
+ { columnId: 'actions', value: 'edit', label: '编辑', type: 'action' },
476
+ { columnId: 'actions', value: 'auth', label: '授权', type: 'action' },
477
+ { columnId: 'actions', value: 'delete', label: '删除', type: 'action' },
478
+ ],
479
+ };
480
+ coreRef?.current?.appFn?.addItem(newModel, { animate: true, position: 'start' });
481
+ message.success('模型新增成功!');
482
+ }
483
+ } catch (e) {
484
+ console.error('保存失败!', e);
485
+ } finally {
486
+ handleDrawerClose();
487
+ }
488
+ break;
489
+ }
490
+
491
+ //修改模型配置
492
+ case 'form_submitted_edit': {
493
+ try {
494
+ const _data = data.fields.reduce((acc: any, item: any) => {
495
+ acc[item.name] = item.value;
496
+ return acc;
497
+ }, {});
498
+
499
+ const res = await updateModelById({
500
+ ..._data,
501
+ id: modelInfo.id,
502
+ });
503
+ if (res) {
504
+ let status = statusArr.find((s: any) => s.status == res.status);
505
+ const patch = {
506
+ ...modelInfo,
507
+ data: modelInfo.data.map((m: any) => {
508
+ if (res[m.columnId] !== null && res[m.columnId] !== undefined) {
509
+ if (m.columnId == 'status') {
510
+ return {
511
+ ...m,
512
+ ...status,
513
+ };
514
+ } else {
515
+ m.value = res[m.columnId];
516
+ }
517
+ }
518
+ return m;
519
+ }),
520
+ };
521
+ coreRef?.current?.appFn?.updateItem(patch, modelInfo?.id);
522
+ message.success('模型编辑成功!');
523
+ }
524
+ } catch (e) {
525
+ console.error('保存失败!', e);
526
+ } finally {
527
+ handleDrawerClose();
528
+ }
529
+ break;
530
+ }
531
+
532
+ case 'replace_model': {
533
+ await handleModelList();
534
+ setModalVisible(false);
535
+ break;
536
+ }
537
+ case 'close_model': {
538
+ setModalVisible(false);
539
+ break;
540
+ }
541
+
542
+ default:
543
+ // 2. 透传到业务层(如有需要)
544
+ if (typeof props.eventsEmit === 'function') {
545
+ props.eventsEmit(name, data);
546
+ }
547
+ break;
548
+ }
549
+ }
550
+ const handleDrawerClose = () => {
551
+ setDrawerVisible(false);
552
+ setModelInfo(undefined);
553
+ };
554
+ return (
555
+ <DashboardContainer title="模型管理">
556
+ <Xviwer
557
+ dataSource={data}
558
+ ref={coreRef}
559
+ eventsEmit={handleEventsEmit}
560
+ status={status}
561
+ CustomComponents={{
562
+ EmptyData,
563
+ ...CustomComponents,
564
+ }}
565
+ styles={{
566
+ theme: {
567
+ ...defaultTheme,
568
+ colors: {
569
+ ...defaultTheme.colors,
570
+ tableFirstColumnBg: '#ffffff',
571
+ tableLastColumnBg: '#ffffff',
572
+ paginationBackground: '#ffffff',
573
+ subTableBackground: '#F5F5F5',
574
+ tableHeaderBg: '#F5F5F5',
575
+ },
576
+ },
577
+ mode: 'light',
578
+ }}
579
+ {...viewConfig}
580
+ />
581
+ {/* 右侧抽屉 - 添加编辑模型 */}
582
+ <ConfigDrawer
583
+ drawerTitle={drawerTitle}
584
+ drawerVisible={drawerVisible}
585
+ handleDrawerClose={handleDrawerClose}
586
+ modelInfo={modelInfo}
587
+ modelUseTypeOpt={modelUseTypeOpt}
588
+ modelProtocolsOpt={modelProtocolsOpt}
589
+ eventsEmit={handleEventsEmit}
590
+ />
591
+ <ReplaceModal
592
+ modelVisible={modalVisible}
593
+ options={modelList}
594
+ eventsEmit={handleEventsEmit}
595
+ replaceModel={replaceModel}
596
+ />
597
+ </DashboardContainer>
598
+ );
599
+ }