@gientech/modual 1.2.7 → 1.2.9-fix

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 (377) hide show
  1. package/.editorconfig +38 -0
  2. package/.prettierignore +16 -0
  3. package/.prettierrc +17 -0
  4. package/README.md +643 -129
  5. package/USAGE.md +247 -0
  6. package/bash.exe.stackdump +40 -0
  7. package/components.json +21 -0
  8. package/dist/README.md +643 -0
  9. package/dist/assets/GientechStreamReader-C21-q_Qv.js +449 -0
  10. package/dist/assets/chevron-down-DjLtKwcs.js +280 -0
  11. package/{assets → dist/assets}/database.svg +11 -11
  12. package/{assets → dist/assets}/database_add.svg +53 -53
  13. package/{assets → dist/assets}/database_connect.svg +66 -66
  14. package/{assets → dist/assets}/database_upload.svg +29 -29
  15. package/dist/assets/databse.svg +6 -0
  16. package/{assets → dist/assets}/defaultWeLogo.svg +14 -14
  17. package/dist/assets/graph.svg +4 -0
  18. package/dist/assets/homeBg.png +0 -0
  19. package/dist/assets/index-BMz4lcjQ.js +1 -0
  20. package/dist/assets/index-C3Viu8Oj.js +1 -0
  21. package/dist/assets/index-C9GlPyHu.js +13 -0
  22. package/dist/assets/index-CRbX3ZA1.js +1 -0
  23. package/dist/assets/index-CTwzi_v2.js +21 -0
  24. package/dist/assets/index-DQlLDleQ.js +11 -0
  25. package/dist/assets/index-DRU1P9R0.js +1150 -0
  26. package/dist/assets/index-Dqej68NT.js +585 -0
  27. package/dist/assets/index-ECprhahs.js +157 -0
  28. package/dist/assets/index-i7qcZOwY.js +1088 -0
  29. package/dist/assets/knowledge.svg +4 -0
  30. package/dist/assets/left.jpg +0 -0
  31. package/dist/assets/logoImg.png +0 -0
  32. package/{assets/MySQL.svg → dist/assets/mysql.svg} +14 -14
  33. package/{assets/plus-fNg4vmeA.js → dist/assets/plus-CvJRSbOe.js} +1 -1
  34. package/dist/assets/sensitive.svg +5 -0
  35. package/dist/assets/style.css +1 -0
  36. package/dist/assets/style3.css +1 -0
  37. package/dist/assets/worker-BbpylX7l.js +13 -0
  38. package/{assets/x-tMUaBf0a.js → dist/assets/x-DKPeLdlu.js} +1 -1
  39. package/dist/assistantConfig.d.ts +31 -0
  40. package/dist/assistantConfig.js +1 -0
  41. package/{chat.d.ts → dist/chat.d.ts} +25 -1
  42. package/dist/chat.js +842 -0
  43. package/dist/database.js +20 -0
  44. package/dist/databaseId.js +1 -0
  45. package/dist/databaseTable.js +6 -0
  46. package/dist/index.d.ts +85 -0
  47. package/dist/index.js +1 -0
  48. package/dist/modelManage.js +1 -0
  49. package/dist/package.json +68 -0
  50. package/dist/sensitive.js +1 -0
  51. package/{streamFilesReader.d.ts → dist/streamFilesReader.d.ts} +3 -0
  52. package/dist/streamFilesReader.js +1 -0
  53. package/{worker → dist/worker}/pdf.worker.min.js +21 -21
  54. package/doc_assets/2.png +0 -0
  55. package/doc_assets/demo.md +27 -0
  56. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +2 -0
  57. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +23699 -0
  58. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +1 -0
  59. package/doc_assets/demos/dist-app/index.html +14 -0
  60. package/doc_assets/demos/dist-app/vite.svg +1 -0
  61. package/doc_assets/images/1.png +0 -0
  62. package/doc_assets/images/3.png +0 -0
  63. package/doc_assets/images/component-screenshot.png +1 -0
  64. package/doc_assets/install.md +5 -0
  65. package/doc_assets//346/226/271/346/241/210//344/274/230/345/214/226/346/226/271/346/241/210-/345/244/232/344/274/232/350/257/235SSE/350/277/236/346/216/245/347/256/241/347/220/206.md +504 -0
  66. package/eslint.config.js +92 -0
  67. package/index.html +13 -0
  68. package/package.json +109 -40
  69. package/package.json.demo-backup +109 -0
  70. package/postcss.config.cjs +19 -0
  71. package/public/vite.svg +1 -0
  72. package/public/worker/pdf.worker.min.js +22 -0
  73. package/scripts/README.md +133 -0
  74. package/scripts/build-demo.js +88 -0
  75. package/scripts/demo-selector.js +216 -0
  76. package/scripts/dev-demo.js +76 -0
  77. package/scripts/preview-demo.js +130 -0
  78. package/scripts/run-demo.bat +34 -0
  79. package/src/assets/img/close.png +0 -0
  80. package/src/assets/img/database.png +0 -0
  81. package/src/assets/img/downArrow.png +0 -0
  82. package/src/assets/img/downLoad.png +0 -0
  83. package/src/assets/img/excel.png +0 -0
  84. package/src/assets/img/graphIcon.png +0 -0
  85. package/src/assets/img/img.png +0 -0
  86. package/src/assets/img/pdf.png +0 -0
  87. package/src/assets/img/ppt.png +0 -0
  88. package/src/assets/img/singleQa.png +0 -0
  89. package/src/assets/img/txt.png +0 -0
  90. package/src/assets/img/webSearch.png +0 -0
  91. package/src/assets/img/word.png +0 -0
  92. package/src/assets/login/homeBg.png +0 -0
  93. package/src/assets/login/left.jpg +0 -0
  94. package/src/assets/login/logoImg.png +0 -0
  95. package/src/examples/ConversationAssistantPage/index.tsx +37 -0
  96. package/src/examples/Demo/index.tsx +12 -0
  97. package/src/examples/LoginPage/index.tsx +18 -0
  98. package/src/examples/chat/components/DrawerGraphPreview.tsx +78 -0
  99. package/src/examples/chat/index.tsx +153 -0
  100. package/src/examples/chat/logo03.png +0 -0
  101. package/src/examples/gientechStreamFilesReader/index.tsx +951 -0
  102. package/src/examples/ragDatabaseDataPage/index.tsx +36 -0
  103. package/src/examples/ragDatabaseIdPage/index.tsx +44 -0
  104. package/src/examples/ragDatabasePage/index.tsx +36 -0
  105. package/src/examples/ragModelManagePage/index.tsx +37 -0
  106. package/src/examples/ragSearchPage/index.tsx +0 -0
  107. package/src/examples/ragSensitiveWordsPage/index.tsx +32 -0
  108. package/src/examples/streamFiles/index.tsx +384 -0
  109. package/src/lib_enter.ts +43 -0
  110. package/src/main.tsx +5 -0
  111. package/src/main.tsx.backup +5 -0
  112. package/src/modules/assistantConfig/assets/databse.svg +6 -0
  113. package/src/modules/assistantConfig/assets/empty.png +0 -0
  114. package/src/modules/assistantConfig/assets/graph.svg +4 -0
  115. package/src/modules/assistantConfig/assets/knowledge.svg +4 -0
  116. package/src/modules/assistantConfig/assets/sensitive.svg +5 -0
  117. package/src/modules/assistantConfig/components/Database.tsx +144 -0
  118. package/src/modules/assistantConfig/components/Graph.tsx +156 -0
  119. package/src/modules/assistantConfig/components/Knowledge.tsx +266 -0
  120. package/src/modules/assistantConfig/components/NotFoundContent.tsx +21 -0
  121. package/src/modules/assistantConfig/components/Paragraph.tsx +51 -0
  122. package/src/modules/assistantConfig/components/ParamsItem.tsx +39 -0
  123. package/src/modules/assistantConfig/components/ResourceBinderItem.tsx +132 -0
  124. package/src/modules/assistantConfig/components/SearchableSelector.tsx +500 -0
  125. package/src/modules/assistantConfig/components/Sensitive.tsx +179 -0
  126. package/src/modules/assistantConfig/components/SliderInput.tsx +65 -0
  127. package/src/modules/assistantConfig/constants.tsx +74 -0
  128. package/src/modules/assistantConfig/index.tsx +700 -0
  129. package/src/modules/assistantConfig/server.ts +262 -0
  130. package/src/modules/chat/Conversations/Item.tsx +167 -0
  131. package/src/modules/chat/Conversations/List.tsx +210 -0
  132. package/src/modules/chat/Conversations/groupByTime.ts +39 -0
  133. package/src/modules/chat/Conversations/index.tsx +230 -0
  134. package/src/modules/chat/ReferenceBar.tsx +592 -0
  135. package/src/modules/chat/constants.tsx +56 -0
  136. package/src/modules/chat/data.txt +82 -0
  137. package/src/modules/chat/index.tsx +2081 -0
  138. package/src/modules/chat/referenceCom/DeleteModal.tsx +75 -0
  139. package/src/modules/chat/referenceCom/DrawerContent.tsx +136 -0
  140. package/src/modules/chat/referenceCom/DrawerDatabase.tsx +110 -0
  141. package/src/modules/chat/referenceCom/DrawerGraphPreview.tsx +86 -0
  142. package/src/modules/chat/referenceCom/DrawerPreview.tsx +73 -0
  143. package/src/modules/chat/referenceCom/DrawerTitle.tsx +26 -0
  144. package/src/modules/chat/referenceCom/RenameModal.tsx +86 -0
  145. package/src/modules/chat/referenceCom/TagCom.tsx +30 -0
  146. package/src/modules/chat/style.less +3 -0
  147. package/src/modules/chat/types.ts +17 -0
  148. package/src/modules/chat/utils/index.ts +326 -0
  149. package/src/modules/database/CreateModal.tsx +398 -0
  150. package/src/modules/database/assets/Doris.png +0 -0
  151. package/src/modules/database/assets/PostgreSQL.png +0 -0
  152. package/src/modules/database/assets/SQLServer.png +0 -0
  153. package/src/modules/database/assets/database.svg +11 -0
  154. package/src/modules/database/assets/database_add.svg +53 -0
  155. package/src/modules/database/assets/database_connect.svg +66 -0
  156. package/src/modules/database/assets/database_upload.svg +29 -0
  157. package/src/modules/database/assets/empty.png +0 -0
  158. package/src/modules/database/assets/mysql.svg +14 -0
  159. package/src/modules/database/index.tsx +466 -0
  160. package/src/modules/database/server.ts +196 -0
  161. package/src/modules/databaseId/CustomCom.tsx +156 -0
  162. package/src/modules/databaseId/EditConfig.tsx +268 -0
  163. package/src/modules/databaseId/UploadDrawer.tsx +520 -0
  164. package/src/modules/databaseId/assets/aiOptimize.svg +10 -0
  165. package/src/modules/databaseId/assets/empty.png +0 -0
  166. package/src/modules/databaseId/assets/template.svg +6 -0
  167. package/src/modules/databaseId/assets/upload.svg +9 -0
  168. package/src/modules/databaseId/assets/useTemp.svg +6 -0
  169. package/src/modules/databaseId/index.tsx +734 -0
  170. package/src/modules/databaseId/server.ts +286 -0
  171. package/src/modules/databaseId/style.css +5 -0
  172. package/src/modules/databaseTable/EditRowDrawer.tsx +119 -0
  173. package/src/modules/databaseTable/index.tsx +357 -0
  174. package/src/modules/databaseTable/server.ts +180 -0
  175. package/src/modules/headlessChat/constants.tsx +32 -0
  176. package/src/modules/headlessChat/index.tsx +1063 -0
  177. package/src/modules/headlessChat/types.ts +23 -0
  178. package/src/modules/login/components/Login/LoginBox/index.tsx +102 -0
  179. package/src/modules/login/components/Login/RegisterBox/index.tsx +180 -0
  180. package/src/modules/login/components/Login/index.tsx +100 -0
  181. package/src/modules/login/index.tsx +106 -0
  182. package/src/modules/login/style.css +3 -0
  183. package/src/modules/login/useServices.ts +53 -0
  184. package/src/modules/login/utils.ts +42 -0
  185. package/src/modules/modelManage/ConfigDrawer.tsx +249 -0
  186. package/src/modules/modelManage/assets/empty.png +0 -0
  187. package/src/modules/modelManage/const.ts +50 -0
  188. package/src/modules/modelManage/index.tsx +439 -0
  189. package/src/modules/modelManage/server.ts +185 -0
  190. package/src/modules/nodegraph/index.tsx +1 -0
  191. package/src/modules/search/assets/Icon-history.svg +8 -0
  192. package/src/modules/search/assets/answerAwartar.png +0 -0
  193. package/src/modules/search/assets/doc.png +0 -0
  194. package/src/modules/search/assets/genera.gif +0 -0
  195. package/src/modules/search/assets/icon-robot.svg +9 -0
  196. package/src/modules/search/assets/icon-search-bar.svg +14 -0
  197. package/src/modules/search/assets/icon-sub-title.svg +3 -0
  198. package/src/modules/search/assets/icon-title.svg +9 -0
  199. package/src/modules/search/assets/icon-zoomOut.svg +9 -0
  200. package/src/modules/search/assets/iconAi.svg +9 -0
  201. package/src/modules/search/assets/pdf.png +0 -0
  202. package/src/modules/search/assets/ppt.png +0 -0
  203. package/src/modules/search/assets/search.svg +3 -0
  204. package/src/modules/search/assets/selected.svg +4 -0
  205. package/src/modules/search/assets/txt.png +0 -0
  206. package/src/modules/search/assets/xls.png +0 -0
  207. package/src/modules/search/components/AssisSelect.tsx +137 -0
  208. package/src/modules/search/components/Editor/ChatViewEditor.tsx +261 -0
  209. package/src/modules/search/components/Editor/aichat.css +1 -0
  210. package/src/modules/search/components/Editor/constant.ts +13 -0
  211. package/src/modules/search/components/Editor/index.tsx +113 -0
  212. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +332 -0
  213. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +20 -0
  214. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +38 -0
  215. package/src/modules/search/components/Editor/plugins/displayer.ts +298 -0
  216. package/src/modules/search/components/Editor/plugins/imageClick.tsx +32 -0
  217. package/src/modules/search/components/Editor/plugins/myplugin.tsx +98 -0
  218. package/src/modules/search/components/Editor/ui/avatar.tsx +19 -0
  219. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +21 -0
  220. package/src/modules/search/components/Editor/ui/button.tsx +58 -0
  221. package/src/modules/search/components/Editor/ui/calendar.tsx +68 -0
  222. package/src/modules/search/components/Editor/ui/caption.tsx +46 -0
  223. package/src/modules/search/components/Editor/ui/checkbox.tsx +27 -0
  224. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +188 -0
  225. package/src/modules/search/components/Editor/ui/code-block-element.css +434 -0
  226. package/src/modules/search/components/Editor/ui/code-block-element.tsx +39 -0
  227. package/src/modules/search/components/Editor/ui/code-leaf.tsx +24 -0
  228. package/src/modules/search/components/Editor/ui/code-line-element.tsx +10 -0
  229. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +21 -0
  230. package/src/modules/search/components/Editor/ui/column-element.tsx +30 -0
  231. package/src/modules/search/components/Editor/ui/column-group-element.tsx +94 -0
  232. package/src/modules/search/components/Editor/ui/command.tsx +75 -0
  233. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +22 -0
  234. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +37 -0
  235. package/src/modules/search/components/Editor/ui/comment-item.tsx +74 -0
  236. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +49 -0
  237. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +42 -0
  238. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +22 -0
  239. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +32 -0
  240. package/src/modules/search/components/Editor/ui/comment-value.tsx +34 -0
  241. package/src/modules/search/components/Editor/ui/comments-popover.tsx +63 -0
  242. package/src/modules/search/components/Editor/ui/date-element.tsx +83 -0
  243. package/src/modules/search/components/Editor/ui/dialog.tsx +63 -0
  244. package/src/modules/search/components/Editor/ui/draggable.tsx +177 -0
  245. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +180 -0
  246. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +85 -0
  247. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +28 -0
  248. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +76 -0
  249. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +8 -0
  250. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +51 -0
  251. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +77 -0
  252. package/src/modules/search/components/Editor/ui/heading-element.tsx +48 -0
  253. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +17 -0
  254. package/src/modules/search/components/Editor/ui/hr-element.tsx +30 -0
  255. package/src/modules/search/components/Editor/ui/icons.tsx +267 -0
  256. package/src/modules/search/components/Editor/ui/image-element.tsx +74 -0
  257. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +368 -0
  258. package/src/modules/search/components/Editor/ui/input.tsx +25 -0
  259. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +218 -0
  260. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +20 -0
  261. package/src/modules/search/components/Editor/ui/link-element.tsx +29 -0
  262. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +161 -0
  263. package/src/modules/search/components/Editor/ui/list-element.tsx +30 -0
  264. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +24 -0
  265. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +133 -0
  266. package/src/modules/search/components/Editor/ui/media-popover.tsx +97 -0
  267. package/src/modules/search/components/Editor/ui/mention-element.tsx +43 -0
  268. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +141 -0
  269. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +93 -0
  270. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +67 -0
  271. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +4 -0
  272. package/src/modules/search/components/Editor/ui/placeholder.tsx +52 -0
  273. package/src/modules/search/components/Editor/ui/popover.tsx +32 -0
  274. package/src/modules/search/components/Editor/ui/resizable.tsx +66 -0
  275. package/src/modules/search/components/Editor/ui/separator.tsx +25 -0
  276. package/src/modules/search/components/Editor/ui/style.less +12 -0
  277. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +143 -0
  278. package/src/modules/search/components/Editor/ui/table-element.tsx +243 -0
  279. package/src/modules/search/components/Editor/ui/table-row-element.tsx +22 -0
  280. package/src/modules/search/components/Editor/ui/tableValue.tsx +135 -0
  281. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +43 -0
  282. package/src/modules/search/components/Editor/ui/toggle-element.tsx +31 -0
  283. package/src/modules/search/components/Editor/ui/toolbar.tsx +157 -0
  284. package/src/modules/search/components/Editor/ui/tooltip.tsx +65 -0
  285. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +160 -0
  286. package/src/modules/search/components/Editor/ui/with-draggables.tsx +175 -0
  287. package/src/modules/search/components/FileList.tsx +287 -0
  288. package/src/modules/search/components/ImageGroupView/index.tsx +85 -0
  289. package/src/modules/search/components/ResultContent.tsx +232 -0
  290. package/src/modules/search/components/SearchInput.tsx +232 -0
  291. package/src/modules/search/components/SearchLanding.tsx +74 -0
  292. package/src/modules/search/components/SearchView.tsx +563 -0
  293. package/src/modules/search/components/SimpleEditor.tsx +158 -0
  294. package/src/modules/search/components/SimpleFileList.tsx +215 -0
  295. package/src/modules/search/index.tsx +10 -0
  296. package/src/modules/search/reademe.md +1 -0
  297. package/src/modules/search/servers/apis.tsx +19 -0
  298. package/src/modules/search/servers/index.ts +184 -0
  299. package/src/modules/search/style.less +503 -0
  300. package/src/modules/search/type.ts +22 -0
  301. package/src/modules/search/utils.ts +34 -0
  302. package/src/modules/sensitive/index.tsx +313 -0
  303. package/src/modules/sensitive/server.ts +122 -0
  304. package/src/modules/streamFilesReader/GientechStreamReader.tsx +1624 -0
  305. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  306. package/src/modules/streamFilesReader/components/Header/index.tsx +297 -0
  307. package/src/modules/streamFilesReader/index.tsx +3 -0
  308. package/src/style.css +6 -0
  309. package/src/type.d.ts +0 -0
  310. package/src/utils/commonFn.tsx +111 -0
  311. package/src/utils/gientechCommon/components/AppError.tsx +32 -0
  312. package/src/utils/gientechCommon/components/AppLoading.tsx +75 -0
  313. package/src/utils/gientechCommon/components/DeleteModal.tsx +75 -0
  314. package/src/utils/gientechCommon/components/DisplayError.tsx +33 -0
  315. package/src/utils/gientechCommon/components/DisplayLoading.tsx +38 -0
  316. package/src/utils/gientechCommon/components/FeedBackModal.tsx +310 -0
  317. package/src/utils/gientechCommon/components/FileCardCommon.tsx +82 -0
  318. package/src/utils/gientechCommon/components/FileManager/index.tsx +390 -0
  319. package/src/utils/gientechCommon/components/FileManager/style.css +5 -0
  320. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +581 -0
  321. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +339 -0
  322. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +245 -0
  323. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +209 -0
  324. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  325. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +148 -0
  326. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +14 -0
  327. package/src/utils/gientechCommon/components/RenameModal.tsx +86 -0
  328. package/src/utils/gientechCommon/components/style.less +11 -0
  329. package/src/utils/gientechCommon/configs/commonConfig.ts +2 -0
  330. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  331. package/src/utils/gientechCommon/configs/stylesConfig.ts +142 -0
  332. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +417 -0
  333. package/src/utils/gientechCommon/slate/converters/deserializers.ts +763 -0
  334. package/src/utils/gientechCommon/slate/converters/mockData.ts +232 -0
  335. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +258 -0
  336. package/src/utils/gientechCommon/slate/richElements/index.tsx +499 -0
  337. package/src/utils/gientechCommon/utils/request.ts +37 -0
  338. package/src/utils/gientechCommon/utils/serverFn.ts +172 -0
  339. package/src/utils/index.tsx +126 -0
  340. package/src/utils/testconfigs/demologin/index.tsx +32 -0
  341. package/src/utils/testconfigs/index.ts +59 -0
  342. package/src/vite-env.d.ts +11 -0
  343. package/stats.html +4949 -0
  344. package/tailwind.config.js +170 -0
  345. package/tsconfig.app.json +30 -0
  346. package/tsconfig.app.tsbuildinfo +11 -0
  347. package/tsconfig.json +13 -0
  348. package/tsconfig.node.json +22 -0
  349. package/tsconfig.node.tsbuildinfo +1 -0
  350. package/vite.config.ts +227 -0
  351. package/workflows/release.yml +60 -0
  352. package/assets/_commonjsHelpers-gnU0ypJ3.js +0 -1
  353. package/assets/index--DG-fVvc.js +0 -26
  354. package/assets/index-BfureYPx.js +0 -1505
  355. package/assets/index-CXwV5fAx.js +0 -1230
  356. package/assets/style.css +0 -1
  357. package/assets/style3.css +0 -1
  358. package/assets/styled-components.browser.esm-DPkS13KC.js +0 -2
  359. package/chat.js +0 -893
  360. package/database.js +0 -20
  361. package/databaseId.js +0 -21
  362. package/databaseTable.js +0 -6
  363. package/modelManage.js +0 -1
  364. package/sensitive.js +0 -1
  365. package/streamFilesReader.js +0 -442
  366. /package/{assets → dist/assets}/Doris.png +0 -0
  367. /package/{assets → dist/assets}/PostgreSQL.png +0 -0
  368. /package/{assets → dist/assets}/SQLServer.png +0 -0
  369. /package/{assets → dist/assets}/empty.png +0 -0
  370. /package/{assets → dist/assets}/index-CpW6Dhpp.js +0 -0
  371. /package/{assets → dist/assets}/style2.css +0 -0
  372. /package/{database.d.ts → dist/database.d.ts} +0 -0
  373. /package/{databaseId.d.ts → dist/databaseId.d.ts} +0 -0
  374. /package/{databaseTable.d.ts → dist/databaseTable.d.ts} +0 -0
  375. /package/{modelManage.d.ts → dist/modelManage.d.ts} +0 -0
  376. /package/{sensitive.d.ts → dist/sensitive.d.ts} +0 -0
  377. /package/{vite.svg → dist/vite.svg} +0 -0
