@gientech/modual 1.3.3 → 1.3.4

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 → assets}/database.svg +11 -11
  3. package/{src/modules/database/assets → assets}/database_add.svg +53 -53
  4. package/{dist/assets → assets}/database_connect.svg +66 -66
  5. package/{dist/assets → assets}/database_upload.svg +29 -29
  6. package/{dist/assets → assets}/defaultWeLogo.svg +14 -14
  7. package/{dist/assets/index-mPgEc8KC.js → assets/index-CDNF071H.js} +38 -38
  8. package/{dist/assets/index-XvC_4jDB.js → assets/index-Ce4td48i.js} +20 -20
  9. package/{dist/assets → assets}/mysql.svg +14 -14
  10. package/{dist/chat.js → chat.js} +2 -2
  11. package/database.js +20 -0
  12. package/{dist/databaseId.js → databaseId.js} +1 -1
  13. package/{dist/databaseTable.js → databaseTable.js} +1 -1
  14. package/{dist/modelManage.js → modelManage.js} +1 -1
  15. package/package.json +39 -83
  16. package/{dist/sensitive.js → sensitive.js} +1 -1
  17. package/{dist/streamFilesReader.js → streamFilesReader.js} +10 -10
  18. package/{dist/worker → worker}/pdf.worker.min.js +21 -21
  19. package/.editorconfig +0 -38
  20. package/.prettierignore +0 -16
  21. package/.prettierrc +0 -17
  22. package/USAGE.md +0 -191
  23. package/bash.exe.stackdump +0 -40
  24. package/components.json +0 -21
  25. package/dist/README.md +0 -129
  26. package/dist/assets/database_add.svg +0 -53
  27. package/dist/database.js +0 -20
  28. package/dist/package.json +0 -56
  29. package/doc_assets/2.png +0 -0
  30. package/doc_assets/demo.md +0 -27
  31. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +0 -2
  32. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +0 -23699
  33. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +0 -1
  34. package/doc_assets/demos/dist-app/index.html +0 -14
  35. package/doc_assets/demos/dist-app/vite.svg +0 -1
  36. package/doc_assets/images/1.png +0 -0
  37. package/doc_assets/images/3.png +0 -0
  38. package/doc_assets/images/component-screenshot.png +0 -1
  39. package/doc_assets/install.md +0 -5
  40. package/eslint.config.js +0 -92
  41. package/index.html +0 -13
  42. package/postcss.config.cjs +0 -19
  43. package/public/vite.svg +0 -1
  44. package/public/worker/pdf.worker.min.js +0 -22
  45. package/scripts/README.md +0 -133
  46. package/scripts/build-demo.js +0 -88
  47. package/scripts/demo-selector.js +0 -216
  48. package/scripts/dev-demo.js +0 -76
  49. package/scripts/preview-demo.js +0 -130
  50. package/scripts/run-demo.bat +0 -34
  51. package/src/assets/img/downArrow.png +0 -0
  52. package/src/assets/img/excel.png +0 -0
  53. package/src/assets/img/img.png +0 -0
  54. package/src/assets/img/pdf.png +0 -0
  55. package/src/assets/img/ppt.png +0 -0
  56. package/src/assets/img/txt.png +0 -0
  57. package/src/assets/img/word.png +0 -0
  58. package/src/assets/login/homeBg.png +0 -0
  59. package/src/assets/login/left.jpg +0 -0
  60. package/src/assets/login/logoImg.png +0 -0
  61. package/src/examples/LoginPage/index.tsx +0 -18
  62. package/src/examples/aaa/index.tsx +0 -3758
  63. package/src/examples/chat/components/DrawerGraphPreview.tsx +0 -78
  64. package/src/examples/chat/index.tsx +0 -190
  65. package/src/examples/gientechStreamFilesReader/index.tsx +0 -1016
  66. package/src/examples/ragDatabaseDataPage/index.tsx +0 -36
  67. package/src/examples/ragDatabaseIdPage/index.tsx +0 -44
  68. package/src/examples/ragDatabasePage/index.tsx +0 -36
  69. package/src/examples/ragModelManagePage/index.tsx +0 -37
  70. package/src/examples/ragSearchPage/index.tsx +0 -0
  71. package/src/examples/ragSensitiveWordsPage/index.tsx +0 -32
  72. package/src/examples/streamFiles/index.tsx +0 -384
  73. package/src/lib_enter.ts +0 -38
  74. package/src/main.tsx +0 -5
  75. package/src/main.tsx.backup +0 -5
  76. package/src/modules/chat/Conversations/Item.tsx +0 -167
  77. package/src/modules/chat/Conversations/List.tsx +0 -143
  78. package/src/modules/chat/Conversations/groupByTime.ts +0 -39
  79. package/src/modules/chat/Conversations/index.tsx +0 -212
  80. package/src/modules/chat/constants.tsx +0 -33
  81. package/src/modules/chat/data.txt +0 -82
  82. package/src/modules/chat/index.tsx +0 -1908
  83. package/src/modules/chat/types.ts +0 -17
  84. package/src/modules/database/CreateModal.tsx +0 -398
  85. package/src/modules/database/assets/Doris.png +0 -0
  86. package/src/modules/database/assets/PostgreSQL.png +0 -0
  87. package/src/modules/database/assets/SQLServer.png +0 -0
  88. package/src/modules/database/assets/database.svg +0 -11
  89. package/src/modules/database/assets/database_connect.svg +0 -66
  90. package/src/modules/database/assets/database_upload.svg +0 -29
  91. package/src/modules/database/assets/empty.png +0 -0
  92. package/src/modules/database/assets/mysql.svg +0 -14
  93. package/src/modules/database/index.tsx +0 -466
  94. package/src/modules/database/server.ts +0 -196
  95. package/src/modules/databaseId/CustomCom.tsx +0 -156
  96. package/src/modules/databaseId/EditConfig.tsx +0 -268
  97. package/src/modules/databaseId/UploadDrawer.tsx +0 -520
  98. package/src/modules/databaseId/assets/aiOptimize.svg +0 -10
  99. package/src/modules/databaseId/assets/empty.png +0 -0
  100. package/src/modules/databaseId/assets/template.svg +0 -6
  101. package/src/modules/databaseId/assets/upload.svg +0 -9
  102. package/src/modules/databaseId/assets/useTemp.svg +0 -6
  103. package/src/modules/databaseId/index.tsx +0 -734
  104. package/src/modules/databaseId/server.ts +0 -286
  105. package/src/modules/databaseId/style.css +0 -5
  106. package/src/modules/databaseTable/EditRowDrawer.tsx +0 -119
  107. package/src/modules/databaseTable/index.tsx +0 -357
  108. package/src/modules/databaseTable/server.ts +0 -180
  109. package/src/modules/headlessChat/constants.tsx +0 -32
  110. package/src/modules/headlessChat/index.tsx +0 -1065
  111. package/src/modules/headlessChat/types.ts +0 -23
  112. package/src/modules/login/components/Login/LoginBox/index.tsx +0 -102
  113. package/src/modules/login/components/Login/RegisterBox/index.tsx +0 -180
  114. package/src/modules/login/components/Login/index.tsx +0 -100
  115. package/src/modules/login/index.tsx +0 -106
  116. package/src/modules/login/style.css +0 -3
  117. package/src/modules/login/useServices.ts +0 -53
  118. package/src/modules/login/utils.ts +0 -42
  119. package/src/modules/modelManage/ConfigDrawer.tsx +0 -249
  120. package/src/modules/modelManage/assets/empty.png +0 -0
  121. package/src/modules/modelManage/const.ts +0 -50
  122. package/src/modules/modelManage/index.tsx +0 -439
  123. package/src/modules/modelManage/server.ts +0 -185
  124. package/src/modules/nodegraph/index.tsx +0 -1
  125. package/src/modules/search/assets/Icon-history.svg +0 -8
  126. package/src/modules/search/assets/answerAwartar.png +0 -0
  127. package/src/modules/search/assets/doc.png +0 -0
  128. package/src/modules/search/assets/genera.gif +0 -0
  129. package/src/modules/search/assets/icon-robot.svg +0 -9
  130. package/src/modules/search/assets/icon-search-bar.svg +0 -14
  131. package/src/modules/search/assets/icon-sub-title.svg +0 -3
  132. package/src/modules/search/assets/icon-title.svg +0 -9
  133. package/src/modules/search/assets/icon-zoomOut.svg +0 -9
  134. package/src/modules/search/assets/iconAi.svg +0 -9
  135. package/src/modules/search/assets/pdf.png +0 -0
  136. package/src/modules/search/assets/ppt.png +0 -0
  137. package/src/modules/search/assets/search.svg +0 -3
  138. package/src/modules/search/assets/selected.svg +0 -4
  139. package/src/modules/search/assets/txt.png +0 -0
  140. package/src/modules/search/assets/xls.png +0 -0
  141. package/src/modules/search/components/AssisSelect.tsx +0 -137
  142. package/src/modules/search/components/Editor/ChatViewEditor.tsx +0 -261
  143. package/src/modules/search/components/Editor/aichat.css +0 -1
  144. package/src/modules/search/components/Editor/constant.ts +0 -13
  145. package/src/modules/search/components/Editor/index.tsx +0 -113
  146. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +0 -332
  147. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +0 -20
  148. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +0 -38
  149. package/src/modules/search/components/Editor/plugins/displayer.ts +0 -298
  150. package/src/modules/search/components/Editor/plugins/imageClick.tsx +0 -32
  151. package/src/modules/search/components/Editor/plugins/myplugin.tsx +0 -98
  152. package/src/modules/search/components/Editor/ui/avatar.tsx +0 -19
  153. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +0 -21
  154. package/src/modules/search/components/Editor/ui/button.tsx +0 -58
  155. package/src/modules/search/components/Editor/ui/calendar.tsx +0 -68
  156. package/src/modules/search/components/Editor/ui/caption.tsx +0 -46
  157. package/src/modules/search/components/Editor/ui/checkbox.tsx +0 -27
  158. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +0 -188
  159. package/src/modules/search/components/Editor/ui/code-block-element.css +0 -434
  160. package/src/modules/search/components/Editor/ui/code-block-element.tsx +0 -39
  161. package/src/modules/search/components/Editor/ui/code-leaf.tsx +0 -24
  162. package/src/modules/search/components/Editor/ui/code-line-element.tsx +0 -10
  163. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +0 -21
  164. package/src/modules/search/components/Editor/ui/column-element.tsx +0 -30
  165. package/src/modules/search/components/Editor/ui/column-group-element.tsx +0 -94
  166. package/src/modules/search/components/Editor/ui/command.tsx +0 -75
  167. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +0 -22
  168. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +0 -37
  169. package/src/modules/search/components/Editor/ui/comment-item.tsx +0 -74
  170. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +0 -49
  171. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +0 -42
  172. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +0 -22
  173. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +0 -32
  174. package/src/modules/search/components/Editor/ui/comment-value.tsx +0 -34
  175. package/src/modules/search/components/Editor/ui/comments-popover.tsx +0 -63
  176. package/src/modules/search/components/Editor/ui/date-element.tsx +0 -83
  177. package/src/modules/search/components/Editor/ui/dialog.tsx +0 -63
  178. package/src/modules/search/components/Editor/ui/draggable.tsx +0 -177
  179. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +0 -180
  180. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +0 -85
  181. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +0 -28
  182. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +0 -76
  183. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +0 -8
  184. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +0 -51
  185. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +0 -77
  186. package/src/modules/search/components/Editor/ui/heading-element.tsx +0 -48
  187. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +0 -17
  188. package/src/modules/search/components/Editor/ui/hr-element.tsx +0 -30
  189. package/src/modules/search/components/Editor/ui/icons.tsx +0 -267
  190. package/src/modules/search/components/Editor/ui/image-element.tsx +0 -74
  191. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +0 -368
  192. package/src/modules/search/components/Editor/ui/input.tsx +0 -25
  193. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +0 -218
  194. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +0 -20
  195. package/src/modules/search/components/Editor/ui/link-element.tsx +0 -29
  196. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +0 -161
  197. package/src/modules/search/components/Editor/ui/list-element.tsx +0 -30
  198. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +0 -24
  199. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +0 -133
  200. package/src/modules/search/components/Editor/ui/media-popover.tsx +0 -97
  201. package/src/modules/search/components/Editor/ui/mention-element.tsx +0 -43
  202. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +0 -141
  203. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +0 -93
  204. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +0 -67
  205. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +0 -4
  206. package/src/modules/search/components/Editor/ui/placeholder.tsx +0 -52
  207. package/src/modules/search/components/Editor/ui/popover.tsx +0 -32
  208. package/src/modules/search/components/Editor/ui/resizable.tsx +0 -66
  209. package/src/modules/search/components/Editor/ui/separator.tsx +0 -25
  210. package/src/modules/search/components/Editor/ui/style.less +0 -12
  211. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +0 -143
  212. package/src/modules/search/components/Editor/ui/table-element.tsx +0 -243
  213. package/src/modules/search/components/Editor/ui/table-row-element.tsx +0 -22
  214. package/src/modules/search/components/Editor/ui/tableValue.tsx +0 -135
  215. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +0 -43
  216. package/src/modules/search/components/Editor/ui/toggle-element.tsx +0 -31
  217. package/src/modules/search/components/Editor/ui/toolbar.tsx +0 -157
  218. package/src/modules/search/components/Editor/ui/tooltip.tsx +0 -65
  219. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +0 -160
  220. package/src/modules/search/components/Editor/ui/with-draggables.tsx +0 -175
  221. package/src/modules/search/components/FileList.tsx +0 -287
  222. package/src/modules/search/components/ImageGroupView/index.tsx +0 -85
  223. package/src/modules/search/components/ResultContent.tsx +0 -232
  224. package/src/modules/search/components/SearchInput.tsx +0 -232
  225. package/src/modules/search/components/SearchLanding.tsx +0 -74
  226. package/src/modules/search/components/SearchView.tsx +0 -563
  227. package/src/modules/search/components/SimpleEditor.tsx +0 -158
  228. package/src/modules/search/components/SimpleFileList.tsx +0 -215
  229. package/src/modules/search/index.tsx +0 -10
  230. package/src/modules/search/reademe.md +0 -1
  231. package/src/modules/search/servers/apis.tsx +0 -19
  232. package/src/modules/search/servers/index.ts +0 -184
  233. package/src/modules/search/style.less +0 -503
  234. package/src/modules/search/type.ts +0 -22
  235. package/src/modules/search/utils.ts +0 -34
  236. package/src/modules/sensitive/index.tsx +0 -313
  237. package/src/modules/sensitive/server.ts +0 -122
  238. package/src/modules/streamFilesReader/GientechStreamReader.tsx +0 -1555
  239. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  240. package/src/modules/streamFilesReader/components/Header/index.tsx +0 -297
  241. package/src/modules/streamFilesReader/index.tsx +0 -3
  242. package/src/style.css +0 -6
  243. package/src/type.d.ts +0 -0
  244. package/src/utils/commonFn.tsx +0 -111
  245. package/src/utils/gientechCommon/components/AppError.tsx +0 -32
  246. package/src/utils/gientechCommon/components/AppLoading.tsx +0 -75
  247. package/src/utils/gientechCommon/components/DeleteModal.tsx +0 -75
  248. package/src/utils/gientechCommon/components/DisplayError.tsx +0 -33
  249. package/src/utils/gientechCommon/components/DisplayLoading.tsx +0 -38
  250. package/src/utils/gientechCommon/components/FeedBackModal.tsx +0 -310
  251. package/src/utils/gientechCommon/components/FileCardCommon.tsx +0 -82
  252. package/src/utils/gientechCommon/components/FileManager/index.tsx +0 -390
  253. package/src/utils/gientechCommon/components/FileManager/style.css +0 -5
  254. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +0 -296
  255. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +0 -339
  256. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +0 -245
  257. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +0 -209
  258. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  259. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +0 -148
  260. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +0 -14
  261. package/src/utils/gientechCommon/components/RenameModal.tsx +0 -86
  262. package/src/utils/gientechCommon/components/style.less +0 -11
  263. package/src/utils/gientechCommon/configs/commonConfig.ts +0 -2
  264. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  265. package/src/utils/gientechCommon/configs/stylesConfig.ts +0 -142
  266. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +0 -345
  267. package/src/utils/gientechCommon/slate/converters/deserializers.ts +0 -763
  268. package/src/utils/gientechCommon/slate/converters/mockData.ts +0 -232
  269. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +0 -258
  270. package/src/utils/gientechCommon/slate/richElements/index.tsx +0 -499
  271. package/src/utils/gientechCommon/utils/request.ts +0 -37
  272. package/src/utils/gientechCommon/utils/serverFn.ts +0 -172
  273. package/src/utils/index.tsx +0 -126
  274. package/src/utils/testconfigs/demologin/index.tsx +0 -32
  275. package/src/utils/testconfigs/index.ts +0 -53
  276. package/src/vite-env.d.ts +0 -11
  277. package/stats.html +0 -4949
  278. package/tailwind.config.js +0 -170
  279. package/tsconfig.app.json +0 -30
  280. package/tsconfig.app.tsbuildinfo +0 -11
  281. package/tsconfig.json +0 -13
  282. package/tsconfig.node.json +0 -22
  283. package/tsconfig.node.tsbuildinfo +0 -1
  284. package/vite.config.ts +0 -177
  285. package/workflows/release.yml +0 -60
  286. /package/{dist/assets → assets}/Doris.png +0 -0
  287. /package/{dist/assets → assets}/PostgreSQL.png +0 -0
  288. /package/{dist/assets → assets}/SQLServer.png +0 -0
  289. /package/{dist/assets → assets}/_commonjsHelpers-gnU0ypJ3.js +0 -0
  290. /package/{dist/assets → assets}/circle-alert-g2Y6zAjt.js +0 -0
  291. /package/{dist/assets → assets}/empty.png +0 -0
  292. /package/{dist/assets → assets}/index-CEK88UzR.js +0 -0
  293. /package/{dist/assets → assets}/index-CpW6Dhpp.js +0 -0
  294. /package/{dist/assets → assets}/plus-omCUN0e3.js +0 -0
  295. /package/{dist/assets → assets}/style.css +0 -0
  296. /package/{dist/assets → assets}/style2.css +0 -0
  297. /package/{dist/assets → assets}/style3.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,86 +0,0 @@
