@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,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,339 +0,0 @@
1
- import { EventSourceMessage, fetchEventSource } from '@microsoft/fetch-event-source';
2
-
3
- import { uid } from 'uid';
4
- import { AppStatusManager } from '../../../components/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
- databaseReference,
56
- llmType,
57
- resultType,
58
- queryId,
59
- tokens,
60
- }: {
61
- content: string;
62
- status: StatusType;
63
- respTime: number;
64
- filePaths: any[];
65
- reference: string;
66
- webReference: string;
67
- databaseReference?: any;
68
- llmType: number;
69
- resultType: number;
70
- queryId?: string;
71
- tokens: number;
72
- [key: string]: any;
73
- }) => {
74
- setChatData((chatList: any) => {
75
- if (!chatList[0]) return chatList;
76
- const current = chatList[0];
77
- const messages = current.messages || [];
78
- const lastIndex = messages.length - 1;
79
- if (lastIndex < 0) return chatList;
80
- const lastMessage = messages[lastIndex];
81
- if (lastMessage.istype !== 'ai') return chatList;
82
-
83
- // 更新上一条 user 的 filePaths(不可变)
84
- let newMessages = messages.slice();
85
- if (filePaths?.length) {
86
- const lastSecondIndex = messages.length - 2;
87
- if (lastSecondIndex >= 0 && messages[lastSecondIndex]?.istype === 'user') {
88
- const lastSecond = { ...messages[lastSecondIndex], filePaths };
89
- newMessages[lastSecondIndex] = lastSecond;
90
- }
91
- }
92
-
93
- const updatedLast = {
94
- ...lastMessage,
95
- content: (lastMessage.content || '') + content,
96
- status,
97
- respTime,
98
- filePaths,
99
- reference,
100
- webReference,
101
- // 流式阶段若后端带来了 databaseReference,写入当前 AI 消息
102
- databaseReference: databaseReference ?? lastMessage.databaseReference,
103
- resultType,
104
- llmType,
105
- tokens,
106
- queryId: queryId || lastMessage.queryId || uid(32),
107
- } as any;
108
- updatedLast.clientSideId = updatedLast.clientSideId || updatedLast.queryId + '-ai';
109
- newMessages[lastIndex] = updatedLast;
110
-
111
- const newChat0 = { ...current, isNew: false, messages: newMessages };
112
- return [newChat0, ...chatList.slice(1)];
113
- });
114
- };
115
-
116
- const onErrorCallback = (err: any) => {
117
- if (err instanceof FatalError) {
118
- setAppStatus(pre => ({ ...pre, display: 'error', sender: 'ready' }));
119
- if (currentStreamController) {
120
- currentStreamController.abort();
121
- currentStreamController = null;
122
- }
123
- throw err;
124
- }
125
- // 其他错误可选处理
126
- };
127
-
128
- const api_startChat_re = (data: Api_Chat, onSuccess?: (gmtModified: number) => void) => {
129
- if (currentStreamController) {
130
- currentStreamController.abort();
131
- }
132
- currentStreamController = new AbortController();
133
- const eventSourceUrl = `${baseUrl}/qa/ai/question_re`;
134
- console.log('data', data);
135
- const params = { ...data };
136
- fetchEventSource(eventSourceUrl, {
137
- method: 'post',
138
- signal: currentStreamController.signal,
139
- headers: {
140
- 'Content-Type': 'application/json',
141
- Accept: 'text/event-stream',
142
- Authorization: token || '',
143
- 'X-CSRF-TOKEN-IN': CSRFToken || '',
144
- },
145
- openWhenHidden: true,
146
- body: JSON.stringify(params),
147
- onopen: async response => {
148
- if (response.status === 500) {
149
- throw new FatalError('Internal Server Error');
150
- }
151
- if (!response.ok) {
152
- throw new FatalError(`HTTP error: ${response.status}`);
153
- }
154
- // 其他状态可根据需要处理
155
- },
156
- onmessage: event => {
157
- const curData = JSON.parse(event.data);
158
- if (activeSessionId !== curData.sessionId) return;
159
- const {
160
- reply,
161
- resultType,
162
- respTime,
163
- reference,
164
- webReference,
165
- filePaths,
166
- status,
167
- docs,
168
- llmType,
169
- databaseReference,
170
- } = curData;
171
- const _filePaths = filePaths ? JSON.parse(filePaths) : [];
172
- //console.log('curData```````````````````````',curData,curData.tokens);
173
- // === 新增:流式错误兜底 ===
174
- if (
175
- status === StatusType.Done &&
176
- reply &&
177
- reply.content &&
178
- (reply.content.includes('模型暂无法返回') ||
179
- reply.content.includes('失败') ||
180
- reply.content.includes('错误') ||
181
- reply.content.includes('请稍后再试'))
182
- ) {
183
- setAppStatus(pre => ({ ...pre, display: 'ready', sender: 'ready' }));
184
- }
185
- if (status === StatusType.Done) {
186
- reset_chat({
187
- content: reply.content || '',
188
- status: StatusType.Done, // 流式完成时,消息状态应该是 Done
189
- respTime: respTime,
190
- filePaths: _filePaths,
191
- reference: reference || docs || '',
192
- webReference: webReference || '',
193
- databaseReference,
194
- llmType,
195
- resultType,
196
- queryId: curData.queryId,
197
- tokens: curData.tokens,
198
- });
199
- setAppStatus(pre => {
200
- return {
201
- ...pre,
202
- display: 'ready',
203
- sender: 'ready',
204
- };
205
- });
206
- if (onSuccess) {
207
- const gmtModified = respTime || Date.now();
208
- console.log('[AichatUseController] 消息发送成功,gmtModified:', gmtModified);
209
- onSuccess(gmtModified);
210
- }
211
- } else {
212
- reset_chat({
213
- content: reply.content || '',
214
- status: status,
215
- respTime: respTime,
216
- filePaths: _filePaths,
217
- reference: reference || docs || '',
218
- webReference: webReference || '',
219
- databaseReference,
220
- llmType,
221
- resultType,
222
- queryId: curData.queryId,
223
- tokens: curData.tokens,
224
- });
225
- }
226
- },
227
- onerror: onErrorCallback,
228
- });
229
- };
230
-
231
- const setLastEmptyMessage = ({ now }: { now: number }) => {
232
- setChatData((chatList: any[]) => {
233
- if (!chatList[0]) return chatList;
234
- const current = chatList[0];
235
- const messages = current.messages || [];
236
- if (!messages.length) return chatList;
237
- const lastIndex = messages.length - 1;
238
- if (lastIndex < 0) return chatList;
239
- const lastMessage = messages[lastIndex];
240
- if (lastMessage.istype !== 'ai') return chatList;
241
- const newMessages = messages.slice();
242
- newMessages[lastIndex] = {
243
- ...lastMessage,
244
- istype: 'ai',
245
- content: '',
246
- time: now,
247
- streaming: true,
248
- status: StatusType.Pending,
249
- } as any;
250
- const newChat0 = { ...current, messages: newMessages };
251
- return [newChat0, ...chatList.slice(1)];
252
- });
253
- };
254
-
255
- const addEmptyMessage = ({
256
- queryId,
257
- content,
258
- filePaths,
259
- currentFiles,
260
- }: {
261
- queryId: string;
262
- content: string;
263
- filePaths?: string;
264
- currentFiles?: any[];
265
- }) => {
266
- setChatData((chatList: any[]) => {
267
- const now = new Date().toISOString();
268
- const _queryId = queryId || uid(32); // 保证只生成一次
269
- const userMessage = {
270
- istype: 'user',
271
- content: content,
272
- time: now,
273
- queryId: _queryId,
274
- clientSideId: _queryId + '-user',
275
- filePaths: filePaths || '',
276
- currentFiles: currentFiles || [],
277
- };
278
- const aiMessage = {
279
- istype: 'ai',
280
- content: '', // AI回复流式填充
281
- time: new Date(Date.now() + 1).toISOString(),
282
- streaming: true,
283
- status: StatusType.Pending,
284
- queryId: _queryId,
285
- clientSideId: _queryId + '-ai',
286
- };
287
-
288
- // 找到当前激活的对话
289
- const activeChat = chatList.find(chat => chat.id === activeSessionId);
290
-
291
- if (activeChat) {
292
- // 如果激活的对话存在,则向其添加新消息
293
- activeChat.messages.push(userMessage, aiMessage);
294
- } else {
295
- // 如果没有激活的对话(例如首次加载),则需要特殊处理
296
- // 这里的逻辑可能需要根据产品需求调整,是创建新对话还是报错
297
- // 假设我们总是有一个激活的对话
298
- console.warn('addEmptyMessage called without an active session.');
299
- }
300
- return [...chatList];
301
- });
302
- };
303
-
304
- // 主动终止当前 stream
305
- const stopStream = () => {
306
- if (currentStreamController) {
307
- currentStreamController.abort();
308
- currentStreamController = null;
309
- }
310
- setAppStatus(pre => ({ ...pre, display: 'ready', sender: 'ready' }));
311
- };
312
-
313
- const updateUserFilesMessage = ({ currentFiles }: { currentFiles: any[] }) => {
314
- setChatData((chatList: any[]) => {
315
- if (!chatList[0]) return chatList;
316
- const current = chatList[0];
317
- const messages = current.messages || [];
318
- if (!messages.length) return chatList;
319
- const lastIndex = messages.length - 2;
320
- if (lastIndex < 0) return chatList;
321
- const lastMessage = messages[lastIndex];
322
- if (lastMessage.istype !== 'user') return chatList;
323
- const newMessages = messages.slice();
324
- newMessages[lastIndex] = { ...messages[lastIndex], currentFiles } as any;
325
- const newChat0 = { ...current, messages: newMessages };
326
- return [newChat0, ...chatList.slice(1)];
327
- });
328
- };
329
-
330
- return {
331
- updateUserFilesMessage,
332
- api_startChat_re,
333
- addEmptyMessage,
334
- setLastEmptyMessage,
335
- stopStream,
336
- };
337
- };
338
-
339
- export default AichatUseController;