@@ -0,0 +1,592 @@
1
+ import { ConfigProvider, Drawer, Tooltip } from 'antd';
2
+ import SingleQa from '../../assets/img/singleQa.png';
3
+ import DownLoad from '../../assets/img/downLoad.png';
4
+ import GraphIcon from '../../assets/img/graphIcon.png';
5
+ import WebSearch from '../../assets/img/webSearch.png';
6
+ import Database from '../../assets/img/database.png';
7
+ import { useEffect, useMemo, useState } from 'react';
8
+ import './style.less';
9
+ import DrawerGraphPreview from './referenceCom/DrawerGraphPreview';
10
+ import { DrawerContent } from './referenceCom/DrawerContent';
11
+ import DrawerPreview from './referenceCom/DrawerPreview';
12
+ import DrawerDatabase from './referenceCom/DrawerDatabase';
13
+ import DrawerTitle from './referenceCom/DrawerTitle';
14
+ import TagCom from './referenceCom/TagCom';
15
+ import {
16
+ downloadByStream,
17
+ getFileIcon,
18
+ getFileName,
19
+ getMarkExcludeType,
20
+ TempBaseUrl,
21
+ } from './utils';
22
+ import { DrawerType } from '../../lib_enter';
23
+
24
+ enum ListName {
25
+ KNOWLEDGE = 'knowledgeList',
26
+ SEARCH = 'searchList',
27
+ DATABASE = 'databaseList',
28
+ GRAPH = 'graphList',
29
+ }
30
+
31
+ export const bgColor: any = {
32
+ [ListName.KNOWLEDGE]: '#EAF4FD',
33
+ [ListName.SEARCH]: '#E8F7F0',
34
+ [ListName.DATABASE]: '#FFF4E5',
35
+ [ListName.GRAPH]: '#E7F8FB',
36
+ };
37
+
38
+ export const textColor: any = {
39
+ [ListName.KNOWLEDGE]: '#2072F0',
40
+ [ListName.SEARCH]: '#39B83F',
41
+ [ListName.DATABASE]: '#F48C14',
42
+ [ListName.GRAPH]: '#10BBD9',
43
+ };
44
+
45
+ const BTNS = [
46
+ {
47
+ key: ListName.KNOWLEDGE,
48
+ name: '知识库文档',
49
+ },
50
+ {
51
+ key: ListName.SEARCH,
52
+ name: '联网搜索',
53
+ hideBtns: true,
54
+ },
55
+ {
56
+ key: ListName.DATABASE,
57
+ name: '数据库',
58
+ },
59
+ {
60
+ key: ListName.GRAPH,
61
+ name: '知识图谱',
62
+ hideBtns: true,
63
+ },
64
+ ];
65
+
66
+ export const ReferenceBar = ({
67
+ type,
68
+ data,
69
+ token,
70
+ eventsEmit,
71
+ is_download,
72
+ }: {
73
+ type: string;
74
+ data: any;
75
+ token: string;
76
+ eventsEmit?: (eventName: string, data: any) => void;
77
+ is_download: boolean;
78
+ }) => {
79
+ const [btns, setBtns] = useState(BTNS);
80
+ const [drawerType, setDrawerType] = useState<string>('mark');
81
+ const [drawerOpen, setDrawerOpen] = useState<boolean>(false);
82
+ const [curFileInfo, setCurFileInfo] = useState<any>({});
83
+ const [activeBtn, setActiveBtn] = useState<any>(ListName.KNOWLEDGE);
84
+ const [lists, seLists] = useState<any>({
85
+ [ListName.KNOWLEDGE]: [],
86
+ [ListName.SEARCH]: [],
87
+ [ListName.DATABASE]: [],
88
+ [ListName.GRAPH]: [],
89
+ });
90
+
91
+ const getEmptyBoxs = useMemo(() => {
92
+ const n = 4 - btns.length;
93
+ const arr = Array(n)
94
+ .fill(null)
95
+ .map((v, i) => {
96
+ return {
97
+ name: '',
98
+ key: 100 + i,
99
+ };
100
+ });
101
+
102
+ const r = [...btns, ...arr];
103
+ console.log('rrrrrr', r);
104
+
105
+ return r;
106
+ }, [btns]);
107
+
108
+ const filterScore = (score: any) => {
109
+ if (isNaN(score)) {
110
+ return '';
111
+ } else {
112
+ return (+score).toFixed(2);
113
+ }
114
+ };
115
+
116
+ const getIcon = (btn: string, filtType?: string) => {
117
+ switch (btn) {
118
+ case ListName.KNOWLEDGE:
119
+ return getFileIcon(filtType as any);
120
+ case ListName.SEARCH:
121
+ return WebSearch;
122
+ case ListName.DATABASE:
123
+ return Database;
124
+ case ListName.GRAPH:
125
+ return GraphIcon;
126
+ }
127
+ };
128
+
129
+ const dealData = (type: string, data: any[]) => {
130
+ if (type === ListName.GRAPH) {
131
+ return data
132
+ .map(item => {
133
+ return {
134
+ ...item,
135
+ name: item.graphName,
136
+ };
137
+ })
138
+ .sort((a, b) => {
139
+ return (b.score || 0) - (a.score || 0);
140
+ });
141
+ }
142
+
143
+ if (type === ListName.KNOWLEDGE) {
144
+ return data
145
+ .map(item => {
146
+ return {
147
+ ...item,
148
+ name: item.file_name,
149
+ score: item.rrf_score,
150
+ };
151
+ })
152
+ .sort((a, b) => {
153
+ return (b.score || 0) - (a.score || 0);
154
+ });
155
+ }
156
+
157
+ if (type === ListName.SEARCH) {
158
+ return data
159
+ .map(item => {
160
+ return {
161
+ ...item,
162
+ name: item.file_name,
163
+ };
164
+ })
165
+ .sort((a, b) => {
166
+ return (b.score || 0) - (a.score || 0);
167
+ });
168
+ }
169
+
170
+ if (type === ListName.DATABASE) {
171
+ return data
172
+ .map(item => {
173
+ // 数据库引用:使用 databaseName 和 tableName 组合作为名称
174
+ const name = item.tableName
175
+ ? `${item.databaseName || '数据库'} - ${item.tableName}`
176
+ : item.databaseName || item.name || '数据库';
177
+ return {
178
+ ...item,
179
+ name,
180
+ file_name: name,
181
+ file_type: 'database',
182
+ };
183
+ })
184
+ .sort((a, b) => {
185
+ return (b.score || 0) - (a.score || 0);
186
+ });
187
+ }
188
+
189
+ return data;
190
+ };
191
+
192
+ const clickTag = (file: any, tag: any, btn: any) => {
193
+ switch (btn.key) {
194
+ case ListName.KNOWLEDGE:
195
+ console.log('click knowledge tag', file, tag);
196
+ const curFile = file;
197
+ const { pdfPages, parsedFilePath, order_num, metadata } = curFile;
198
+ const id = tag.id || order_num || 'Unknown ID';
199
+ // 解析 source 字段
200
+ const sourceParts = metadata.source.split('/');
201
+ const fileName = sourceParts[sourceParts.length - 1] || '';
202
+ const fileParts = fileName.split('.');
203
+ const label = fileParts.slice(0, -1).join('.') || 'Unknown Label';
204
+ const file_type = fileParts[fileParts.length - 1] || 'Unknown Type';
205
+
206
+ setCurFileInfo({
207
+ id,
208
+ title: label,
209
+ file_name: fileName,
210
+ file_type: file_type,
211
+ file_source: getMarkExcludeType(file_type)
212
+ ? `${TempBaseUrl}${metadata.source}`
213
+ : parsedFilePath,
214
+ metadata: metadata,
215
+ pdfPages: pdfPages,
216
+ });
217
+ setDrawerType('mark');
218
+ setDrawerOpen(true);
219
+ break;
220
+ case ListName.SEARCH:
221
+ console.log('click search tag', file, tag);
222
+ break;
223
+ case ListName.DATABASE:
224
+ console.log('click database tag', file, tag);
225
+ // 打开数据库详情抽屉
226
+ setDrawerType('database');
227
+ setCurFileInfo({
228
+ ...file,
229
+ metadata: file.metadata || {},
230
+ fetchUrl: file.fetchUrl || file.metadata?.fetchUrl || '',
231
+ });
232
+ setDrawerOpen(true);
233
+ break;
234
+ case ListName.GRAPH:
235
+ console.log('click graph tag', file, tag);
236
+ setDrawerType('graphPreview');
237
+ setCurFileInfo({
238
+ ...file,
239
+ traceNode: (data?.traceNode || []).find((item: any) => {
240
+ return item.id === tag.id;
241
+ }),
242
+ });
243
+ setDrawerOpen(true);
244
+ break;
245
+ }
246
+ };
247
+
248
+ useEffect(() => {
249
+ if (type !== DrawerType.REFERENCELIST) return;
250
+ console.log('data in reference drawer', data);
251
+ if (!data) return;
252
+ const { graphRefs, knowledgeRefs, webRefs, databaseRefs } = data;
253
+ if (graphRefs?.length) {
254
+ lists[ListName.GRAPH] = dealData(ListName.GRAPH, graphRefs);
255
+ }
256
+ if (knowledgeRefs?.length) {
257
+ lists[ListName.KNOWLEDGE] = dealData(ListName.KNOWLEDGE, knowledgeRefs);
258
+ }
259
+ if (webRefs?.length) {
260
+ lists[ListName.SEARCH] = dealData(ListName.SEARCH, webRefs);
261
+ }
262
+ // 处理数据库引用(使用摘要信息,不包含完整数据行)
263
+ if (databaseRefs?.length) {
264
+ lists[ListName.DATABASE] = dealData(ListName.DATABASE, databaseRefs);
265
+ }
266
+
267
+ const curBtns = BTNS.filter((item: any) => {
268
+ return lists[item.key]?.length;
269
+ }).sort((a, b) => {
270
+ return (lists[b.key]?.length || 0) - (lists[a.key]?.length || 0);
271
+ });
272
+
273
+ setBtns(curBtns);
274
+
275
+ if (curBtns?.length) {
276
+ setActiveBtn(curBtns[0].key);
277
+ }
278
+
279
+ seLists({ ...lists });
280
+ }, [data]);
281
+
282
+ return (
283
+ <>
284
+ <div className="listWrap w-full h-full">
285
+ <DrawerTitle
286
+ title="知识溯源"
287
+ setOpen={() => {
288
+ const closeEvent = new CustomEvent('aichat:right_set', {
289
+ detail: { collapsed: true },
290
+ });
291
+ window.dispatchEvent(closeEvent);
292
+ }}
293
+ />
294
+ <div style={{ height: 'calc(100% - 60px)' }}>
295
+ <div
296
+ className="tabs"
297
+ style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 20px' }}
298
+ >
299
+ {getEmptyBoxs.map(item => (
300
+ <div
301
+ key={item.key}
302
+ className="tab-item"
303
+ style={{
304
+ display: 'inline-block',
305
+ padding: '5.5px 12px',
306
+ backgroundColor: !item.name
307
+ ? 'transparent'
308
+ : activeBtn === item.key
309
+ ? '#4E6EF2'
310
+ : '#F5F6F9',
311
+ cursor: 'pointer',
312
+ borderRadius: '4px',
313
+ color: activeBtn === item.key ? '#FFFFFF' : '#4E5969',
314
+ fontSize: '14px',
315
+ minWidth: '80px',
316
+ }}
317
+ onClick={() => {
318
+ if (item.name) {
319
+ setActiveBtn(item.key);
320
+ }
321
+ }}
322
+ >
323
+ {item.name}
324
+ </div>
325
+ ))}
326
+ </div>
327
+ <div
328
+ className="listBox"
329
+ style={{
330
+ height: 'calc(100% - 66px)',
331
+ overflowY: 'auto',
332
+ display: 'flex',
333
+ flexDirection: 'column',
334
+ alignItems: 'center',
335
+ }}
336
+ >
337
+ {btns.map((item: any) => {
338
+ let list: any[] = lists[item.key] || [];
339
+ if (activeBtn !== item.key) return null;
340
+ return (
341
+ <div key={item.key}>
342
+ {list.map(
343
+ (i: {
344
+ name: string;
345
+ id: string;
346
+ score: number | string;
347
+ tags?: any[];
348
+ hideBtns?: boolean;
349
+ file_type?: string;
350
+ link?: string;
351
+ metadata: any;
352
+ file_name: any;
353
+ parsedFilePath: any;
354
+ fetchUrl?: string;
355
+ }) => {
356
+ return (
357
+ <div
358
+ key={i.id}
359
+ style={{
360
+ width: '360px',
361
+ padding: '4px 8px',
362
+ borderRadius: '4px',
363
+ margin: '6px 0',
364
+ cursor: 'pointer',
365
+ }}
366
+ className="listItemBox"
367
+ onClick={() => {
368
+ if (item.key === ListName.SEARCH) {
369
+ window.open(i.link, '_blank');
370
+ }
371
+ }}
372
+ >
373
+ <div
374
+ style={{
375
+ display: 'flex',
376
+ justifyContent: 'space-between',
377
+ alignItems: 'center',
378
+ }}
379
+ >
380
+ <div
381
+ style={{
382
+ width: item.hideBtns ? '339px' : '288px',
383
+ fontSize: '14px',
384
+ color: '#1D2129',
385
+ fontWeight: '700',
386
+ display: 'flex',
387
+ alignItems: 'center',
388
+ }}
389
+ >
390
+ <img
391
+ src={getIcon(item.key, i.file_type)}
392
+ style={{ width: '16px', height: '16px', marginRight: '2px' }}
393
+ />
394
+ <Tooltip
395
+ placement="topLeft"
396
+ title={i?.name?.length > 16 ? i.name : ''}
397
+ >
398
+ <div
399
+ style={{
400
+ whiteSpace: 'nowrap',
401
+ overflow: 'hidden',
402
+ textOverflow: 'ellipsis',
403
+ width: item.hideBtns ? '322px' : '258px',
404
+ }}
405
+ onClick={() => {
406
+ if (item.key === ListName.KNOWLEDGE) {
407
+ eventsEmit?.('knowledge_referenceFile_title:click', {
408
+ data: {
409
+ ...i,
410
+ file_type: i.file_type,
411
+ file_name: i.file_name,
412
+ metadata: i.metadata,
413
+ parsedFilePath: i.parsedFilePath,
414
+ },
415
+ });
416
+ } else if (item.key === ListName.DATABASE) {
417
+ // 点击数据库项标题时,打开数据库详情抽屉
418
+ setDrawerType('database');
419
+ setCurFileInfo({
420
+ ...i,
421
+ metadata: i.metadata || {},
422
+ fetchUrl: i.fetchUrl || i.metadata?.fetchUrl || '',
423
+ });
424
+ setDrawerOpen(true);
425
+ }
426
+ }}
427
+ >
428
+ {i.name}
429
+ </div>
430
+ </Tooltip>
431
+ </div>
432
+ <div
433
+ style={{
434
+ width: '52px',
435
+ justifyContent: 'space-between',
436
+ alignItems: 'center',
437
+ marginRight: '8px',
438
+ display: item.hideBtns ? 'none' : 'flex',
439
+ }}
440
+ >
441
+ <img
442
+ src={SingleQa}
443
+ style={{ width: '16px', height: '16px', cursor: 'pointer' }}
444
+ onClick={() => {
445
+ eventsEmit?.('referenceFile_filechat', {
446
+ data: {
447
+ ...i,
448
+ file_type: i.file_type,
449
+ file_name: i.file_name,
450
+ metadata: i.metadata,
451
+ parsedFilePath: i.parsedFilePath,
452
+ },
453
+ });
454
+ }}
455
+ />
456
+ <div
457
+ style={{ borderRight: '1px solid #E5E6EB', height: '14px' }}
458
+ ></div>
459
+ <img
460
+ src={DownLoad}
461
+ style={{
462
+ width: '16px',
463
+ height: '16px',
464
+ cursor: is_download ? 'pointer' : 'not-allowed',
465
+ }}
466
+ onClick={() => {
467
+ if (!i?.metadata || !is_download) return;
468
+ downloadByStream({
469
+ filePath: `${TempBaseUrl}${i.metadata.source}`,
470
+ fileName: getFileName(i),
471
+ token,
472
+ });
473
+ }}
474
+ />
475
+ </div>
476
+ </div>
477
+ {!!(
478
+ typeof i.score === 'string' ||
479
+ typeof i.score === 'number' ||
480
+ (i?.tags?.length && i.tags.length > 0 && i.tags.length <= 10)
481
+ ) && (
482
+ <div
483
+ style={{
484
+ display: 'flex',
485
+ justifyContent: 'space-between',
486
+ height: '18px',
487
+ marginTop: '4px',
488
+ }}
489
+ >
490
+ {(typeof i.score === 'string' || typeof i.score === 'number') && (
491
+ <div
492
+ style={{
493
+ backgroundColor: '#F2F2FB',
494
+ borderRadius: '4px',
495
+ padding: '2px 3px',
496
+ display: 'flex',
497
+ justifyContent: 'center',
498
+ alignItems: 'center',
499
+ fontSize: '12px',
500
+ }}
501
+ >
502
+ <span style={{ color: '#4E5969', marginRight: '6px' }}>
503
+ 分数:
504
+ </span>
505
+ <span style={{ color: '#1D2129' }}>{filterScore(i.score)}</span>
506
+ </div>
507
+ )}
508
+ <div style={{ flex: 1, display: 'flex', justifyContent: 'flex-end' }}>
509
+ {(i?.tags?.length && i.tags.length > 0 && i.tags.length <= 10
510
+ ? i.tags
511
+ : []
512
+ ).map((j: any) => {
513
+ return (
514
+ <TagCom
515
+ key={j.id}
516
+ i={i}
517
+ item={item}
518
+ j={j}
519
+ clickTag={clickTag}
520
+ />
521
+ );
522
+ })}
523
+ </div>
524
+ </div>
525
+ )}
526
+ <div
527
+ style={{
528
+ flex: 1,
529
+ display: 'flex',
530
+ justifyContent: 'flex-start',
531
+ marginTop: '4px',
532
+ }}
533
+ >
534
+ {(i?.tags?.length && i.tags.length > 10 ? i.tags : []).map((j: any) => {
535
+ return (
536
+ <TagCom key={j.id} i={i} item={item} j={j} clickTag={clickTag} />
537
+ );
538
+ })}
539
+ </div>
540
+ </div>
541
+ );
542
+ }
543
+ )}
544
+ </div>
545
+ );
546
+ })}
547
+ </div>
548
+ </div>
549
+ </div>
550
+ <ConfigProvider
551
+ drawer={{
552
+ styles: {
553
+ body: { padding: 0 },
554
+ header: { display: 'none' },
555
+ },
556
+ }}
557
+ >
558
+ <Drawer
559
+ autoFocus={false}
560
+ onClose={() => setDrawerOpen(false)}
561
+ open={drawerOpen}
562
+ width={720}
563
+ className="overflow-x-hidden"
564
+ destroyOnClose
565
+ getContainer={false}
566
+ afterOpenChange={open => {
567
+ if (!open) {
568
+ setCurFileInfo(null);
569
+ }
570
+ }}
571
+ >
572
+ {drawerType === 'graphPreview' && (
573
+ <DrawerGraphPreview
574
+ curFileInfo={curFileInfo as any}
575
+ onClose={setDrawerOpen}
576
+ token={token}
577
+ />
578
+ )}
579
+ {drawerType === 'mark' && (
580
+ <DrawerContent content={curFileInfo as any} onClose={setDrawerOpen} token={token} />
581
+ )}
582
+ {drawerType === 'preview' && (
583
+ <DrawerPreview curFileInfo={curFileInfo} onClose={setDrawerOpen} token={token} />
584
+ )}
585
+ {drawerType === 'database' && (
586
+ <DrawerDatabase curFileInfo={curFileInfo} onClose={setDrawerOpen} />
587
+ )}
588
+ </Drawer>
589
+ </ConfigProvider>
590
+ </>
591
+ );
592
+ };
@@ -0,0 +1,56 @@
1
+ import { Icon } from '@mxmweb/zui';
2
+ import { FileSymlink, Mic, Paperclip } from 'lucide-react';
3
+
4
+ export const DefaultSenderConfig = {
5
+ actions: [
6
+ {
7
+ name: 'history',
8
+ icon: <Paperclip color='#4E5969' size={20}/>,
9
+ // badgeCount: 0,
10
+ tip: '录音',
11
+ },
12
+ {
13
+ name: 'upload',
14
+ icon: <Mic color='#4E5969' size={20}/>,
15
+ tip: '上传',
16
+ }
17
+ ],
18
+
19
+ // {
20
+ // name: 'reasoning',
21
+ // label: '思维链',
22
+ // type: 'switch' as const,
23
+ // defaultValue: false,
24
+ // enabled: true,
25
+ // icon: <LoaderPinwheel size={16} />,
26
+ // },
27
+ // {
28
+ // name: 'netSearch',
29
+ // label: '网络搜索',
30
+ // type: 'switch' as const,
31
+ // defaultValue: true,
32
+ // enabled: true,
33
+ // icon: <Globe size={16} />,
34
+ // },
35
+ switchs: [
36
+ {
37
+ label: '联网搜索',
38
+ name: 'netSearch',
39
+ type: 'switch',
40
+ defaultValue: false,
41
+ enabled: true,
42
+ icon: <Icon type='rag/url' size={16} />,
43
+ },
44
+ {
45
+ label: '推理思考',
46
+ name: 'reasoning',
47
+ type: 'switch',
48
+ defaultValue: false,
49
+ enabled: true,
50
+ icon: <Icon type='rag/think' size={16} />,
51
+ },
52
+ ],
53
+ };
54
+
55
+ export const MaxHistoryChatDisplay = 5000;
56
+ export const MaxHistoryItemDisplay = 3000;