1
- import { BorderBottomOutlined } from "@ant-design/icons";
2
- import { Button, ConfigProvider, Form, Input, Modal } from "antd";
3
- import { useForm } from "antd/es/form/Form";
4
- import { useEffect } from "react";
5
-
6
- export const RenameModal = ({
7
- isModalOpen,
8
- handleOk,
9
- handleCancel,
10
- data
11
- }: any) => {
12
- const modalStyles = {
13
- header: {
14
- height: "60px",
15
- borderBottom: "1px solid #F0F0F0",
16
- display: "flex",
17
- paddingLeft: "24px",
18
- alignItems: "center",
19
- marginBottom: "16px"
20
- },
21
- title: { fontSize: "16px" },
22
- body: { padding: "0 24px" },
23
- mask: {},
24
- footer: { marginTop: "0px", padding: "0 24px 16px 24px" },
25
- content: { padding: 0 }
26
- };
27
- const [rename_form] = useForm();
28
- useEffect(() => {
29
- if (!isModalOpen) {
30
- rename_form.resetFields();
31
- return;
32
- }
33
- rename_form.setFieldValue("new_name", data?.label);
34
- }, [data, isModalOpen]);
35
- return (
36
- <ConfigProvider
37
- modal={{
38
- styles: modalStyles
39
- }}
40
- >
41
- <Modal
42
- title={<div className="text-[16px]">编辑会话名称</div>}
43
- closeIcon={null}
44
- open={isModalOpen}
45
- width={520}
46
- centered
47
- className="[&:[.ant-modal-content]]:bg-red"
48
- footer={
49
- <div className="mt-[16px] flex justify-end">
50
- <Button
51
- children="取消"
52
- onClick={handleCancel}
53
- className="mr-[8px]"
54
- />
55
- <Button
56
- children="确认"
57
- onClick={async () => {
58
- try {
59
- const data = await rename_form.validateFields();
60
- handleOk("ok_rename", data);
61
- } catch (e) {
62
- console.log(e);
63
- return;
64
- }
65
- }}
66
- type="primary"
67
- className="border-none"
68
- />
69
- </div>
70
- }
71
- >
72
- <Form form={rename_form}>
73
- <Form.Item
74
- name="new_name"
75
- rules={[
76
- { required: true, message: "请输入" },
77
- { max: 100, message: "最大字数限制100" }
78
- ]}
79
- >
80
- <Input />
81
- </Form.Item>
82
- </Form>
83
- </Modal>
84
- </ConfigProvider>
85
- );
86
- };
@@ -1,11 +0,0 @@
1
- .selfTree {
2
- .ant-tree .ant-tree-treenode {
3
- padding: 4px 0 4px 0;
4
- }
5
- .ant-tree-switcher {
6
- display: none;
7
- }
8
- .ant-tree-indent {
9
- display: none;
10
- }
11
- }
@@ -1,2 +0,0 @@
1
- export const maxPollCount = 1000;
2
- export const maxPollInterval = 3000;
File without changes
@@ -1,142 +0,0 @@
1
- // 主题类型定义
2
- export type SizeType = 'sm' | 'md' | 'lg'
3
- export type FontWeightType = 'normal' | 'bold' |'thin'
4
- export type FontFamilyType = 'default' | 'serif' | 'mono'
5
-
6
- export interface AiChatStyles {
7
- theme?: AppTheme
8
- mode?: 'light' | 'dark'
9
- [key: string]: any
10
- }
11
-
12
- export interface ThemeColors {
13
- primary: string
14
- secondary: string
15
- success: string
16
- warning: string
17
- error: string
18
- info: string
19
- background: string
20
- text: string
21
- border: string
22
- disabled: string
23
- disabledBackground: string
24
- disabledText: string
25
- shadow: string
26
- appBackground: string
27
- }
28
-
29
- export interface ThemeOthers {
30
-
31
- }
32
-
33
- export interface ThemeSpace {
34
- sidebar: string
35
- size: string
36
- radius: string
37
- padding: string
38
- margin: string
39
- shadow: string
40
- lineHeight: string
41
- }
42
-
43
- export interface ThemeIcons {
44
- aiAvatar: string
45
- userAvatar: string
46
- pdf: string
47
- word: string
48
- image: string
49
- video: string
50
- audio: string
51
- excel: string
52
- ppt: string
53
- }
54
-
55
- export interface AppTheme {
56
- colors: ThemeColors
57
-
58
- space: ThemeSpace
59
- icons: ThemeIcons
60
- others: ThemeOthers
61
- }
62
-
63
- // 默认主题实现
64
- export const defaultTheme: AppTheme = {
65
- colors: {
66
- primary: '#007bff',
67
- secondary: '#6c757d',
68
- success: '#008000',
69
- warning: '#FFA500',
70
- error: '#FF0000',
71
- info: '#0000FF',
72
- background: '#f8f9fa',
73
- text: '#343a40',
74
- border: '#dee2e6',
75
- disabled: '#808080',
76
- disabledBackground: '#F5F5F5',
77
- disabledText: '#808080',
78
- shadow: '#000000',
79
- appBackground: '#fff',
80
- },
81
- space: {
82
- sidebar: 'md',
83
- size: 'md',
84
- radius: 'md',
85
- padding: 'md',
86
- margin: 'md',
87
- shadow: 'md',
88
- lineHeight: 'md',
89
- },
90
- icons: {
91
- aiAvatar: 'http://10.15.12.13:9000/dev-rag-data/header_pic/JIABINBIN00/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20231212161213.jpg',
92
- userAvatar: 'http://10.15.12.13:9005/assets/nav-logo-BKaOCDqi.png',
93
- pdf: 'https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/pdf-icon.png',
94
- word: 'https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/word-icon.png',
95
- image: 'https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/image-icon.png',
96
- video: 'https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/video-icon.png',
97
- audio: 'https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/audio-icon.png',
98
- excel: 'https://ai-chat-1326151111.cos.c zap-shanghai.myqcloud.com/excel-icon.png',
99
- ppt: 'https://ai-chat-1326151111.cos.ap-shanghai.myqcloud.com/ppt-icon.png',
100
- },
101
- others: {
102
- baseFontWeight: 'normal',
103
- },
104
- }
105
-
106
- // SizeType 映射表
107
- export const sidebarMap = {
108
- sm: '240px',
109
- md: '260px',
110
- lg: '280px',
111
- };
112
- export const sizeMap = {
113
- sm: '12px',
114
- md: '16px',
115
- lg: '20px',
116
- };
117
- export const radiusMap = {
118
- sm: '2px',
119
- md: '4px',
120
- lg: '8px',
121
- };
122
- export const paddingMap = {
123
- sm: '4px',
124
- md: '8px',
125
- lg: '16px',
126
- };
127
- export const marginMap = {
128
- sm: '4px',
129
- md: '8px',
130
- lg: '16px',
131
- };
132
- export const shadowMap = {
133
- sm: '0 1px 2px #eee',
134
- md: '0 2px 8px #ddd',
135
- lg: '0 4px 16px #ccc',
136
- };
137
- export const lineHeightMap = {
138
- sm: '1.2',
139
- md: '1.5',
140
- lg: '2',
141
- };
142
-
@@ -1,345 +0,0 @@
1
- import { EventSourceMessage, fetchEventSource } from '@microsoft/fetch-event-source';
2
-
3
- import { uid } from 'uid';
4
- import { AppStatusManager } from '@mxmweb/aichat';
5
-
6
- interface Api_Chat {
7
- sessionId: string;
8
- queryId: string;
9
- name: string;
10
- lastDate: string | number;
11
- type: string;
12
- content: string;
13
- configId: string;
14
- audioUrl: string;
15
- fileUids: any[];
16
- signal?: AbortSignal;
17
- sysType?: 'KNO_INDEX' | 'INT_SESSION' | 'TEMPORARY';
18
- }
19
-
20
- export enum StatusType {
21
- Pending = 0,
22
- Process,
23
- Done,
24
- Error,
25
- }
26
-
27
- class FatalError extends Error {}
28
-
29
- let currentStreamController: AbortController | null = null;
30
-
31
- const AichatUseController = ({
32
- baseUrl,
33
- token,
34
- CSRFToken,
35
- setChatData,
36
- activeSessionId,
37
- setAppStatus,
38
- setConversationList,
39
- }: {
40
- baseUrl: string;
41
- token: string;
42
- CSRFToken?: string;
43
- setChatData: (arg: any[] | ((prev: any[]) => any[])) => void;
44
- activeSessionId: string | undefined;
45
- setAppStatus: React.Dispatch<React.SetStateAction<AppStatusManager>>;
46
- setConversationList: React.Dispatch<React.SetStateAction<any[]>>;
47
- }) => {
48
- const reset_chat = ({
49
- content,
50
- status,
51
- respTime,
52
- filePaths,
53
- reference,
54
- webReference,
55
- graphReference,
56
- databaseReference,
57
- llmType,
58
- resultType,
59
- queryId,
60
- tokens,
61
- }: {
62
- content: string;
63
- status: StatusType;
64
- respTime: number;
65
- filePaths: any[];
66
- reference: string;
67
- webReference: string;
68
- graphReference?: string;
69
- databaseReference?: any;
70
- llmType: number;
71
- resultType: number;
72
- queryId?: string;
73
- tokens: number;
74
- [key: string]: any;
75
- }) => {
76
- setChatData((chatList: any) => {
77
- if (!chatList[0]) return chatList;
78
- const current = chatList[0];
79
- const messages = current.messages || [];
80
- const lastIndex = messages.length - 1;
81
- if (lastIndex < 0) return chatList;
82
- const lastMessage = messages[lastIndex];
83
- if (lastMessage.istype !== 'ai') return chatList;
84
-
85
- // 更新上一条 user 的 filePaths(不可变)
86
- let newMessages = messages.slice();
87
- if (filePaths?.length) {
88
- const lastSecondIndex = messages.length - 2;
89
- if (lastSecondIndex >= 0 && messages[lastSecondIndex]?.istype === 'user') {
90
- const lastSecond = { ...messages[lastSecondIndex], filePaths };
91
- newMessages[lastSecondIndex] = lastSecond;
92
- }
93
- }
94
-
95
- const updatedLast = {
96
- ...lastMessage,
97
- content: (lastMessage.content || '') + content,
98
- status,
99
- respTime,
100
- filePaths,
101
- reference,
102
- webReference,
103
- graphReference: graphReference ?? lastMessage.graphReference,
104
- // 流式阶段若后端带来了 databaseReference,写入当前 AI 消息
105
- databaseReference: databaseReference ?? lastMessage.databaseReference,
106
- resultType,
107
- llmType,
108
- tokens,
109
- queryId: queryId || lastMessage.queryId || uid(32),
110
- } as any;
111
- updatedLast.clientSideId = updatedLast.clientSideId || updatedLast.queryId + '-ai';
112
- newMessages[lastIndex] = updatedLast;
113
-
114
- const newChat0 = { ...current, isNew: false, messages: newMessages };
115
- return [newChat0, ...chatList.slice(1)];
116
- });
117
- };
118
-
119
- const onErrorCallback = (err: any) => {
120
- if (err instanceof FatalError) {
121
- setAppStatus((pre:any) => ({ ...pre, display: 'error', sender: 'ready' }));
122
- if (currentStreamController) {
123
- currentStreamController.abort();
124
- currentStreamController = null;
125
- }
126
- throw err;
127
- }
128
- // 其他错误可选处理
129
- };
130
-
131
- const api_startChat_re = (data: Api_Chat, onSuccess?: (gmtModified: number) => void) => {
132
- if (currentStreamController) {
133
- currentStreamController.abort();
134
- }
135
- currentStreamController = new AbortController();
136
- const eventSourceUrl = `${baseUrl}/qa/ai/question_re`;
137
- console.log('data', data);
138
- const params = { ...data };
139
- fetchEventSource(eventSourceUrl, {
140
- method: 'post',
141
- signal: currentStreamController.signal,
142
- headers: {
143
- 'Content-Type': 'application/json',
144
- Accept: 'text/event-stream',
145
- Authorization: token || '',
146
- 'X-CSRF-TOKEN-IN': CSRFToken || '',
147
- },
148
- openWhenHidden: true,
149
- body: JSON.stringify(params),
150
- onopen: async response => {
151
- if (response.status === 500) {
152
- throw new FatalError('Internal Server Error');
153
- }
154
- if (!response.ok) {
155
- throw new FatalError(`HTTP error: ${response.status}`);
156
- }
157
- // 其他状态可根据需要处理
158
- },
159
- onmessage: event => {
160
- const curData = JSON.parse(event.data);
161
- if (activeSessionId !== curData.sessionId) return;
162
- const {
163
- reply,
164
- resultType,
165
- respTime,
166
- reference,
167
- webReference,
168
- graphReference,
169
- filePaths,
170
- status,
171
- docs,
172
- llmType,
173
- databaseReference,
174
- } = curData;
175
- const _filePaths = filePaths ? JSON.parse(filePaths) : [];
176
- //console.log('curData```````````````````````',curData,curData.tokens);
177
- // === 新增:流式错误兜底 ===
178
- if (
179
- status === StatusType.Done &&
180
- reply &&
181
- reply.content &&
182
- (reply.content.includes('模型暂无法返回') ||
183
- reply.content.includes('失败') ||
184
- reply.content.includes('错误') ||
185
- reply.content.includes('请稍后再试'))
186
- ) {
187
- setAppStatus((pre:any) => ({ ...pre, display: 'ready', sender: 'ready' }));
188
- }
189
- if (status === StatusType.Done) {
190
- reset_chat({
191
- content: reply.content || '',
192
- status: StatusType.Done, // 流式完成时,消息状态应该是 Done
193
- respTime: respTime,
194
- filePaths: _filePaths,
195
- reference: reference || docs || '',
196
- webReference: webReference || '',
197
- graphReference: graphReference || null,
198
- databaseReference,
199
- llmType,
200
- resultType,
201
- queryId: curData.queryId,
202
- tokens: curData.tokens,
203
- });
204
- setAppStatus((pre:any) => {
205
- return {
206
- ...pre,
207
- display: 'ready',
208
- sender: 'ready',
209
- };
210
- });
211
- if (onSuccess) {
212
- const gmtModified = respTime || Date.now();
213
- console.log('[AichatUseController] 消息发送成功,gmtModified:', gmtModified);
214
- onSuccess(gmtModified);
215
- }
216
- } else {
217
- reset_chat({
218
- content: reply.content || '',
219
- status: status,
220
- respTime: respTime,
221
- filePaths: _filePaths,
222
- reference: reference || docs || '',
223
- webReference: webReference || '',
224
- graphReference: graphReference || null, // 流式过程中保持之前的graphReference值
225
- databaseReference,
226
- llmType,
227
- resultType,
228
- queryId: curData.queryId,
229
- tokens: curData.tokens,
230
- });
231
- }
232
- },
233
- onerror: onErrorCallback,
234
- });
235
- };
236
-
237
- const setLastEmptyMessage = ({ now }: { now: number }) => {
238
- setChatData((chatList: any[]) => {
239
- if (!chatList[0]) return chatList;
240
- const current = chatList[0];
241
- const messages = current.messages || [];
242
- if (!messages.length) return chatList;
243
- const lastIndex = messages.length - 1;
244
- if (lastIndex < 0) return chatList;
245
- const lastMessage = messages[lastIndex];
246
- if (lastMessage.istype !== 'ai') return chatList;
247
- const newMessages = messages.slice();
248
- newMessages[lastIndex] = {
249
- ...lastMessage,
250
- istype: 'ai',
251
- content: '',
252
- time: now,
253
- streaming: true,
254
- status: StatusType.Pending,
255
- } as any;
256
- const newChat0 = { ...current, messages: newMessages };
257
- return [newChat0, ...chatList.slice(1)];
258
- });
259
- };
260
-
261
- const addEmptyMessage = ({
262
- queryId,
263
- content,
264
- filePaths,
265
- currentFiles,
266
- }: {
267
- queryId: string;
268
- content: string;
269
- filePaths?: string;
270
- currentFiles?: any[];
271
- }) => {
272
- setChatData((chatList: any[]) => {
273
- const now = new Date().toISOString();
274
- const _queryId = queryId || uid(32); // 保证只生成一次
275
- const userMessage = {
276
- istype: 'user',
277
- content: content,
278
- time: now,
279
- queryId: _queryId,
280
- clientSideId: _queryId + '-user',
281
- filePaths: filePaths || '',
282
- currentFiles: currentFiles || [],
283
- };
284
- const aiMessage = {
285
- istype: 'ai',
286
- content: '', // AI回复流式填充
287
- time: new Date(Date.now() + 1).toISOString(),
288
- streaming: true,
289
- status: StatusType.Pending,
290
- queryId: _queryId,
291
- clientSideId: _queryId + '-ai',
292
- };
293
-
294
- // 找到当前激活的对话
295
- const activeChat = chatList.find(chat => chat.id === activeSessionId);
296
-
297
- if (activeChat) {
298
- // 如果激活的对话存在,则向其添加新消息
299
- activeChat.messages.push(userMessage, aiMessage);
300
- } else {
301
- // 如果没有激活的对话(例如首次加载),则需要特殊处理
302
- // 这里的逻辑可能需要根据产品需求调整,是创建新对话还是报错
303
- // 假设我们总是有一个激活的对话
304
- console.warn('addEmptyMessage called without an active session.');
305
- }
306
- return [...chatList];
307
- });
308
- };
309
-
310
- // 主动终止当前 stream
311
- const stopStream = () => {
312
- if (currentStreamController) {
313
- currentStreamController.abort();
314
- currentStreamController = null;
315
- }
316
- setAppStatus((pre:any) => ({ ...pre, display: 'ready', sender: 'ready' }));
317
- };
318
-
319
- const updateUserFilesMessage = ({ currentFiles }: { currentFiles: any[] }) => {
320
- setChatData((chatList: any[]) => {
321
- if (!chatList[0]) return chatList;
322
- const current = chatList[0];
323
- const messages = current.messages || [];
324
- if (!messages.length) return chatList;
325
- const lastIndex = messages.length - 2;
326
- if (lastIndex < 0) return chatList;
327
- const lastMessage = messages[lastIndex];
328
- if (lastMessage.istype !== 'user') return chatList;
329
- const newMessages = messages.slice();
330
- newMessages[lastIndex] = { ...messages[lastIndex], currentFiles } as any;
331
- const newChat0 = { ...current, messages: newMessages };
332
- return [newChat0, ...chatList.slice(1)];
333
- });
334
- };
335
-
336
- return {
337
- updateUserFilesMessage,
338
- api_startChat_re,
339
- addEmptyMessage,
340
- setLastEmptyMessage,
341
- stopStream,
342
- };
343
- };
344
-
345
- export default AichatUseController;