cx-chat 0.0.2 → 0.0.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 (406) hide show
  1. package/dist/cx-chat.css +1 -0
  2. package/dist/cx-chat.es.js +68257 -0
  3. package/dist/cx-chat.umd.js +492 -0
  4. package/package.json +27 -3
  5. package/.cursor/rules/i18n-cn-gloss-comments.mdc +0 -31
  6. package/.cursor/rules/list-page-view-pageconfig.mdc +0 -32
  7. package/.cursor/rules/no-over-defensive-programming.mdc +0 -90
  8. package/.cursor/rules/requirement-description-for-agent.mdc +0 -33
  9. package/.cursor/rules/use-showToast-not-antd-message.mdc +0 -28
  10. package/.docker/Dockerfile +0 -7
  11. package/.env +0 -9
  12. package/.env.development +0 -7
  13. package/.env.production +0 -7
  14. package/.gitlab-ci/docker-build.yaml +0 -28
  15. package/.gitlab-ci/k8s-deploy-dev-master.yaml +0 -42
  16. package/.gitlab-ci/npm-build.yaml +0 -17
  17. package/.gitlab-ci.yml +0 -8
  18. package/.k8s/0-namespace.yaml +0 -6
  19. package/.k8s/1-configmap-web.yaml +0 -7
  20. package/.k8s/1-nginx-conf-dev.yaml +0 -110
  21. package/.k8s/2-deployment.yaml +0 -27
  22. package/.k8s/3-service.yaml +0 -16
  23. package/.k8s/4-ingress-dev.yaml +0 -30
  24. package/.lingma/rules/use-showToast-not-antd-message.md +0 -34
  25. package/.nginx/nginx.conf +0 -52
  26. package/.prettierrc +0 -9
  27. package/eslint.config.js +0 -32
  28. package/index.html +0 -13
  29. package/postcss.config.js +0 -6
  30. package/src/App.tsx +0 -96
  31. package/src/_doc/0.docs-overview.md +0 -28
  32. package/src/_doc/cx-ui/0.docs-overview.md +0 -30
  33. package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +0 -82
  34. package/src/_doc/cx-ui/comp.2.cx-modal.md +0 -82
  35. package/src/_doc/cx-ui/comp.3.cx-button.md +0 -89
  36. package/src/_doc/cx-ui/comp.4.cx-form.md +0 -72
  37. package/src/_doc/cx-ui/comp.5.cx-fields.md +0 -76
  38. package/src/_doc/cx-ui/comp.6.cx-tag.md +0 -57
  39. package/src/_doc/cx-ui/comp.7.cx-empty-state.md +0 -29
  40. package/src/_doc/meta/0.docs-overview.md +0 -24
  41. package/src/_doc/meta/comp.1.enum-runtime.md +0 -33
  42. package/src/_doc/meta/comp.2.dict-runtime.md +0 -39
  43. package/src/_doc/router/0.docs-overview.md +0 -14
  44. package/src/_doc/router/guide.1.menu-component-config.md +0 -181
  45. package/src/_doc/router/guide.2.router-auto-registration.md +0 -114
  46. package/src/_doc/table-view/0.docs-overview.md +0 -30
  47. package/src/_doc/table-view/comp.1.table-view.md +0 -542
  48. package/src/_doc/table-view/props.1.create-table-view-config.md +0 -193
  49. package/src/_doc/table-view/props.2.table-view-search-fields.md +0 -106
  50. package/src/api/_mock/README.md +0 -340
  51. package/src/api/_mock/api.ts +0 -1642
  52. package/src/api/_mock/bundle-shim.ts +0 -16
  53. package/src/api/_mock/handler-shim.ts +0 -6
  54. package/src/api/_mock/handler.ts +0 -458
  55. package/src/api/_mock/index.ts +0 -711
  56. package/src/api/_mock/interceptor.ts +0 -15
  57. package/src/api/_mock/mod.ts +0 -12
  58. package/src/api/_mock/utils.ts +0 -65
  59. package/src/api/base/memory.js +0 -24
  60. package/src/api/chat.js +0 -210
  61. package/src/api/common/auth.js +0 -70
  62. package/src/api/menus/business-rules.js +0 -76
  63. package/src/api/menus/feedback.js +0 -102
  64. package/src/api/menus/knowledge.js +0 -159
  65. package/src/api/menus/model-metadata/manage.js +0 -70
  66. package/src/api/menus/model-metadata/role.js +0 -50
  67. package/src/api/menus/model-metadata/training-detail-mock-data.js +0 -569
  68. package/src/api/menus/model-metadata/training.js +0 -28
  69. package/src/api/menus/skill.js +0 -40
  70. package/src/api/system/agent-config.js +0 -16
  71. package/src/api/system/department.js +0 -94
  72. package/src/api/system/dict.js +0 -86
  73. package/src/api/system/menu.js +0 -37
  74. package/src/api/system/permission.js +0 -26
  75. package/src/api/system/role.js +0 -34
  76. package/src/api/system/sys-config.js +0 -16
  77. package/src/api/system/sys-log.js +0 -17
  78. package/src/api/system/user.js +0 -75
  79. package/src/api/upload.js +0 -39
  80. package/src/assets/react.svg +0 -1
  81. package/src/components/auth/current-user-avatar.tsx +0 -77
  82. package/src/components/common/code-view.tsx +0 -149
  83. package/src/components/common/detail-link.tsx +0 -67
  84. package/src/components/common/error-boundary.tsx +0 -98
  85. package/src/components/common/language-switcher.tsx +0 -91
  86. package/src/components/common/lite-table/index.tsx +0 -135
  87. package/src/components/common/md-editor.tsx +0 -126
  88. package/src/components/common/modal/confirm-dialog.tsx +0 -113
  89. package/src/components/common/modal/dep-user-select-multi.tsx +0 -324
  90. package/src/components/common/modal/dep-user-select.tsx +0 -249
  91. package/src/components/common/modal/user-select-multi.tsx +0 -266
  92. package/src/components/common/pagination.tsx +0 -472
  93. package/src/components/common/path.tsx +0 -175
  94. package/src/components/common/system-logo-mark.tsx +0 -48
  95. package/src/components/cx-ui/button/index.less +0 -208
  96. package/src/components/cx-ui/button/index.tsx +0 -611
  97. package/src/components/cx-ui/checkbox/index.tsx +0 -78
  98. package/src/components/cx-ui/date-picker/index.less +0 -17
  99. package/src/components/cx-ui/date-picker/index.tsx +0 -193
  100. package/src/components/cx-ui/drawer/index.tsx +0 -47
  101. package/src/components/cx-ui/empty-state/index.tsx +0 -20
  102. package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +0 -89
  103. package/src/components/cx-ui/floating-shell/cx-floating-shell.less +0 -283
  104. package/src/components/cx-ui/floating-shell/has-floating-value.ts +0 -41
  105. package/src/components/cx-ui/form/CxForm.tsx +0 -15
  106. package/src/components/cx-ui/form/index.tsx +0 -20
  107. package/src/components/cx-ui/form-item/index.less +0 -26
  108. package/src/components/cx-ui/form-item/index.tsx +0 -36
  109. package/src/components/cx-ui/index.ts +0 -70
  110. package/src/components/cx-ui/input/auto-complete.tsx +0 -134
  111. package/src/components/cx-ui/input/index.tsx +0 -259
  112. package/src/components/cx-ui/input-number/index.jsx +0 -66
  113. package/src/components/cx-ui/modal/index.jsx +0 -212
  114. package/src/components/cx-ui/modal/index.less +0 -144
  115. package/src/components/cx-ui/modal/useCxModal.ts +0 -125
  116. package/src/components/cx-ui/multi-select/index.jsx +0 -74
  117. package/src/components/cx-ui/multi-select/index.less +0 -40
  118. package/src/components/cx-ui/multi-select/index2.tsx +0 -361
  119. package/src/components/cx-ui/radio/index.tsx +0 -33
  120. package/src/components/cx-ui/range-picker/index.less +0 -65
  121. package/src/components/cx-ui/range-picker/index.tsx +0 -219
  122. package/src/components/cx-ui/select/index.less +0 -34
  123. package/src/components/cx-ui/select/index.tsx +0 -196
  124. package/src/components/cx-ui/skeleton/index.tsx +0 -12
  125. package/src/components/cx-ui/steps/index.tsx +0 -14
  126. package/src/components/cx-ui/styles/_tokens.less +0 -79
  127. package/src/components/cx-ui/styles/index.less +0 -246
  128. package/src/components/cx-ui/switch/index.less +0 -106
  129. package/src/components/cx-ui/switch/index.tsx +0 -120
  130. package/src/components/cx-ui/table/index.less +0 -160
  131. package/src/components/cx-ui/table/index.tsx +0 -152
  132. package/src/components/cx-ui/tabs/index.less +0 -15
  133. package/src/components/cx-ui/tabs/index.tsx +0 -34
  134. package/src/components/cx-ui/tag/index.less +0 -51
  135. package/src/components/cx-ui/tag/index.tsx +0 -140
  136. package/src/components/cx-ui/timeline/index.tsx +0 -14
  137. package/src/components/cx-ui/tooltip/index.tsx +0 -67
  138. package/src/components/cx-ui/tree/index.tsx +0 -193
  139. package/src/components/cx-ui/tree-select/index.jsx +0 -91
  140. package/src/components/cx-ui/tree-select/index.less +0 -27
  141. package/src/components/cx-ui/upload-file/index.less +0 -223
  142. package/src/components/cx-ui/upload-file/index.tsx +0 -640
  143. package/src/components/cx-ui/upload-img/index.tsx +0 -291
  144. package/src/components/layout/components/Header.tsx +0 -216
  145. package/src/components/layout/components/Sidebar.tsx +0 -717
  146. package/src/components/layout/index.tsx +0 -95
  147. package/src/components/table-view/components/search-area.tsx +0 -411
  148. package/src/components/table-view/components/table-view-config.tsx +0 -528
  149. package/src/components/table-view/components/table-view.types.ts +0 -478
  150. package/src/components/table-view/components/tree-api-normalize.ts +0 -38
  151. package/src/components/table-view/components/tree-data-annotate.ts +0 -31
  152. package/src/components/table-view/components/tree-sidebar.tsx +0 -74
  153. package/src/components/table-view/index.tsx +0 -61
  154. package/src/components/table-view/list-page-view.tsx +0 -1049
  155. package/src/components/table-view/select-table-view.tsx +0 -1094
  156. package/src/components/table-view/styles/select-table-view.less +0 -51
  157. package/src/config/default-system-name.ts +0 -9
  158. package/src/config/system.ts +0 -165
  159. package/src/constants/countryCodes.ts +0 -3
  160. package/src/contexts/AuthContext.tsx +0 -256
  161. package/src/contexts/ChatContext.tsx +0 -839
  162. package/src/contexts/MenuContext.tsx +0 -62
  163. package/src/contexts/ToastContext.tsx +0 -181
  164. package/src/hooks/useCopyToClipboard.ts +0 -47
  165. package/src/hooks/useModalSubmit.ts +0 -104
  166. package/src/hooks/useRouter.ts +0 -240
  167. package/src/hooks/useStepForm.ts +0 -46
  168. package/src/hooks/useStickyHeader.ts +0 -42
  169. package/src/hooks/useThreadActions.ts +0 -105
  170. package/src/hooks/useUserPreferences.ts +0 -101
  171. package/src/http/axios.js +0 -372
  172. package/src/http/mock.interceptor.ts +0 -9
  173. package/src/http/obfuscationKey.ts +0 -41
  174. package/src/i18n.ts +0 -60
  175. package/src/index.js +0 -1
  176. package/src/index.less +0 -169
  177. package/src/locales/en/auth.ts +0 -70
  178. package/src/locales/en/base/memory.ts +0 -28
  179. package/src/locales/en/base/settings.ts +0 -41
  180. package/src/locales/en/chat.ts +0 -40
  181. package/src/locales/en/common.ts +0 -173
  182. package/src/locales/en/enum.ts +0 -27
  183. package/src/locales/en/menus/business-rules.ts +0 -48
  184. package/src/locales/en/menus/feedback.ts +0 -62
  185. package/src/locales/en/menus/knowledge.ts +0 -120
  186. package/src/locales/en/menus/model-metadata/index.ts +0 -10
  187. package/src/locales/en/menus/model-metadata/manage.ts +0 -151
  188. package/src/locales/en/menus/model-metadata/role.ts +0 -48
  189. package/src/locales/en/menus/model-metadata/training.ts +0 -65
  190. package/src/locales/en/menus/skill.ts +0 -34
  191. package/src/locales/en/system/agent-config.ts +0 -34
  192. package/src/locales/en/system/department.ts +0 -68
  193. package/src/locales/en/system/dict.ts +0 -44
  194. package/src/locales/en/system/menu.ts +0 -45
  195. package/src/locales/en/system/permission.ts +0 -89
  196. package/src/locales/en/system/role.ts +0 -25
  197. package/src/locales/en/system/sys-config.ts +0 -33
  198. package/src/locales/en/system/sys-log.ts +0 -38
  199. package/src/locales/en/system/user.ts +0 -113
  200. package/src/locales/en.ts +0 -68
  201. package/src/locales/zh/auth.ts +0 -70
  202. package/src/locales/zh/base/memory.ts +0 -29
  203. package/src/locales/zh/base/settings.ts +0 -41
  204. package/src/locales/zh/chat.ts +0 -47
  205. package/src/locales/zh/common.ts +0 -178
  206. package/src/locales/zh/enum.ts +0 -28
  207. package/src/locales/zh/menus/business-rules.ts +0 -47
  208. package/src/locales/zh/menus/feedback.ts +0 -62
  209. package/src/locales/zh/menus/knowledge.ts +0 -117
  210. package/src/locales/zh/menus/model-metadata/index.ts +0 -10
  211. package/src/locales/zh/menus/model-metadata/manage.ts +0 -151
  212. package/src/locales/zh/menus/model-metadata/role.ts +0 -47
  213. package/src/locales/zh/menus/model-metadata/training.ts +0 -64
  214. package/src/locales/zh/menus/skill.ts +0 -34
  215. package/src/locales/zh/system/agent-config.ts +0 -33
  216. package/src/locales/zh/system/department.ts +0 -69
  217. package/src/locales/zh/system/dict.ts +0 -44
  218. package/src/locales/zh/system/menu.ts +0 -47
  219. package/src/locales/zh/system/permission.ts +0 -94
  220. package/src/locales/zh/system/role.ts +0 -25
  221. package/src/locales/zh/system/sys-config.ts +0 -32
  222. package/src/locales/zh/system/sys-log.ts +0 -38
  223. package/src/locales/zh/system/user.ts +0 -114
  224. package/src/locales/zh.ts +0 -67
  225. package/src/main.tsx +0 -50
  226. package/src/meta/const/index.ts +0 -40
  227. package/src/meta/index-dict.ts +0 -56
  228. package/src/meta/index-enum.ts +0 -95
  229. package/src/meta/index.ts +0 -14
  230. package/src/meta/module/dict-data/runtime.ts +0 -199
  231. package/src/meta/module/dict-data/types.ts +0 -17
  232. package/src/meta/module/enum-data/runtime.ts +0 -75
  233. package/src/meta/module/enum-data/types.ts +0 -18
  234. package/src/router/index.tsx +0 -312
  235. package/src/styles/AntdThemeProvider.tsx +0 -40
  236. package/src/styles/antd-theme.ts +0 -20
  237. package/src/styles/global.less +0 -107
  238. package/src/styles/variable.less +0 -103
  239. package/src/types/feedback.ts +0 -43
  240. package/src/types/index.ts +0 -85
  241. package/src/types/menu.ts +0 -43
  242. package/src/utils/aesUtil.ts +0 -123
  243. package/src/utils/chatUtils.ts +0 -524
  244. package/src/utils/cn.ts +0 -6
  245. package/src/utils/crypto.ts +0 -164
  246. package/src/utils/date.ts +0 -72
  247. package/src/utils/file-icons.tsx +0 -79
  248. package/src/utils/index.ts +0 -168
  249. package/src/utils/markdown-math-plugins.ts +0 -21
  250. package/src/utils/menuI18n.ts +0 -305
  251. package/src/utils/menuRouteRegistry.ts +0 -78
  252. package/src/utils/permission-crud.ts +0 -147
  253. package/src/utils/routeConfig.ts +0 -350
  254. package/src/utils/storage.ts +0 -135
  255. package/src/utils/toastBridge.ts +0 -26
  256. package/src/utils/url.ts +0 -38
  257. package/src/utils/validation.ts +0 -16
  258. package/src/views/auth/auth-code/index.less +0 -169
  259. package/src/views/auth/auth-code/index.module.less +0 -174
  260. package/src/views/auth/auth-code/index.tsx +0 -233
  261. package/src/views/auth/login.tsx +0 -498
  262. package/src/views/auth/register.tsx +0 -388
  263. package/src/views/base/memory/index.tsx +0 -136
  264. package/src/views/base/memory/modal/detail-modal.tsx +0 -89
  265. package/src/views/base/memory/modal/submit-modal.tsx +0 -134
  266. package/src/views/base/settings/index.tsx +0 -657
  267. package/src/views/chat/chat.less +0 -323
  268. package/src/views/chat/components/chat-input.tsx +0 -298
  269. package/src/views/chat/components/header-thread-title.tsx +0 -210
  270. package/src/views/chat/components/message-list/content-answer.tsx +0 -100
  271. package/src/views/chat/components/message-list/content-question.tsx +0 -18
  272. package/src/views/chat/components/message-list/index.tsx +0 -520
  273. package/src/views/chat/components/message-list/message-item.tsx +0 -199
  274. package/src/views/chat/components/message-list/preparation-demo-items.ts +0 -147
  275. package/src/views/chat/components/message-list/preparation-steps.tsx +0 -506
  276. package/src/views/chat/components/message-list/suggestion-list.tsx +0 -36
  277. package/src/views/chat/components/message-list/thinking-process.tsx +0 -49
  278. package/src/views/chat/components/message-list/toolbar.tsx +0 -224
  279. package/src/views/chat/components/message-list/use-message-list-scroll.ts +0 -214
  280. package/src/views/chat/components/references-knowledge/context.tsx +0 -57
  281. package/src/views/chat/components/references-knowledge/index.ts +0 -9
  282. package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +0 -556
  283. package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +0 -529
  284. package/src/views/chat/components/references-knowledge/panel.tsx +0 -115
  285. package/src/views/chat/hooks/use-chat-common.ts +0 -19
  286. package/src/views/chat/index-session.tsx +0 -647
  287. package/src/views/chat/index.tsx +0 -127
  288. package/src/views/page-error/401.tsx +0 -56
  289. package/src/views/page-error/404.tsx +0 -56
  290. package/src/views/page-menus/business-rules/index.tsx +0 -376
  291. package/src/views/page-menus/business-rules/modal/detail-modal.tsx +0 -186
  292. package/src/views/page-menus/business-rules/modal/scope-modal.tsx +0 -272
  293. package/src/views/page-menus/business-rules/modal/submit-modal.tsx +0 -142
  294. package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +0 -471
  295. package/src/views/page-menus/feedback/index.tsx +0 -166
  296. package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +0 -367
  297. package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +0 -32
  298. package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +0 -330
  299. package/src/views/page-menus/knowledge/detail.tsx +0 -600
  300. package/src/views/page-menus/knowledge/index.tsx +0 -337
  301. package/src/views/page-menus/knowledge/modal/detail-modal.tsx +0 -618
  302. package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +0 -550
  303. package/src/views/page-menus/knowledge/modal/doc-parse.ts +0 -99
  304. package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +0 -349
  305. package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +0 -88
  306. package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +0 -283
  307. package/src/views/page-menus/knowledge/modal/submit-modal.tsx +0 -179
  308. package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +0 -114
  309. package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +0 -232
  310. package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +0 -316
  311. package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +0 -134
  312. package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +0 -134
  313. package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +0 -101
  314. package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +0 -338
  315. package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +0 -276
  316. package/src/views/page-menus/model-metadata/manage/detail.tsx +0 -298
  317. package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +0 -113
  318. package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +0 -20
  319. package/src/views/page-menus/model-metadata/manage/index.tsx +0 -304
  320. package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +0 -374
  321. package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +0 -151
  322. package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +0 -423
  323. package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +0 -218
  324. package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +0 -261
  325. package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +0 -196
  326. package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +0 -229
  327. package/src/views/page-menus/model-metadata/manage/submit.tsx +0 -31
  328. package/src/views/page-menus/model-metadata/role/index.tsx +0 -207
  329. package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +0 -97
  330. package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +0 -254
  331. package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +0 -393
  332. package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +0 -120
  333. package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +0 -698
  334. package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +0 -237
  335. package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +0 -135
  336. package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +0 -4
  337. package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +0 -72
  338. package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +0 -196
  339. package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +0 -153
  340. package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +0 -103
  341. package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +0 -82
  342. package/src/views/page-menus/model-metadata/training/detail.tsx +0 -159
  343. package/src/views/page-menus/model-metadata/training/index.tsx +0 -236
  344. package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +0 -154
  345. package/src/views/page-menus/skill/index.tsx +0 -201
  346. package/src/views/page-menus/skill/modal/detail-modal.tsx +0 -156
  347. package/src/views/page-menus/skill/modal/submit-modal.tsx +0 -214
  348. package/src/views/page-system/agent-config/index.tsx +0 -370
  349. package/src/views/page-system/department/departmentFormShared.ts +0 -36
  350. package/src/views/page-system/department/index.tsx +0 -541
  351. package/src/views/page-system/department/modal/detail-modal.tsx +0 -94
  352. package/src/views/page-system/department/modal/member-role-modal.tsx +0 -128
  353. package/src/views/page-system/department/modal/submit-modal.tsx +0 -265
  354. package/src/views/page-system/dict/index.tsx +0 -440
  355. package/src/views/page-system/dict/modal/cate-submit-modal.tsx +0 -315
  356. package/src/views/page-system/dict/modal/submit-modal.tsx +0 -184
  357. package/src/views/page-system/logs/components/index.ts +0 -3
  358. package/src/views/page-system/logs/components/log-message-demo.tsx +0 -30
  359. package/src/views/page-system/logs/components/log-message-stream.ts +0 -184
  360. package/src/views/page-system/logs/components/message-list/content-answer.tsx +0 -100
  361. package/src/views/page-system/logs/components/message-list/content-question.tsx +0 -18
  362. package/src/views/page-system/logs/components/message-list/index.tsx +0 -515
  363. package/src/views/page-system/logs/components/message-list/message-item.tsx +0 -193
  364. package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +0 -147
  365. package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +0 -506
  366. package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +0 -36
  367. package/src/views/page-system/logs/components/message-list/thinking-process.tsx +0 -49
  368. package/src/views/page-system/logs/components/message-list/toolbar.tsx +0 -134
  369. package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +0 -214
  370. package/src/views/page-system/logs/components/message-modal.tsx +0 -239
  371. package/src/views/page-system/logs/index.tsx +0 -132
  372. package/src/views/page-system/logs/modal/detail-modal.tsx +0 -157
  373. package/src/views/page-system/menu/components/menuFormShared.ts +0 -283
  374. package/src/views/page-system/menu/index.less +0 -12
  375. package/src/views/page-system/menu/index.tsx +0 -410
  376. package/src/views/page-system/menu/modal/icon-modal.less +0 -51
  377. package/src/views/page-system/menu/modal/icon-modal.tsx +0 -87
  378. package/src/views/page-system/menu/modal/submit-modal.tsx +0 -263
  379. package/src/views/page-system/permission/index.tsx +0 -562
  380. package/src/views/page-system/permission/modal/detail-modal.tsx +0 -179
  381. package/src/views/page-system/permission/modal/submit-modal.less +0 -146
  382. package/src/views/page-system/permission/modal/submit-modal.tsx +0 -650
  383. package/src/views/page-system/role/index.tsx +0 -163
  384. package/src/views/page-system/role/modal/detail-modal.tsx +0 -127
  385. package/src/views/page-system/role/modal/permission-assign-group-rules.ts +0 -86
  386. package/src/views/page-system/role/modal/permission-modal.tsx +0 -111
  387. package/src/views/page-system/role/modal/role-modal-shell-styles.ts +0 -21
  388. package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +0 -916
  389. package/src/views/page-system/role/modal/role-permission-assign-shared.ts +0 -1047
  390. package/src/views/page-system/role/modal/submit-modal.tsx +0 -193
  391. package/src/views/page-system/sys-config/index.tsx +0 -294
  392. package/src/views/page-system/user/components/user-role-column.tsx +0 -87
  393. package/src/views/page-system/user/index.tsx +0 -439
  394. package/src/views/page-system/user/modal/assign-roles-modal.tsx +0 -389
  395. package/src/views/page-system/user/modal/detail-modal.tsx +0 -72
  396. package/src/views/page-system/user/modal/modal-style/submit-modal.less +0 -40
  397. package/src/views/page-system/user/modal/submit-modal.less +0 -40
  398. package/src/views/page-system/user/modal/submit-modal.tsx +0 -287
  399. package/src/views/page-system/user/userFormShared.ts +0 -51
  400. package/tailwind.config.js +0 -17
  401. package/tsconfig.app.json +0 -48
  402. package/tsconfig.json +0 -11
  403. package/tsconfig.node.json +0 -26
  404. package/vite.config.ts +0 -272
  405. /package/{public → dist}/favicon.ico +0 -0
  406. /package/{public → dist}/vite.svg +0 -0
