@gientech/modual 1.3.0 → 1.3.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 (307) hide show
  1. package/README.md +129 -129
  2. package/{dist/assets/mysql.svg → assets/MySQL.svg} +14 -14
  3. package/{dist/assets → assets}/database.svg +11 -11
  4. package/{src/modules/database/assets → assets}/database_add.svg +53 -53
  5. package/{dist/assets → assets}/database_connect.svg +66 -66
  6. package/{dist/assets → assets}/database_upload.svg +29 -29
  7. package/{dist/assets → assets}/defaultWeLogo.svg +14 -14
  8. package/{dist/assets/index-DIm7RgkM.js → assets/index-D-dGaGjW.js} +93 -279
  9. package/{dist/assets/index-Bpnc4tRH.js → assets/index-DPUOncCt.js} +91 -86
  10. package/assets/style.css +1 -0
  11. package/assets/style3.css +1 -0
  12. package/{dist/chat.js → chat.js} +78 -78
  13. package/database.js +20 -0
  14. package/{dist/databaseId.js → databaseId.js} +1 -1
  15. package/{dist/databaseTable.js → databaseTable.js} +1 -1
  16. package/{dist/modelManage.js → modelManage.js} +1 -1
  17. package/package.json +39 -83
  18. package/{dist/sensitive.js → sensitive.js} +1 -1
  19. package/{dist/streamFilesReader.js → streamFilesReader.js} +11 -11
  20. package/{dist/worker → worker}/pdf.worker.min.js +21 -21
  21. package/.editorconfig +0 -38
  22. package/.prettierignore +0 -16
  23. package/.prettierrc +0 -17
  24. package/USAGE.md +0 -191
  25. package/bash.exe.stackdump +0 -40
  26. package/components.json +0 -21
  27. package/dist/README.md +0 -129
  28. package/dist/assets/database_add.svg +0 -53
  29. package/dist/assets/style.css +0 -1
  30. package/dist/assets/style3.css +0 -1
  31. package/dist/database.js +0 -20
  32. package/dist/package.json +0 -56
  33. package/doc_assets/2.png +0 -0
  34. package/doc_assets/demo.md +0 -27
  35. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +0 -2
  36. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +0 -23699
  37. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +0 -1
  38. package/doc_assets/demos/dist-app/index.html +0 -14
  39. package/doc_assets/demos/dist-app/vite.svg +0 -1
  40. package/doc_assets/images/1.png +0 -0
  41. package/doc_assets/images/3.png +0 -0
  42. package/doc_assets/images/component-screenshot.png +0 -1
  43. package/doc_assets/install.md +0 -5
  44. package/eslint.config.js +0 -92
  45. package/index.html +0 -13
  46. package/postcss.config.cjs +0 -19
  47. package/public/vite.svg +0 -1
  48. package/public/worker/pdf.worker.min.js +0 -22
  49. package/scripts/README.md +0 -133
  50. package/scripts/build-demo.js +0 -88
  51. package/scripts/demo-selector.js +0 -216
  52. package/scripts/dev-demo.js +0 -76
  53. package/scripts/preview-demo.js +0 -130
  54. package/scripts/run-demo.bat +0 -34
  55. package/src/assets/img/downArrow.png +0 -0
  56. package/src/assets/img/excel.png +0 -0
  57. package/src/assets/img/img.png +0 -0
  58. package/src/assets/img/pdf.png +0 -0
  59. package/src/assets/img/ppt.png +0 -0
  60. package/src/assets/img/txt.png +0 -0
  61. package/src/assets/img/word.png +0 -0
  62. package/src/assets/login/homeBg.png +0 -0
  63. package/src/assets/login/left.jpg +0 -0
  64. package/src/assets/login/logoImg.png +0 -0
  65. package/src/examples/LoginPage/index.tsx +0 -18
  66. package/src/examples/chat/components/DrawerGraphPreview.tsx +0 -77
  67. package/src/examples/chat/index.tsx +0 -179
  68. package/src/examples/gientechStreamFilesReader/index.tsx +0 -1016
  69. package/src/examples/ragDatabaseDataPage/index.tsx +0 -36
  70. package/src/examples/ragDatabaseIdPage/index.tsx +0 -44
  71. package/src/examples/ragDatabasePage/index.tsx +0 -36
  72. package/src/examples/ragModelManagePage/index.tsx +0 -37
  73. package/src/examples/ragSearchPage/index.tsx +0 -0
  74. package/src/examples/ragSensitiveWordsPage/index.tsx +0 -32
  75. package/src/examples/streamFiles/index.tsx +0 -384
  76. package/src/lib_enter.ts +0 -38
  77. package/src/main.tsx +0 -5
  78. package/src/main.tsx.backup +0 -5
  79. package/src/modules/chat/Conversations/Item.tsx +0 -167
  80. package/src/modules/chat/Conversations/List.tsx +0 -143
  81. package/src/modules/chat/Conversations/groupByTime.ts +0 -39
  82. package/src/modules/chat/Conversations/index.tsx +0 -212
  83. package/src/modules/chat/constants.tsx +0 -33
  84. package/src/modules/chat/index.tsx +0 -1836
  85. package/src/modules/chat/types.ts +0 -17
  86. package/src/modules/database/CreateModal.tsx +0 -398
  87. package/src/modules/database/assets/Doris.png +0 -0
  88. package/src/modules/database/assets/PostgreSQL.png +0 -0
  89. package/src/modules/database/assets/SQLServer.png +0 -0
  90. package/src/modules/database/assets/database.svg +0 -11
  91. package/src/modules/database/assets/database_connect.svg +0 -66
  92. package/src/modules/database/assets/database_upload.svg +0 -29
  93. package/src/modules/database/assets/empty.png +0 -0
  94. package/src/modules/database/assets/mysql.svg +0 -14
  95. package/src/modules/database/index.tsx +0 -466
  96. package/src/modules/database/server.ts +0 -196
  97. package/src/modules/databaseId/CustomCom.tsx +0 -156
  98. package/src/modules/databaseId/EditConfig.tsx +0 -268
  99. package/src/modules/databaseId/UploadDrawer.tsx +0 -520
  100. package/src/modules/databaseId/assets/aiOptimize.svg +0 -10
  101. package/src/modules/databaseId/assets/empty.png +0 -0
  102. package/src/modules/databaseId/assets/template.svg +0 -6
  103. package/src/modules/databaseId/assets/upload.svg +0 -9
  104. package/src/modules/databaseId/assets/useTemp.svg +0 -6
  105. package/src/modules/databaseId/index.tsx +0 -734
  106. package/src/modules/databaseId/server.ts +0 -286
  107. package/src/modules/databaseId/style.css +0 -5
  108. package/src/modules/databaseTable/EditRowDrawer.tsx +0 -119
  109. package/src/modules/databaseTable/index.tsx +0 -357
  110. package/src/modules/databaseTable/server.ts +0 -180
  111. package/src/modules/headlessChat/constants.tsx +0 -32
  112. package/src/modules/headlessChat/index.tsx +0 -1065
  113. package/src/modules/headlessChat/types.ts +0 -23
  114. package/src/modules/login/components/Login/LoginBox/index.tsx +0 -102
  115. package/src/modules/login/components/Login/RegisterBox/index.tsx +0 -180
  116. package/src/modules/login/components/Login/index.tsx +0 -100
  117. package/src/modules/login/index.tsx +0 -106
  118. package/src/modules/login/style.css +0 -3
  119. package/src/modules/login/useServices.ts +0 -53
  120. package/src/modules/login/utils.ts +0 -42
  121. package/src/modules/modelManage/ConfigDrawer.tsx +0 -249
  122. package/src/modules/modelManage/assets/empty.png +0 -0
  123. package/src/modules/modelManage/const.ts +0 -50
  124. package/src/modules/modelManage/index.tsx +0 -439
  125. package/src/modules/modelManage/server.ts +0 -185
  126. package/src/modules/nodegraph/index.tsx +0 -1
  127. package/src/modules/search/assets/Icon-history.svg +0 -8
  128. package/src/modules/search/assets/answerAwartar.png +0 -0
  129. package/src/modules/search/assets/doc.png +0 -0
  130. package/src/modules/search/assets/genera.gif +0 -0
  131. package/src/modules/search/assets/icon-robot.svg +0 -9
  132. package/src/modules/search/assets/icon-search-bar.svg +0 -14
  133. package/src/modules/search/assets/icon-sub-title.svg +0 -3
  134. package/src/modules/search/assets/icon-title.svg +0 -9
  135. package/src/modules/search/assets/icon-zoomOut.svg +0 -9
  136. package/src/modules/search/assets/iconAi.svg +0 -9
  137. package/src/modules/search/assets/pdf.png +0 -0
  138. package/src/modules/search/assets/ppt.png +0 -0
  139. package/src/modules/search/assets/search.svg +0 -3
  140. package/src/modules/search/assets/selected.svg +0 -4
  141. package/src/modules/search/assets/txt.png +0 -0
  142. package/src/modules/search/assets/xls.png +0 -0
  143. package/src/modules/search/components/AssisSelect.tsx +0 -137
  144. package/src/modules/search/components/Editor/ChatViewEditor.tsx +0 -261
  145. package/src/modules/search/components/Editor/aichat.css +0 -1
  146. package/src/modules/search/components/Editor/constant.ts +0 -13
  147. package/src/modules/search/components/Editor/index.tsx +0 -113
  148. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +0 -332
  149. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +0 -20
  150. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +0 -38
  151. package/src/modules/search/components/Editor/plugins/displayer.ts +0 -298
  152. package/src/modules/search/components/Editor/plugins/imageClick.tsx +0 -32
  153. package/src/modules/search/components/Editor/plugins/myplugin.tsx +0 -98
  154. package/src/modules/search/components/Editor/ui/avatar.tsx +0 -19
  155. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +0 -21
  156. package/src/modules/search/components/Editor/ui/button.tsx +0 -58
  157. package/src/modules/search/components/Editor/ui/calendar.tsx +0 -68
  158. package/src/modules/search/components/Editor/ui/caption.tsx +0 -46
  159. package/src/modules/search/components/Editor/ui/checkbox.tsx +0 -27
  160. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +0 -188
  161. package/src/modules/search/components/Editor/ui/code-block-element.css +0 -434
  162. package/src/modules/search/components/Editor/ui/code-block-element.tsx +0 -39
  163. package/src/modules/search/components/Editor/ui/code-leaf.tsx +0 -24
  164. package/src/modules/search/components/Editor/ui/code-line-element.tsx +0 -10
  165. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +0 -21
  166. package/src/modules/search/components/Editor/ui/column-element.tsx +0 -30
  167. package/src/modules/search/components/Editor/ui/column-group-element.tsx +0 -94
  168. package/src/modules/search/components/Editor/ui/command.tsx +0 -75
  169. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +0 -22
  170. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +0 -37
  171. package/src/modules/search/components/Editor/ui/comment-item.tsx +0 -74
  172. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +0 -49
  173. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +0 -42
  174. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +0 -22
  175. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +0 -32
  176. package/src/modules/search/components/Editor/ui/comment-value.tsx +0 -34
  177. package/src/modules/search/components/Editor/ui/comments-popover.tsx +0 -63
  178. package/src/modules/search/components/Editor/ui/date-element.tsx +0 -83
  179. package/src/modules/search/components/Editor/ui/dialog.tsx +0 -63
  180. package/src/modules/search/components/Editor/ui/draggable.tsx +0 -177
  181. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +0 -180
  182. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +0 -85
  183. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +0 -28
  184. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +0 -76
  185. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +0 -8
  186. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +0 -51
  187. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +0 -77
  188. package/src/modules/search/components/Editor/ui/heading-element.tsx +0 -48
  189. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +0 -17
  190. package/src/modules/search/components/Editor/ui/hr-element.tsx +0 -30
  191. package/src/modules/search/components/Editor/ui/icons.tsx +0 -267
  192. package/src/modules/search/components/Editor/ui/image-element.tsx +0 -74
  193. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +0 -368
  194. package/src/modules/search/components/Editor/ui/input.tsx +0 -25
  195. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +0 -218
  196. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +0 -20
  197. package/src/modules/search/components/Editor/ui/link-element.tsx +0 -29
  198. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +0 -161
  199. package/src/modules/search/components/Editor/ui/list-element.tsx +0 -30
  200. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +0 -24
  201. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +0 -133
  202. package/src/modules/search/components/Editor/ui/media-popover.tsx +0 -97
  203. package/src/modules/search/components/Editor/ui/mention-element.tsx +0 -43
  204. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +0 -141
  205. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +0 -93
  206. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +0 -67
  207. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +0 -4
  208. package/src/modules/search/components/Editor/ui/placeholder.tsx +0 -52
  209. package/src/modules/search/components/Editor/ui/popover.tsx +0 -32
  210. package/src/modules/search/components/Editor/ui/resizable.tsx +0 -66
  211. package/src/modules/search/components/Editor/ui/separator.tsx +0 -25
  212. package/src/modules/search/components/Editor/ui/style.less +0 -12
  213. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +0 -143
  214. package/src/modules/search/components/Editor/ui/table-element.tsx +0 -243
  215. package/src/modules/search/components/Editor/ui/table-row-element.tsx +0 -22
  216. package/src/modules/search/components/Editor/ui/tableValue.tsx +0 -135
  217. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +0 -43
  218. package/src/modules/search/components/Editor/ui/toggle-element.tsx +0 -31
  219. package/src/modules/search/components/Editor/ui/toolbar.tsx +0 -157
  220. package/src/modules/search/components/Editor/ui/tooltip.tsx +0 -65
  221. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +0 -160
  222. package/src/modules/search/components/Editor/ui/with-draggables.tsx +0 -175
  223. package/src/modules/search/components/FileList.tsx +0 -287
  224. package/src/modules/search/components/ImageGroupView/index.tsx +0 -85
  225. package/src/modules/search/components/ResultContent.tsx +0 -232
  226. package/src/modules/search/components/SearchInput.tsx +0 -232
  227. package/src/modules/search/components/SearchLanding.tsx +0 -74
  228. package/src/modules/search/components/SearchView.tsx +0 -563
  229. package/src/modules/search/components/SimpleEditor.tsx +0 -158
  230. package/src/modules/search/components/SimpleFileList.tsx +0 -215
  231. package/src/modules/search/index.tsx +0 -10
  232. package/src/modules/search/reademe.md +0 -1
  233. package/src/modules/search/servers/apis.tsx +0 -19
  234. package/src/modules/search/servers/index.ts +0 -184
  235. package/src/modules/search/style.less +0 -503
  236. package/src/modules/search/type.ts +0 -22
  237. package/src/modules/search/utils.ts +0 -34
  238. package/src/modules/sensitive/index.tsx +0 -313
  239. package/src/modules/sensitive/server.ts +0 -122
  240. package/src/modules/streamFilesReader/GientechStreamReader.tsx +0 -1555
  241. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  242. package/src/modules/streamFilesReader/components/Header/index.tsx +0 -297
  243. package/src/modules/streamFilesReader/index.tsx +0 -3
  244. package/src/style.css +0 -6
  245. package/src/type.d.ts +0 -0
  246. package/src/utils/commonFn.tsx +0 -111
  247. package/src/utils/gientechCommon/components/AppError.tsx +0 -32
  248. package/src/utils/gientechCommon/components/AppLoading.tsx +0 -75
  249. package/src/utils/gientechCommon/components/DeleteModal.tsx +0 -75
  250. package/src/utils/gientechCommon/components/DisplayError.tsx +0 -33
  251. package/src/utils/gientechCommon/components/DisplayLoading.tsx +0 -38
  252. package/src/utils/gientechCommon/components/FeedBackModal.tsx +0 -310
  253. package/src/utils/gientechCommon/components/FileCardCommon.tsx +0 -82
  254. package/src/utils/gientechCommon/components/FileManager/index.tsx +0 -390
  255. package/src/utils/gientechCommon/components/FileManager/style.css +0 -5
  256. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +0 -296
  257. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +0 -339
  258. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +0 -245
  259. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +0 -209
  260. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  261. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +0 -148
  262. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +0 -14
  263. package/src/utils/gientechCommon/components/RenameModal.tsx +0 -86
  264. package/src/utils/gientechCommon/components/style.less +0 -11
  265. package/src/utils/gientechCommon/configs/commonConfig.ts +0 -2
  266. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  267. package/src/utils/gientechCommon/configs/stylesConfig.ts +0 -142
  268. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +0 -339
  269. package/src/utils/gientechCommon/slate/converters/deserializers.ts +0 -763
  270. package/src/utils/gientechCommon/slate/converters/mockData.ts +0 -232
  271. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +0 -258
  272. package/src/utils/gientechCommon/slate/richElements/index.tsx +0 -499
  273. package/src/utils/gientechCommon/utils/request.ts +0 -37
  274. package/src/utils/gientechCommon/utils/serverFn.ts +0 -172
  275. package/src/utils/index.tsx +0 -126
  276. package/src/utils/testconfigs/demologin/index.tsx +0 -32
  277. package/src/utils/testconfigs/index.ts +0 -53
  278. package/src/vite-env.d.ts +0 -11
  279. package/stats.html +0 -4949
  280. package/tailwind.config.js +0 -170
  281. package/tsconfig.app.json +0 -30
  282. package/tsconfig.app.tsbuildinfo +0 -11
  283. package/tsconfig.json +0 -13
  284. package/tsconfig.node.json +0 -22
  285. package/tsconfig.node.tsbuildinfo +0 -1
  286. package/vite.config.ts +0 -177
  287. package/workflows/release.yml +0 -60
  288. /package/{dist/assets → assets}/Doris.png +0 -0
  289. /package/{dist/assets → assets}/PostgreSQL.png +0 -0
  290. /package/{dist/assets → assets}/SQLServer.png +0 -0
  291. /package/{dist/assets → assets}/_commonjsHelpers-gnU0ypJ3.js +0 -0
  292. /package/{dist/assets → assets}/circle-alert-g2Y6zAjt.js +0 -0
  293. /package/{dist/assets → assets}/empty.png +0 -0
  294. /package/{dist/assets → assets}/index-CEK88UzR.js +0 -0
  295. /package/{dist/assets → assets}/index-CpW6Dhpp.js +0 -0
  296. /package/{dist/assets → assets}/plus-omCUN0e3.js +0 -0
  297. /package/{dist/assets → assets}/style2.css +0 -0
  298. /package/{dist/assets → assets}/styled-components.browser.esm-DPkS13KC.js +0 -0
  299. /package/{dist/assets → assets}/x-vPcWt3fC.js +0 -0
  300. /package/{dist/chat.d.ts → chat.d.ts} +0 -0
  301. /package/{dist/database.d.ts → database.d.ts} +0 -0
  302. /package/{dist/databaseId.d.ts → databaseId.d.ts} +0 -0
  303. /package/{dist/databaseTable.d.ts → databaseTable.d.ts} +0 -0
  304. /package/{dist/modelManage.d.ts → modelManage.d.ts} +0 -0
  305. /package/{dist/sensitive.d.ts → sensitive.d.ts} +0 -0
  306. /package/{dist/streamFilesReader.d.ts → streamFilesReader.d.ts} +0 -0
  307. /package/{dist/vite.svg → vite.svg} +0 -0