@@ -1,506 +0,0 @@
1
- import type { Message } from '@/types'
2
- import type { TFunction } from 'i18next'
3
- import clsx from 'clsx'
4
- import { CxSteps } from '@cx-ui'
5
- import type { StepsProps } from 'antd'
6
- import { Spin } from 'antd'
7
- import { CheckCircle2 } from 'lucide-react'
8
- import React from 'react'
9
- import { useTranslation } from 'react-i18next'
10
- import type { Components } from 'react-markdown'
11
- import ReactMarkdown from 'react-markdown'
12
- import remarkGfm from 'remark-gfm'
13
-
14
- // i18n 中文:locales/zh/chat.ts(chat.preparation_heading → 正在分析)
15
- // 样式:views/chat/chat.less(chat-prep-*、chat-prep-step-desc-scroll、--memory-tail 含知识库检索、chat-prep-step-md)
16
- // DEV 演示数据:preparation-demo-items.ts(CHAT_PREPARATION_DEMO_ITEMS,与 SSE preparation 对齐)
17
- // 与 use-message-list-scroll 约定:chat-prep-layout 事件(副标题区布局增高时粘底)
18
- // 副标题串行:按 preparation 行顺序,上一行打字播完再开始下一行(无副标题行自动跳过)
19
-
20
- /** 消息列表在「靠近底部」时响应此事件做粘底(use-message-list-scroll 内监听同名) */
21
- export const CHAT_MESSAGE_LIST_PREP_LAYOUT_EVENT = 'chat-prep-layout'
22
-
23
- let prepLayoutBumpTimer: ReturnType<typeof setTimeout> | null = null
24
-
25
- function bumpChatMessageListPrepLayout() {
26
- if (prepLayoutBumpTimer != null) return
27
- prepLayoutBumpTimer = setTimeout(() => {
28
- prepLayoutBumpTimer = null
29
- window.dispatchEvent(new CustomEvent(CHAT_MESSAGE_LIST_PREP_LAYOUT_EVENT))
30
- }, 40)
31
- }
32
-
33
- /** preparation 副标题:GFM Markdown;真实换行或字面量 `\n` 均可,`\n\n` 分段落 */
34
- const prepDescriptionMarkdownComponents: Components = {
35
- a: (props) => (
36
- <a {...props} target="_blank" rel="noopener noreferrer" />
37
- ),
38
- }
39
-
40
- /** 将接口里常见的字面量转义还原(如 JSON 里写成 `\\n` 解析后仍是反斜杠+n) */
41
- function preparationDescriptionUnescapeSequences(raw: string) {
42
- return raw
43
- .replace(/\\r\\n/g, '\n')
44
- .replace(/\\r/g, '\n')
45
- .replace(/\\n/g, '\n')
46
- .replace(/\\t/g, '\t')
47
- }
48
-
49
- function normalizePreparationDescriptionRaw(raw: string) {
50
- return preparationDescriptionUnescapeSequences(raw.trim())
51
- .replace(/\r\n/g, '\n')
52
- .replace(/\r/g, '\n')
53
- }
54
-
55
- function preparationDescriptionToMarkdownFromNormalized(normalized: string) {
56
- return normalized
57
- .split(/\n\n/)
58
- .map((block) => block.replace(/\n/g, ' \n'))
59
- .join('\n\n')
60
- }
61
-
62
- /** 副标题打字机:每档间隔(ms),与「每档字符数」配合控制整体节奏(略快于逐字、慢于一帧刷满) */
63
- const PREP_DESC_CHUNK_TICK_MS = 44
64
-
65
- function prepDescCharsPerTick(len: number) {
66
- return Math.max(2, Math.ceil(len / 88))
67
- }
68
-
69
- /** 短期/长期记忆、知识库检索:固定可视约 4 行、裁切顶部、无滚动(与 --memory-tail 样式一致) */
70
- function isPrepMemoryTailViewStep(code: string) {
71
- return (
72
- code === 'short_memory' ||
73
- code === 'long_memory' ||
74
- code === 'knowledge_retrieval'
75
- )
76
- }
77
-
78
- /** 无后端 description 时,用参考资料列表拼成副标题(与右侧面板语义一致,键见 locales/zh/chat.ts) */
79
- function buildKnowledgeRetrievalPrepDescriptionFromRefs(
80
- refItems: NonNullable<Message['references_knowledge_items']>,
81
- t: TFunction,
82
- ) {
83
- if (!refItems.length) return ''
84
- const blocks = refItems.map((x, idx) => {
85
- const docName =
86
- (typeof x.doc_name === 'string' && x.doc_name) ||
87
- (typeof x.docName === 'string' && x.docName) ||
88
- ''
89
- const titleLine = docName
90
- ? t('chat.references_item_with_doc', { index: idx + 1, docName }) // 资料 n(文档名)
91
- : t('chat.references_item_plain', { index: idx + 1 }) // 资料 n
92
- const rawBody =
93
- typeof x.page_content === 'string' ? x.page_content.trim() : ''
94
- const body =
95
- rawBody || t('chat.references_excerpt_placeholder') // 正文占位
96
- const kbName =
97
- typeof x.kb_name === 'string' && x.kb_name.trim()
98
- ? x.kb_name.trim()
99
- : '-'
100
- const kbLine = `${t('chat.references_kb_label')}${kbName}` // 知识库:+ 名称
101
- return `${titleLine}\n${body}\n${kbLine}`
102
- })
103
- return blocks.join('\n\n---\n\n')
104
- }
105
-
106
- function PreparationStepDescriptionMd({
107
- source,
108
- stepCode,
109
- rowKey,
110
- revealMode,
111
- onRevealStart,
112
- onRevealComplete,
113
- }: {
114
- source: string
115
- /** 当前 preparation 项 code:记忆类与知识库检索走尾部裁切、不可滚可视区 */
116
- stepCode: string
117
- /** 与父级 Steps 行一致,用于打字开始/结束回调 */
118
- rowKey: string
119
- /** full:已轮到且之前阶段已播完,整段展示;typing:当前串行阶段,块打字机 */
120
- revealMode: 'full' | 'typing'
121
- /** 开始从 0 揭示前调用(父级将本行标为未完成,避免 Strict Mode 下图标先打勾) */
122
- onRevealStart?: (key: string) => void
123
- /** 本行副标题揭示到满字时调用一次 */
124
- onRevealComplete?: (key: string) => void
125
- }) {
126
- const normalizedFull = React.useMemo(
127
- () => normalizePreparationDescriptionRaw(source),
128
- [source],
129
- )
130
- const [revealedLen, setRevealedLen] = React.useState(0)
131
- const descScrollRef = React.useRef<HTMLDivElement>(null)
132
- const prevNormRef = React.useRef<string | null>(null)
133
- const revealDoneNotifiedRef = React.useRef(false)
134
-
135
- const memoryTailView = isPrepMemoryTailViewStep(stepCode)
136
-
137
- const scrollDescRefToEnd = React.useCallback(() => {
138
- if (!memoryTailView) {
139
- requestAnimationFrame(() => {
140
- requestAnimationFrame(() => {
141
- const el = descScrollRef.current
142
- if (el) el.scrollTop = el.scrollHeight
143
- bumpChatMessageListPrepLayout()
144
- })
145
- })
146
- } else {
147
- bumpChatMessageListPrepLayout()
148
- }
149
- }, [memoryTailView])
150
-
151
- React.useLayoutEffect(() => {
152
- if (revealMode !== 'full') return
153
- const len = normalizedFull.length
154
- if (!len) {
155
- setRevealedLen(0)
156
- return
157
- }
158
- setRevealedLen(len)
159
- scrollDescRefToEnd()
160
- }, [revealMode, normalizedFull, scrollDescRefToEnd])
161
-
162
- React.useEffect(() => {
163
- if (revealMode !== 'typing') return
164
-
165
- if (prevNormRef.current !== normalizedFull) {
166
- prevNormRef.current = normalizedFull
167
- revealDoneNotifiedRef.current = false
168
- }
169
-
170
- const len = normalizedFull.length
171
- if (!len) {
172
- setRevealedLen(0)
173
- return
174
- }
175
-
176
- onRevealStart?.(rowKey)
177
- setRevealedLen(0)
178
- const t0 = performance.now()
179
- let rafId = 0
180
- let revealed = 0
181
- const tickMs = PREP_DESC_CHUNK_TICK_MS
182
- const chunk = prepDescCharsPerTick(len)
183
- let nextTickAt = t0 + tickMs
184
-
185
- const step = (now: number) => {
186
- if (now >= nextTickAt && revealed < len) {
187
- revealed = Math.min(len, revealed + chunk)
188
- nextTickAt = now + tickMs
189
- setRevealedLen(revealed)
190
- scrollDescRefToEnd()
191
- }
192
-
193
- if (revealed >= len) {
194
- if (!revealDoneNotifiedRef.current) {
195
- revealDoneNotifiedRef.current = true
196
- onRevealComplete?.(rowKey)
197
- }
198
- return
199
- }
200
-
201
- rafId = requestAnimationFrame(step)
202
- }
203
-
204
- rafId = requestAnimationFrame(step)
205
- return () => {
206
- cancelAnimationFrame(rafId)
207
- }
208
- }, [
209
- revealMode,
210
- normalizedFull,
211
- scrollDescRefToEnd,
212
- memoryTailView,
213
- rowKey,
214
- onRevealStart,
215
- onRevealComplete,
216
- ])
217
-
218
- if (!normalizedFull.length) return null
219
-
220
- const md = preparationDescriptionToMarkdownFromNormalized(
221
- normalizedFull.slice(0, revealedLen),
222
- )
223
-
224
- return (
225
- <div
226
- ref={descScrollRef}
227
- className={clsx(
228
- 'chat-prep-step-desc-scroll',
229
- memoryTailView && 'chat-prep-step-desc-scroll--memory-tail',
230
- )}
231
- >
232
- <div className="chat-prep-step-md">
233
- <ReactMarkdown
234
- remarkPlugins={[remarkGfm]}
235
- components={prepDescriptionMarkdownComponents}
236
- >
237
- {md}
238
- </ReactMarkdown>
239
- </div>
240
- </div>
241
- )
242
- }
243
-
244
- type PrepItem = NonNullable<Message['preparation_items']>[number]
245
-
246
- function prepRowKey(it: PrepItem) {
247
- return `${it.code}\t${it.name}`
248
- }
249
-
250
- function resolvePrepItemDescription(it: PrepItem, kbRefDesc: string) {
251
- const fromApi = it.description?.trim()
252
- const fromRefs =
253
- it.code === 'knowledge_retrieval' && !fromApi ? kbRefDesc : ''
254
- return (fromApi || fromRefs).trim()
255
- }
256
-
257
- type StepItemStatus = NonNullable<StepsProps['items']>[number]['status']
258
-
259
- /** SSE 约定 start/end → 内部 phase;其它 phase 为后端透传字符串 */
260
- function mapPhaseToStepStatus(phase: string): StepItemStatus {
261
- if (phase === 'done') return 'finish'
262
- if (phase === 'running') return 'process'
263
- if (phase === 'error' || phase === 'failed') return 'error'
264
- return 'wait'
265
- }
266
-
267
- export { CHAT_PREPARATION_DEMO_ITEMS } from './preparation-demo-items'
268
-
269
- /**
270
- * 开发态:URL 带 `?chatPrep=1` 时在会话页固定展示 preparation(无需发消息)。
271
- * @param search 传入 `useLocation().search` 以便路由变更时与界面同步
272
- */
273
- export function isChatPreparationDemoEnabled(search?: string): boolean {
274
- if (!import.meta.env.DEV) return false
275
- const q =
276
- search ??
277
- (typeof window !== 'undefined' ? window.location.search : '')
278
- return new URLSearchParams(q).get('chatPrep') === '1'
279
- }
280
-
281
- export function PreparationSteps({
282
- items,
283
- referencesKnowledgeItems,
284
- }: {
285
- items: NonNullable<Message['preparation_items']>
286
- /** 流式阶段与 knowledge_retrieval 步同屏:无 description 时用引用列表拼副标题 */
287
- referencesKnowledgeItems?: Message['references_knowledge_items']
288
- }) {
289
- const { t } = useTranslation()
290
-
291
- const kbRefDesc = React.useMemo(() => {
292
- if (!referencesKnowledgeItems || referencesKnowledgeItems.length === 0)
293
- return ''
294
- return buildKnowledgeRetrievalPrepDescriptionFromRefs(
295
- referencesKnowledgeItems,
296
- t,
297
- )
298
- }, [referencesKnowledgeItems, t])
299
-
300
- const prevDescByKeyRef = React.useRef<Record<string, string>>({})
301
- const [descRevealComplete, setDescRevealComplete] = React.useState<
302
- Record<string, boolean>
303
- >({})
304
- const [sequentialUnlockIdx, setSequentialUnlockIdx] = React.useState(0)
305
-
306
- /** 前缀 preparation 行 identity 变化或列表变短时串行队列从头来(末尾追加新行不重置) */
307
- const prevPrepRowKeysRef = React.useRef<string[]>([])
308
-
309
- React.useLayoutEffect(() => {
310
- const keys = items.map(prepRowKey)
311
- const prev = prevPrepRowKeysRef.current
312
- if (prev.length === 0) {
313
- prevPrepRowKeysRef.current = keys
314
- return
315
- }
316
- const minLen = Math.min(prev.length, keys.length)
317
- let prefixBroken = false
318
- for (let i = 0; i < minLen; i++) {
319
- if (prev[i] !== keys[i]) {
320
- prefixBroken = true
321
- break
322
- }
323
- }
324
- if (prefixBroken || keys.length < prev.length) {
325
- setSequentialUnlockIdx(0)
326
- setDescRevealComplete({})
327
- }
328
- prevPrepRowKeysRef.current = keys
329
- }, [items])
330
-
331
- /** 当前串行指针落在「无副标题」行时直接跳过 */
332
- React.useLayoutEffect(() => {
333
- setSequentialUnlockIdx((u) => {
334
- let v = u
335
- while (
336
- v < items.length &&
337
- !resolvePrepItemDescription(items[v], kbRefDesc)
338
- ) {
339
- v += 1
340
- }
341
- return v
342
- })
343
- }, [items, kbRefDesc, sequentialUnlockIdx])
344
-
345
- /** 已播完的行副标题视为完成(对勾与后端 phase 对齐用) */
346
- React.useLayoutEffect(() => {
347
- setDescRevealComplete((prev) => {
348
- const next = { ...prev }
349
- let changed = false
350
- for (let i = 0; i < sequentialUnlockIdx; i++) {
351
- const it = items[i]
352
- const d = resolvePrepItemDescription(it, kbRefDesc)
353
- const k = prepRowKey(it)
354
- if (d && next[k] !== true) {
355
- next[k] = true
356
- changed = true
357
- }
358
- }
359
- return changed ? next : prev
360
- })
361
- }, [sequentialUnlockIdx, items, kbRefDesc])
362
-
363
- React.useLayoutEffect(() => {
364
- setDescRevealComplete((prev) => {
365
- const next = { ...prev }
366
- let changed = false
367
- for (const it of items) {
368
- const key = prepRowKey(it)
369
- const desc = resolvePrepItemDescription(it, kbRefDesc)
370
- const prevD = prevDescByKeyRef.current[key]
371
- if (desc !== prevD) {
372
- prevDescByKeyRef.current[key] = desc
373
- if (desc) {
374
- if (next[key] !== false) {
375
- next[key] = false
376
- changed = true
377
- }
378
- } else if (key in next) {
379
- delete next[key]
380
- changed = true
381
- }
382
- }
383
- }
384
- return changed ? next : prev
385
- })
386
- }, [items, kbRefDesc])
387
-
388
- const handleDescRevealStart = React.useCallback((key: string) => {
389
- setDescRevealComplete((prev) => {
390
- if (prev[key] === false) return prev
391
- return { ...prev, [key]: false }
392
- })
393
- }, [])
394
-
395
- const handleDescRevealComplete = React.useCallback((key: string) => {
396
- const idx = items.findIndex((it) => prepRowKey(it) === key)
397
- if (idx < 0) return
398
- setDescRevealComplete((prev) => {
399
- if (prev[key]) return prev
400
- return { ...prev, [key]: true }
401
- })
402
- setSequentialUnlockIdx(idx + 1)
403
- }, [items])
404
-
405
- const stepsItems = React.useMemo((): StepsProps['items'] => {
406
- return items.map((it: PrepItem, idx: number) => {
407
- const title = it.name || it.code
408
- const key = prepRowKey(it)
409
- const backendStatus = mapPhaseToStepStatus(it.phase)
410
- const desc = resolvePrepItemDescription(it, kbRefDesc)
411
-
412
- let displayStatus = backendStatus
413
- if (backendStatus === 'error') {
414
- displayStatus = 'error'
415
- } else if (desc) {
416
- if (idx > sequentialUnlockIdx) {
417
- displayStatus = 'wait'
418
- } else if (idx < sequentialUnlockIdx) {
419
- displayStatus = backendStatus
420
- } else if (!descRevealComplete[key]) {
421
- displayStatus = 'process'
422
- } else {
423
- displayStatus = backendStatus
424
- }
425
- }
426
-
427
- const row: NonNullable<StepsProps['items']>[number] = {
428
- title,
429
- status: displayStatus,
430
- }
431
-
432
- if (desc) {
433
- if (idx > sequentialUnlockIdx) {
434
- /* 未到串行轮次:不渲染副标题 */
435
- } else if (idx < sequentialUnlockIdx) {
436
- row.description = (
437
- <PreparationStepDescriptionMd
438
- key={key}
439
- rowKey={key}
440
- revealMode="full"
441
- source={desc}
442
- stepCode={it.code}
443
- />
444
- )
445
- } else {
446
- row.description = (
447
- <PreparationStepDescriptionMd
448
- key={key}
449
- rowKey={key}
450
- revealMode="typing"
451
- source={desc}
452
- stepCode={it.code}
453
- onRevealStart={handleDescRevealStart}
454
- onRevealComplete={handleDescRevealComplete}
455
- />
456
- )
457
- }
458
- }
459
-
460
- if (displayStatus === 'finish') {
461
- row.icon = (
462
- <span className="chat-prep-step-icon-inner" aria-hidden>
463
- <CheckCircle2 size={18} strokeWidth={2} />
464
- </span>
465
- )
466
- } else if (displayStatus === 'process' || displayStatus === 'wait') {
467
- row.icon = (
468
- <span
469
- className="chat-prep-step-spin"
470
- role="status"
471
- aria-label={t('common.loading')}
472
- >
473
- <Spin size="small" />
474
- </span>
475
- )
476
- }
477
- return row
478
- })
479
- }, [
480
- items,
481
- kbRefDesc,
482
- t,
483
- descRevealComplete,
484
- sequentialUnlockIdx,
485
- handleDescRevealStart,
486
- handleDescRevealComplete,
487
- ])
488
-
489
- if (!items.length) return null
490
-
491
- return (
492
- <div className="chat-prep-panel">
493
- <div className="chat-prep-heading">{t('chat.preparation_heading')}</div>
494
- <div className="chat-prep-steps-wrap">
495
- <CxSteps
496
- orientation="vertical"
497
- size="small"
498
- items={stepsItems}
499
- className="chat-prep-steps"
500
- />
501
- </div>
502
- </div>
503
- )
504
- }
505
-
506
- export default PreparationSteps
@@ -1,36 +0,0 @@
1
- import React from 'react'
2
- import clsx from 'clsx'
3
-
4
- /** 与流式/历史里 `suggested_replies` → `message.options` 同一套样式 */
5
- const SUGGESTED_REPLY_BTN_CLS = clsx(
6
- 'w-fit max-w-full',
7
- 'text-left break-words whitespace-normal',
8
- 'px-4 py-2.5 rounded-xl text-[13px] leading-relaxed',
9
- 'text-gray-700 dark:text-gray-200',
10
- 'bg-[#f2f3f5] dark:bg-[#2d2e30]',
11
- 'hover:bg-[#e8eaed] dark:hover:bg-[#3a3b3d]',
12
- 'transition-colors duration-150',
13
- )
14
-
15
- export const SuggestionList: React.FC<{
16
- options: string[]
17
- keyPrefix: string
18
- onOptionClick?: (option: string) => void | Promise<void>
19
- }> = ({ options, keyPrefix, onOptionClick }) => (
20
- <div className="mt-2 flex flex-col gap-2 items-start">
21
- {options.map((option, idx) => (
22
- <button
23
- type="button"
24
- key={`${keyPrefix}-${idx}`}
25
- onClick={() => {
26
- const fn = onOptionClick
27
- if (fn) void fn(option)
28
- }}
29
- className={SUGGESTED_REPLY_BTN_CLS}
30
- >
31
- {option}
32
- </button>
33
- ))}
34
- </div>
35
- )
36
-
@@ -1,49 +0,0 @@
1
- import { Spin } from 'antd'
2
- import React from 'react'
3
- import { useTranslation } from 'react-i18next'
4
-
5
- export const ThinkingProcess: React.FC<{
6
- thoughts: string[]
7
- isContentVisible: boolean
8
- }> = ({ thoughts, isContentVisible }) => {
9
- const { t } = useTranslation()
10
- const currentThought =
11
- thoughts && thoughts.length > 0 ? thoughts[thoughts.length - 1] : ''
12
-
13
- const displayThought = React.useMemo(() => {
14
- if (!currentThought) return ''
15
- let text = currentThought
16
- try {
17
- if (currentThought.trim().startsWith('{')) {
18
- const parsed = JSON.parse(currentThought)
19
- text = parsed.thought || parsed.action || parsed.status || currentThought
20
- }
21
- } catch {
22
- // ignore
23
- }
24
- return text.replace(/\.{3}$|…$/, '')
25
- }, [currentThought])
26
-
27
- if (isContentVisible) return null
28
- if (!thoughts || thoughts.length === 0) return null
29
-
30
- return (
31
- <div className="mb-2">
32
- <div className="flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400">
33
- <span
34
- key={displayThought}
35
- className="font-mono animate-fade-in"
36
- >
37
- {displayThought}
38
- </span>
39
- <div
40
- className="flex h-6 shrink-0 items-center [&_.ant-spin-nested-loading]:!p-0"
41
- role="status"
42
- aria-label={t('common.loading')}
43
- >
44
- <Spin size="small" />
45
- </div>
46
- </div>
47
- </div>
48
- )
49
- }