@@ -1,439 +0,0 @@
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, 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 { getStatusColor, statusArr, OPT_BTN } from './const';
11
-
12
- import '@mxmweb/zui/style.css';
13
-
14
- const { confirm } = Modal;
15
-
16
- const initPage = {
17
- pageNum: 1,
18
- pageSize: 1000,
19
- };
20
- interface ModelManageViewProps {
21
- url?: string;
22
- token?: string;
23
- role?: string;
24
- styles?: Styles;
25
- CustomComponents?: CustomComponents;
26
- eventsEmit?: (name: string, data: any) => void;
27
- getBtnDisabled?: (type: OPT_BTN, permission: number) => boolean;
28
- }
29
-
30
- const StatusComponent = (props: any) => {
31
- const { value, cell } = props;
32
- const color = getStatusColor(props.cell.statusType);
33
- if (value == '不可用') {
34
- return (
35
- <Tooltip title={cell.errorMsg}>
36
- <div className="flex items-center gap-2">
37
- <Badge color={color} text={value} />
38
- </div>
39
- </Tooltip>
40
- );
41
- } else {
42
- return <Badge color={color} text={value} />;
43
- }
44
- };
45
-
46
- export default function ModelManageView(props: ModelManageViewProps) {
47
- const { url, token, role, CustomComponents, eventsEmit, getBtnDisabled } = props;
48
-
49
- const [status, setStatus] = useState<any>({
50
- container: 'ready',
51
- content: 'ready',
52
- });
53
-
54
- // 创建ref来访问核心组件实例
55
- const coreRef = useRef<any>(null);
56
- const [data, setData] = useState<
57
- {
58
- id: string;
59
- data?: any[];
60
- }[]
61
- >();
62
-
63
- // 抽屉状态管理
64
- const [drawerVisible, setDrawerVisible] = useState(false);
65
- const [drawerTitle, setDrawerTitle] = useState('');
66
- const [modelInfo, setModelInfo] = useState<any>();
67
-
68
- // 使用类型options
69
- const [modelUseTypeOpt, setModelUseTypeOpt] = useState<{ label: string; value: string }[]>([]);
70
- const [modelProtocolsOpt, setModelProtocolsOpt] = useState<{ label: string; value: string }[]>(
71
- []
72
- );
73
- const {
74
- getModelList,
75
- delModelById,
76
- createModel,
77
- updateModelById,
78
- getUseTypeList,
79
- getModelProtocolsList,
80
- } = AxiosInstance({
81
- url,
82
- token,
83
- role,
84
- eventsEmit: eventsEmit,
85
- });
86
-
87
- // 模拟应用初始化过程
88
- useEffect(() => {
89
- setStatus((prev: any) => ({ ...prev, content: 'loading' }));
90
- handleFetchList();
91
- }, []);
92
-
93
- const handleData = (data: any[]) => {
94
- return (data || []).map((_t, i) => {
95
- let status = statusArr.find((s: any) => s.status == _t.status);
96
- return {
97
- id: _t.id,
98
- data: [
99
- { columnId: 'modelName', value: _t.modelName },
100
- {
101
- columnId: 'modelProtocol',
102
- value: _t.modelProtocol,
103
- type: 'customized',
104
- },
105
- { columnId: 'type', value: _t.type, type: 'customized' },
106
- { columnId: 'dec', value: _t.dec },
107
- {
108
- columnId: 'status',
109
- ...status,
110
- type: 'customized',
111
- errorMsg: _t.errorMsg,
112
- },
113
- {
114
- columnId: 'actions',
115
- value: 'edit',
116
- label: '编辑',
117
- type: 'action',
118
- disabled: getBtnDisabled && getBtnDisabled(OPT_BTN.EDIT, _t.permission),
119
- },
120
- {
121
- columnId: 'actions',
122
- value: 'auth',
123
- label: '授权',
124
- type: 'action',
125
- disabled: getBtnDisabled && getBtnDisabled(OPT_BTN.AUTHORIZE, _t.permission),
126
- },
127
- {
128
- columnId: 'actions',
129
- value: 'delete',
130
- label: '删除',
131
- type: 'action',
132
- disabled: getBtnDisabled && getBtnDisabled(OPT_BTN.AUTHORIZE, _t.permission),
133
- },
134
- { columnId: 'url', value: _t.url },
135
- { columnId: 'apiKey', value: _t.apiKey },
136
- { columnId: 'modelIde', value: _t.modelIde },
137
- { columnId: 'thinking', value: _t.thinking },
138
- ],
139
- };
140
- });
141
- };
142
-
143
- const handleFetchList = async () => {
144
- try {
145
- const [listRes, useTypeRes, modelProtocolsRes] = await Promise.allSettled([
146
- getModelList(initPage),
147
- getUseTypeList(),
148
- getModelProtocolsList(),
149
- ]);
150
-
151
- if (listRes.status === 'fulfilled' && listRes.value) {
152
- const _data = handleData(listRes.value.records);
153
- setData(_data || []);
154
- setStatus((prev: any) => ({ ...prev, content: 'ready' }));
155
- }
156
-
157
- if (useTypeRes.status === 'fulfilled' && useTypeRes.value) {
158
- setModelUseTypeOpt(
159
- (useTypeRes.value || []).map((o: any) => ({ ...o, value: Number(o.value) }))
160
- );
161
- }
162
-
163
- if (modelProtocolsRes.status === 'fulfilled' && modelProtocolsRes.value) {
164
- setModelProtocolsOpt(
165
- (modelProtocolsRes.value || []).map((o: any) => ({ ...o, value: Number(o.value) }))
166
- );
167
- }
168
- } catch (e) {
169
- console.error('[TableApiError] getTableList:', e);
170
- }
171
- };
172
-
173
- const viewConfig = useMemo(
174
- () => ({
175
- label: '数据库表格',
176
- defaultActiveId: 'model-table',
177
- model: null,
178
- views: [
179
- {
180
- label: '模型',
181
- id: 'model-table',
182
- type: 'table' as const,
183
- viewBehavior: 'pagination' as const, //or pagination
184
- allowMultiSelect: false,
185
- viewPageSize: 10,
186
- columns: [
187
- { id: 'modelName', title: '模型名称', type: 'label' },
188
- {
189
- id: 'modelProtocol',
190
- title: '模型传输协议',
191
- type: 'customized',
192
- component: (props: any) => {
193
- const { value } = props;
194
- const modelProtocol = modelProtocolsOpt.find((o: any) => o.value == value)?.label;
195
- return <span>{modelProtocol}</span>;
196
- },
197
- },
198
- {
199
- id: 'type',
200
- title: '使用类型',
201
- type: 'customized',
202
- component: (props: any) => {
203
- const { value } = props;
204
- const type = modelUseTypeOpt.find((o: any) => o.value == value)?.label;
205
- return <span>{type}</span>;
206
- },
207
- },
208
- { id: 'dec', title: '说明', type: 'paragraph' },
209
- {
210
- id: 'status',
211
- title: '状态',
212
- type: 'customized',
213
- component: <StatusComponent />,
214
- helpText:
215
- '当前模型状态为初次新增校验状态,若模型下线,此状态不会主动更新,需手动执行模型删除',
216
- },
217
- {
218
- id: 'actions',
219
- title: '操作',
220
- type: 'customized',
221
- component: (props: any) => {
222
- const { value, cell, row } = props;
223
- const { disabled, label } = cell;
224
- if (disabled) {
225
- return (
226
- <Tooltip title="角色无权限操作">
227
- <Button mode="text" label={label} disabled={disabled} />
228
- </Tooltip>
229
- );
230
- } else {
231
- return (
232
- <Button
233
- mode="text"
234
- label={label}
235
- onClick={() => handleEventsEmit(`table_action_${value}`, row, undefined)}
236
- />
237
- );
238
- }
239
- },
240
- },
241
- ],
242
- toolbar: [
243
- {
244
- type: 'button' as const,
245
- btnType: 'primary' as const,
246
- key: 'add',
247
- label: '新建',
248
- icon: <Plus />,
249
- },
250
- ],
251
- },
252
- ],
253
- }),
254
- [data, modelUseTypeOpt, modelProtocolsOpt]
255
- );
256
-
257
- // 自定义空数据组件
258
- const EmptyData: React.FC = () => (
259
- <div className="flex flex-col items-center justify-center h-full">
260
- <div className="text-xl font-semibold mb-3" style={{ color: '#374151' }}>
261
- <img src={EmptyImg} width={120} />
262
- </div>
263
- <div className="text-base mb-6" style={{ color: '#6b7280' }}>
264
- 暂无数据,请先新建模型
265
- </div>
266
- <div className="flex gap-3">
267
- <Button
268
- mode="primary"
269
- label="新建模型"
270
- onClick={() => {
271
- setDrawerTitle('新建');
272
- setDrawerVisible(true);
273
- }}
274
- />
275
- </div>
276
- </div>
277
- );
278
-
279
- // 事件分流函数,先处理核心层UI/动画,再决定是否向上透传
280
- async function handleEventsEmit(name: string, data: any, appFn: any) {
281
- console.log('[adopter] mergedEventsEmit', name, data, appFn);
282
- // 1. 先处理核心层UI/动画/数据
283
- switch (name) {
284
- case 'toolbar_add': {
285
- setDrawerTitle('新建');
286
- setDrawerVisible(true);
287
- break;
288
- }
289
- case 'table_action_delete': {
290
- try {
291
- const name = data.data.find((d: any) => d.columnId == 'modelName').value;
292
- confirm({
293
- title: '确认删除?',
294
- content: `确定要删除模型 “${name}” 吗?此操作不可恢复。`,
295
- okText: '删除',
296
- cancelText: '取消',
297
- async onOk() {
298
- const res = await delModelById(data.id);
299
- if (res && coreRef?.current) {
300
- coreRef?.current.appFn.removeItem(data.id);
301
- message.success(`删除成功`);
302
- }
303
- },
304
- });
305
- } catch (e) {
306
- console.error('删除表数据失败', e);
307
- }
308
- break;
309
- }
310
- case 'table_action_edit': {
311
- setDrawerTitle('编辑');
312
- setDrawerVisible(true);
313
- setModelInfo(data);
314
- break;
315
- }
316
- //新增模型
317
- case 'form_submitted_add': {
318
- try {
319
- const _data = data.fields.reduce((acc: any, item: any) => {
320
- acc[item.name] = item.value;
321
- return acc;
322
- }, {});
323
- const res = await createModel({
324
- ..._data,
325
- });
326
- if (res) {
327
- let status = statusArr.find((s: any) => s.status == res.status);
328
- const newModel = {
329
- id: res.id,
330
- data: [
331
- ...(Object.keys(res) || []).map((key: any) => {
332
- return {
333
- columnId: key,
334
- value: (res as any)[key],
335
- ...((key == 'modelProtocol' || key == 'type') && {
336
- type: 'customized',
337
- }),
338
- ...(key == 'status' && {
339
- ...status,
340
- type: 'customized',
341
- errorMsg: (res as any).errorMsg,
342
- }),
343
- };
344
- }),
345
- { columnId: 'actions', value: 'edit', label: '编辑', type: 'action' },
346
- { columnId: 'actions', value: 'auth', label: '授权', type: 'action' },
347
- { columnId: 'actions', value: 'delete', label: '删除', type: 'action' },
348
- ],
349
- };
350
- coreRef?.current?.appFn?.addItem(newModel, { animate: true, position: 'start' });
351
- message.success('模型新增成功!');
352
- }
353
- } catch (e) {
354
- console.error('保存失败!', e);
355
- } finally {
356
- handleDrawerClose();
357
- }
358
- break;
359
- }
360
-
361
- //修改模型配置
362
- case 'form_submitted_edit': {
363
- try {
364
- const _data = data.fields.reduce((acc: any, item: any) => {
365
- acc[item.name] = item.value;
366
- return acc;
367
- }, {});
368
-
369
- const res = await updateModelById({
370
- ..._data,
371
- id: modelInfo.id,
372
- });
373
- if (res) {
374
- let status = statusArr.find((s: any) => s.status == res.status);
375
- const patch = {
376
- ...modelInfo,
377
- data: modelInfo.data.map((m: any) => {
378
- if (res[m.columnId] !== null && res[m.columnId] !== undefined) {
379
- if (m.columnId == 'status') {
380
- return {
381
- ...m,
382
- ...status,
383
- };
384
- } else {
385
- m.value = res[m.columnId];
386
- }
387
- }
388
- return m;
389
- }),
390
- };
391
- coreRef?.current?.appFn?.updateItem(patch, modelInfo?.id);
392
- message.success('模型编辑成功!');
393
- }
394
- } catch (e) {
395
- console.error('保存失败!', e);
396
- } finally {
397
- handleDrawerClose();
398
- }
399
- break;
400
- }
401
-
402
- default:
403
- // 2. 透传到业务层(如有需要)
404
- if (typeof props.eventsEmit === 'function') {
405
- props.eventsEmit(name, data);
406
- }
407
- break;
408
- }
409
- }
410
- const handleDrawerClose = () => {
411
- setDrawerVisible(false);
412
- setModelInfo(undefined);
413
- };
414
- return (
415
- <DashboardContainer title="模型管理">
416
- <Xviwer
417
- dataSource={data}
418
- ref={coreRef}
419
- eventsEmit={handleEventsEmit}
420
- status={status}
421
- CustomComponents={{
422
- EmptyData,
423
- ...CustomComponents,
424
- }}
425
- {...viewConfig}
426
- />
427
- {/* 右侧抽屉 - 添加编辑模型 */}
428
- <ConfigDrawer
429
- drawerTitle={drawerTitle}
430
- drawerVisible={drawerVisible}
431
- handleDrawerClose={handleDrawerClose}
432
- modelInfo={modelInfo}
433
- modelUseTypeOpt={modelUseTypeOpt}
434
- modelProtocolsOpt={modelProtocolsOpt}
435
- eventsEmit={handleEventsEmit}
436
- />
437
- </DashboardContainer>
438
- );
439
- }
@@ -1,185 +0,0 @@
1
- import axios from 'axios';
2
-
3
- type IDataSourceType = 'DataTable' | 'DirectDB';
4
-
5
- interface DatabaseApiProps {
6
- url?: string;
7
- token?: string;
8
- role?: string;
9
- eventsEmit?: (name: string, data: any) => void;
10
- }
11
-
12
- const AxiosInstance = ({ url, token, role, eventsEmit }: DatabaseApiProps) => {
13
- const axios$ = axios.create({
14
- baseURL: url,
15
- // 配置请求超时时间
16
- timeout: 1000000,
17
- });
18
- // 请求拦截
19
- axios$.interceptors.request.use((config: any) => {
20
- let target_cookie = token;
21
-
22
- const noA = ['user/login', 'user/kaptcha', 'user/regist'];
23
- // dangerous behaviour
24
- if (!target_cookie && !noA.some((item: string) => config.url.includes(item))) {
25
- // 通过eventsEmit抛出认证错误事件,让调用层处理
26
- if (eventsEmit) {
27
- eventsEmit('request:error_auth', {
28
- errorMsg: '未登录或token已过期',
29
- redirect: '/login',
30
- });
31
- }
32
- return Promise.reject(new Error('未登录或token已过期'));
33
- }
34
-
35
- config.headers.Authorization = target_cookie || '';
36
- // 这里传中文会报错
37
- config.headers.userName = role === '未登录用户' ? '' : role;
38
- return config;
39
- });
40
-
41
- // 返回拦截
42
- axios$.interceptors.response.use(
43
- response => {
44
- // 获取接口返回结果
45
- const noA = ['user/kaptcha'];
46
- const res = response.data;
47
- if (noA.some((item: string) => response.config.url && response.config.url.includes(item))) {
48
- return res;
49
- }
50
- if (res.size && res.type) {
51
- return res;
52
- }
53
- const { success, errorMsg, errorCode } = res;
54
-
55
- if (success) {
56
- return res;
57
- } else {
58
- // 通过eventsEmit抛出业务错误事件,让调用层处理
59
- if (eventsEmit) {
60
- eventsEmit('request:error_business', {
61
- errorCode,
62
- errorMsg: errorMsg || '请求出错,请稍后再试',
63
- response: res,
64
- });
65
- }
66
- }
67
- return false;
68
- },
69
- error => {
70
- // 主动取消请求,不给报错信息
71
- if (error.message === 'canceled') {
72
- return Promise.reject(error);
73
- }
74
-
75
- // 通过eventsEmit抛出网络错误事件,让调用层处理
76
- if (eventsEmit) {
77
- let errorType = 'request:error_network';
78
- let errorData: any = {
79
- errorMsg: '网络请求失败',
80
- error: error,
81
- };
82
-
83
- if (error?.response?.status === 401) {
84
- errorType = 'request:error_auth';
85
- errorData = {
86
- errorMsg: '没有足够权限',
87
- error: error,
88
- redirect: '/login',
89
- };
90
- } else if (
91
- error?.response?.data?.errorCode === '30013' ||
92
- error?.response?.data?.errorCode === '30023'
93
- ) {
94
- errorType = 'request:error_business';
95
- errorData = {
96
- errorCode: error?.response?.data?.errorCode,
97
- errorMsg: error?.response?.data?.message || '请求出错,请稍后再试',
98
- error: error,
99
- };
100
- }
101
-
102
- eventsEmit(errorType, errorData);
103
- }
104
- return Promise.reject(error);
105
- }
106
- );
107
- // 获取表数据
108
- const getModelList = async (params: any) => {
109
- try {
110
- const res: any = await axios$.get(`/allPage?${new URLSearchParams(params).toString()}`);
111
- const { success, data } = res;
112
- if (success) return data;
113
- } catch (e) {
114
- console.log('getModelList error:', e);
115
- return false;
116
- }
117
- };
118
-
119
- //删除模型
120
- const delModelById = async (id: string | number) => {
121
- try {
122
- const res: any = await axios$.delete(`/delete?id=${id}`);
123
- const { success, data } = res;
124
- if (success) return data;
125
- } catch (e) {
126
- console.log('delModelById error:', e);
127
- }
128
- };
129
-
130
- // 创建模型
131
- const createModel = async (params: any) => {
132
- try {
133
- const res: any = await axios$.post(`/create`, params);
134
-
135
- const { success, data } = res;
136
- if (success) return data;
137
- } catch (e) {
138
- console.log('createModel error:', e);
139
- }
140
- };
141
- // 编辑模型
142
- const updateModelById = async (params: any) => {
143
- try {
144
- const res: any = await axios$.put(`/update`, params);
145
-
146
- const { success, data } = res;
147
- if (success) return data;
148
- } catch (e) {
149
- console.log('updateModelById error:', e);
150
- }
151
- };
152
- //使用类型list
153
- const getUseTypeList = async () => {
154
- try {
155
- const res: any = await axios$.get(`/getModelTypes`);
156
- const { success, data } = res;
157
- if (success) return data;
158
- } catch (e) {
159
- console.log('getUseTypeList error:', e);
160
- return false;
161
- }
162
- };
163
-
164
- //传输协议list
165
- const getModelProtocolsList = async () => {
166
- try {
167
- const res: any = await axios$.get(`/getModelProtocols`);
168
- const { success, data } = res;
169
- if (success) return data;
170
- } catch (e) {
171
- console.log('getModelProtocolsList error:', e);
172
- return false;
173
- }
174
- };
175
- return {
176
- getModelList,
177
- delModelById,
178
- createModel,
179
- updateModelById,
180
- getUseTypeList,
181
- getModelProtocolsList,
182
- };
183
- };
184
-
185
- export default AxiosInstance;
@@ -1 +0,0 @@
1
- import { AiChat, type AppStatusManager } from '@mxmweb/aichat';
@@ -1,8 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="Icon">
3
- <g id="Vector">
4
- <path d="M8 1C4.13438 1 1 4.13438 1 8C1 11.8656 4.13438 15 8 15C11.8656 15 15 11.8656 15 8C15 4.13438 11.8656 1 8 1ZM8 13.8125C4.79063 13.8125 2.1875 11.2094 2.1875 8C2.1875 4.79063 4.79063 2.1875 8 2.1875C11.2094 2.1875 13.8125 4.79063 13.8125 8C13.8125 11.2094 11.2094 13.8125 8 13.8125Z" fill="#888888"/>
5
- <path d="M10.7297 9.97811L8.50156 8.36718V4.5C8.50156 4.43125 8.44531 4.375 8.37656 4.375H7.625C7.55625 4.375 7.5 4.43125 7.5 4.5V8.80311C7.5 8.84374 7.51875 8.88124 7.55156 8.90467L10.1359 10.789C10.1922 10.8297 10.2703 10.8172 10.3109 10.7625L10.7578 10.1531C10.7984 10.0953 10.7859 10.0172 10.7297 9.97811Z" fill="#888888"/>
6
- </g>
7
- </g>
8
- </svg>
Binary file