cx-chat 0.0.2 → 0.0.3
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.
- package/dist/cx-chat.css +1 -0
- package/dist/cx-chat.es.js +97326 -0
- package/dist/cx-chat.umd.js +734 -0
- package/package.json +21 -1
- package/.cursor/rules/i18n-cn-gloss-comments.mdc +0 -31
- package/.cursor/rules/list-page-view-pageconfig.mdc +0 -32
- package/.cursor/rules/no-over-defensive-programming.mdc +0 -90
- package/.cursor/rules/requirement-description-for-agent.mdc +0 -33
- package/.cursor/rules/use-showToast-not-antd-message.mdc +0 -28
- package/.docker/Dockerfile +0 -7
- package/.env +0 -9
- package/.env.development +0 -7
- package/.env.production +0 -7
- package/.gitlab-ci/docker-build.yaml +0 -28
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +0 -42
- package/.gitlab-ci/npm-build.yaml +0 -17
- package/.gitlab-ci.yml +0 -8
- package/.k8s/0-namespace.yaml +0 -6
- package/.k8s/1-configmap-web.yaml +0 -7
- package/.k8s/1-nginx-conf-dev.yaml +0 -110
- package/.k8s/2-deployment.yaml +0 -27
- package/.k8s/3-service.yaml +0 -16
- package/.k8s/4-ingress-dev.yaml +0 -30
- package/.lingma/rules/use-showToast-not-antd-message.md +0 -34
- package/.nginx/nginx.conf +0 -52
- package/.prettierrc +0 -9
- package/eslint.config.js +0 -32
- package/index.html +0 -13
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -96
- package/src/_doc/0.docs-overview.md +0 -28
- package/src/_doc/cx-ui/0.docs-overview.md +0 -30
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +0 -82
- package/src/_doc/cx-ui/comp.2.cx-modal.md +0 -82
- package/src/_doc/cx-ui/comp.3.cx-button.md +0 -89
- package/src/_doc/cx-ui/comp.4.cx-form.md +0 -72
- package/src/_doc/cx-ui/comp.5.cx-fields.md +0 -76
- package/src/_doc/cx-ui/comp.6.cx-tag.md +0 -57
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +0 -29
- package/src/_doc/meta/0.docs-overview.md +0 -24
- package/src/_doc/meta/comp.1.enum-runtime.md +0 -33
- package/src/_doc/meta/comp.2.dict-runtime.md +0 -39
- package/src/_doc/router/0.docs-overview.md +0 -14
- package/src/_doc/router/guide.1.menu-component-config.md +0 -181
- package/src/_doc/router/guide.2.router-auto-registration.md +0 -114
- package/src/_doc/table-view/0.docs-overview.md +0 -30
- package/src/_doc/table-view/comp.1.table-view.md +0 -542
- package/src/_doc/table-view/props.1.create-table-view-config.md +0 -193
- package/src/_doc/table-view/props.2.table-view-search-fields.md +0 -106
- package/src/api/_mock/README.md +0 -340
- package/src/api/_mock/api.ts +0 -1642
- package/src/api/_mock/bundle-shim.ts +0 -16
- package/src/api/_mock/handler-shim.ts +0 -6
- package/src/api/_mock/handler.ts +0 -458
- package/src/api/_mock/index.ts +0 -711
- package/src/api/_mock/interceptor.ts +0 -15
- package/src/api/_mock/mod.ts +0 -12
- package/src/api/_mock/utils.ts +0 -65
- package/src/api/base/memory.js +0 -24
- package/src/api/chat.js +0 -210
- package/src/api/common/auth.js +0 -70
- package/src/api/menus/business-rules.js +0 -76
- package/src/api/menus/feedback.js +0 -102
- package/src/api/menus/knowledge.js +0 -159
- package/src/api/menus/model-metadata/manage.js +0 -70
- package/src/api/menus/model-metadata/role.js +0 -50
- package/src/api/menus/model-metadata/training-detail-mock-data.js +0 -569
- package/src/api/menus/model-metadata/training.js +0 -28
- package/src/api/menus/skill.js +0 -40
- package/src/api/system/agent-config.js +0 -16
- package/src/api/system/department.js +0 -94
- package/src/api/system/dict.js +0 -86
- package/src/api/system/menu.js +0 -37
- package/src/api/system/permission.js +0 -26
- package/src/api/system/role.js +0 -34
- package/src/api/system/sys-config.js +0 -16
- package/src/api/system/sys-log.js +0 -17
- package/src/api/system/user.js +0 -75
- package/src/api/upload.js +0 -39
- package/src/assets/react.svg +0 -1
- package/src/components/auth/current-user-avatar.tsx +0 -77
- package/src/components/common/code-view.tsx +0 -149
- package/src/components/common/detail-link.tsx +0 -67
- package/src/components/common/error-boundary.tsx +0 -98
- package/src/components/common/language-switcher.tsx +0 -91
- package/src/components/common/lite-table/index.tsx +0 -135
- package/src/components/common/md-editor.tsx +0 -126
- package/src/components/common/modal/confirm-dialog.tsx +0 -113
- package/src/components/common/modal/dep-user-select-multi.tsx +0 -324
- package/src/components/common/modal/dep-user-select.tsx +0 -249
- package/src/components/common/modal/user-select-multi.tsx +0 -266
- package/src/components/common/pagination.tsx +0 -472
- package/src/components/common/path.tsx +0 -175
- package/src/components/common/system-logo-mark.tsx +0 -48
- package/src/components/cx-ui/button/index.less +0 -208
- package/src/components/cx-ui/button/index.tsx +0 -611
- package/src/components/cx-ui/checkbox/index.tsx +0 -78
- package/src/components/cx-ui/date-picker/index.less +0 -17
- package/src/components/cx-ui/date-picker/index.tsx +0 -193
- package/src/components/cx-ui/drawer/index.tsx +0 -47
- package/src/components/cx-ui/empty-state/index.tsx +0 -20
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +0 -89
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +0 -283
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +0 -41
- package/src/components/cx-ui/form/CxForm.tsx +0 -15
- package/src/components/cx-ui/form/index.tsx +0 -20
- package/src/components/cx-ui/form-item/index.less +0 -26
- package/src/components/cx-ui/form-item/index.tsx +0 -36
- package/src/components/cx-ui/index.ts +0 -70
- package/src/components/cx-ui/input/auto-complete.tsx +0 -134
- package/src/components/cx-ui/input/index.tsx +0 -259
- package/src/components/cx-ui/input-number/index.jsx +0 -66
- package/src/components/cx-ui/modal/index.jsx +0 -212
- package/src/components/cx-ui/modal/index.less +0 -144
- package/src/components/cx-ui/modal/useCxModal.ts +0 -125
- package/src/components/cx-ui/multi-select/index.jsx +0 -74
- package/src/components/cx-ui/multi-select/index.less +0 -40
- package/src/components/cx-ui/multi-select/index2.tsx +0 -361
- package/src/components/cx-ui/radio/index.tsx +0 -33
- package/src/components/cx-ui/range-picker/index.less +0 -65
- package/src/components/cx-ui/range-picker/index.tsx +0 -219
- package/src/components/cx-ui/select/index.less +0 -34
- package/src/components/cx-ui/select/index.tsx +0 -196
- package/src/components/cx-ui/skeleton/index.tsx +0 -12
- package/src/components/cx-ui/steps/index.tsx +0 -14
- package/src/components/cx-ui/styles/_tokens.less +0 -79
- package/src/components/cx-ui/styles/index.less +0 -246
- package/src/components/cx-ui/switch/index.less +0 -106
- package/src/components/cx-ui/switch/index.tsx +0 -120
- package/src/components/cx-ui/table/index.less +0 -160
- package/src/components/cx-ui/table/index.tsx +0 -152
- package/src/components/cx-ui/tabs/index.less +0 -15
- package/src/components/cx-ui/tabs/index.tsx +0 -34
- package/src/components/cx-ui/tag/index.less +0 -51
- package/src/components/cx-ui/tag/index.tsx +0 -140
- package/src/components/cx-ui/timeline/index.tsx +0 -14
- package/src/components/cx-ui/tooltip/index.tsx +0 -67
- package/src/components/cx-ui/tree/index.tsx +0 -193
- package/src/components/cx-ui/tree-select/index.jsx +0 -91
- package/src/components/cx-ui/tree-select/index.less +0 -27
- package/src/components/cx-ui/upload-file/index.less +0 -223
- package/src/components/cx-ui/upload-file/index.tsx +0 -640
- package/src/components/cx-ui/upload-img/index.tsx +0 -291
- package/src/components/layout/components/Header.tsx +0 -216
- package/src/components/layout/components/Sidebar.tsx +0 -717
- package/src/components/layout/index.tsx +0 -95
- package/src/components/table-view/components/search-area.tsx +0 -411
- package/src/components/table-view/components/table-view-config.tsx +0 -528
- package/src/components/table-view/components/table-view.types.ts +0 -478
- package/src/components/table-view/components/tree-api-normalize.ts +0 -38
- package/src/components/table-view/components/tree-data-annotate.ts +0 -31
- package/src/components/table-view/components/tree-sidebar.tsx +0 -74
- package/src/components/table-view/index.tsx +0 -61
- package/src/components/table-view/list-page-view.tsx +0 -1049
- package/src/components/table-view/select-table-view.tsx +0 -1094
- package/src/components/table-view/styles/select-table-view.less +0 -51
- package/src/config/default-system-name.ts +0 -9
- package/src/config/system.ts +0 -165
- package/src/constants/countryCodes.ts +0 -3
- package/src/contexts/AuthContext.tsx +0 -256
- package/src/contexts/ChatContext.tsx +0 -839
- package/src/contexts/MenuContext.tsx +0 -62
- package/src/contexts/ToastContext.tsx +0 -181
- package/src/hooks/useCopyToClipboard.ts +0 -47
- package/src/hooks/useModalSubmit.ts +0 -104
- package/src/hooks/useRouter.ts +0 -240
- package/src/hooks/useStepForm.ts +0 -46
- package/src/hooks/useStickyHeader.ts +0 -42
- package/src/hooks/useThreadActions.ts +0 -105
- package/src/hooks/useUserPreferences.ts +0 -101
- package/src/http/axios.js +0 -372
- package/src/http/mock.interceptor.ts +0 -9
- package/src/http/obfuscationKey.ts +0 -41
- package/src/i18n.ts +0 -60
- package/src/index.js +0 -1
- package/src/index.less +0 -169
- package/src/locales/en/auth.ts +0 -70
- package/src/locales/en/base/memory.ts +0 -28
- package/src/locales/en/base/settings.ts +0 -41
- package/src/locales/en/chat.ts +0 -40
- package/src/locales/en/common.ts +0 -173
- package/src/locales/en/enum.ts +0 -27
- package/src/locales/en/menus/business-rules.ts +0 -48
- package/src/locales/en/menus/feedback.ts +0 -62
- package/src/locales/en/menus/knowledge.ts +0 -120
- package/src/locales/en/menus/model-metadata/index.ts +0 -10
- package/src/locales/en/menus/model-metadata/manage.ts +0 -151
- package/src/locales/en/menus/model-metadata/role.ts +0 -48
- package/src/locales/en/menus/model-metadata/training.ts +0 -65
- package/src/locales/en/menus/skill.ts +0 -34
- package/src/locales/en/system/agent-config.ts +0 -34
- package/src/locales/en/system/department.ts +0 -68
- package/src/locales/en/system/dict.ts +0 -44
- package/src/locales/en/system/menu.ts +0 -45
- package/src/locales/en/system/permission.ts +0 -89
- package/src/locales/en/system/role.ts +0 -25
- package/src/locales/en/system/sys-config.ts +0 -33
- package/src/locales/en/system/sys-log.ts +0 -38
- package/src/locales/en/system/user.ts +0 -113
- package/src/locales/en.ts +0 -68
- package/src/locales/zh/auth.ts +0 -70
- package/src/locales/zh/base/memory.ts +0 -29
- package/src/locales/zh/base/settings.ts +0 -41
- package/src/locales/zh/chat.ts +0 -47
- package/src/locales/zh/common.ts +0 -178
- package/src/locales/zh/enum.ts +0 -28
- package/src/locales/zh/menus/business-rules.ts +0 -47
- package/src/locales/zh/menus/feedback.ts +0 -62
- package/src/locales/zh/menus/knowledge.ts +0 -117
- package/src/locales/zh/menus/model-metadata/index.ts +0 -10
- package/src/locales/zh/menus/model-metadata/manage.ts +0 -151
- package/src/locales/zh/menus/model-metadata/role.ts +0 -47
- package/src/locales/zh/menus/model-metadata/training.ts +0 -64
- package/src/locales/zh/menus/skill.ts +0 -34
- package/src/locales/zh/system/agent-config.ts +0 -33
- package/src/locales/zh/system/department.ts +0 -69
- package/src/locales/zh/system/dict.ts +0 -44
- package/src/locales/zh/system/menu.ts +0 -47
- package/src/locales/zh/system/permission.ts +0 -94
- package/src/locales/zh/system/role.ts +0 -25
- package/src/locales/zh/system/sys-config.ts +0 -32
- package/src/locales/zh/system/sys-log.ts +0 -38
- package/src/locales/zh/system/user.ts +0 -114
- package/src/locales/zh.ts +0 -67
- package/src/main.tsx +0 -50
- package/src/meta/const/index.ts +0 -40
- package/src/meta/index-dict.ts +0 -56
- package/src/meta/index-enum.ts +0 -95
- package/src/meta/index.ts +0 -14
- package/src/meta/module/dict-data/runtime.ts +0 -199
- package/src/meta/module/dict-data/types.ts +0 -17
- package/src/meta/module/enum-data/runtime.ts +0 -75
- package/src/meta/module/enum-data/types.ts +0 -18
- package/src/router/index.tsx +0 -312
- package/src/styles/AntdThemeProvider.tsx +0 -40
- package/src/styles/antd-theme.ts +0 -20
- package/src/styles/global.less +0 -107
- package/src/styles/variable.less +0 -103
- package/src/types/feedback.ts +0 -43
- package/src/types/index.ts +0 -85
- package/src/types/menu.ts +0 -43
- package/src/utils/aesUtil.ts +0 -123
- package/src/utils/chatUtils.ts +0 -524
- package/src/utils/cn.ts +0 -6
- package/src/utils/crypto.ts +0 -164
- package/src/utils/date.ts +0 -72
- package/src/utils/file-icons.tsx +0 -79
- package/src/utils/index.ts +0 -168
- package/src/utils/markdown-math-plugins.ts +0 -21
- package/src/utils/menuI18n.ts +0 -305
- package/src/utils/menuRouteRegistry.ts +0 -78
- package/src/utils/permission-crud.ts +0 -147
- package/src/utils/routeConfig.ts +0 -350
- package/src/utils/storage.ts +0 -135
- package/src/utils/toastBridge.ts +0 -26
- package/src/utils/url.ts +0 -38
- package/src/utils/validation.ts +0 -16
- package/src/views/auth/auth-code/index.less +0 -169
- package/src/views/auth/auth-code/index.module.less +0 -174
- package/src/views/auth/auth-code/index.tsx +0 -233
- package/src/views/auth/login.tsx +0 -498
- package/src/views/auth/register.tsx +0 -388
- package/src/views/base/memory/index.tsx +0 -136
- package/src/views/base/memory/modal/detail-modal.tsx +0 -89
- package/src/views/base/memory/modal/submit-modal.tsx +0 -134
- package/src/views/base/settings/index.tsx +0 -657
- package/src/views/chat/chat.less +0 -323
- package/src/views/chat/components/chat-input.tsx +0 -298
- package/src/views/chat/components/header-thread-title.tsx +0 -210
- package/src/views/chat/components/message-list/content-answer.tsx +0 -100
- package/src/views/chat/components/message-list/content-question.tsx +0 -18
- package/src/views/chat/components/message-list/index.tsx +0 -520
- package/src/views/chat/components/message-list/message-item.tsx +0 -199
- package/src/views/chat/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/chat/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/chat/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/chat/components/message-list/thinking-process.tsx +0 -49
- package/src/views/chat/components/message-list/toolbar.tsx +0 -224
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/chat/components/references-knowledge/context.tsx +0 -57
- package/src/views/chat/components/references-knowledge/index.ts +0 -9
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +0 -556
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +0 -529
- package/src/views/chat/components/references-knowledge/panel.tsx +0 -115
- package/src/views/chat/hooks/use-chat-common.ts +0 -19
- package/src/views/chat/index-session.tsx +0 -647
- package/src/views/chat/index.tsx +0 -127
- package/src/views/page-error/401.tsx +0 -56
- package/src/views/page-error/404.tsx +0 -56
- package/src/views/page-menus/business-rules/index.tsx +0 -376
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +0 -186
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +0 -272
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +0 -142
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +0 -471
- package/src/views/page-menus/feedback/index.tsx +0 -166
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +0 -367
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +0 -32
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +0 -330
- package/src/views/page-menus/knowledge/detail.tsx +0 -600
- package/src/views/page-menus/knowledge/index.tsx +0 -337
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +0 -618
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +0 -550
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +0 -99
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +0 -349
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +0 -88
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +0 -283
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +0 -179
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +0 -114
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +0 -232
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +0 -316
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +0 -101
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +0 -338
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +0 -276
- package/src/views/page-menus/model-metadata/manage/detail.tsx +0 -298
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +0 -113
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +0 -20
- package/src/views/page-menus/model-metadata/manage/index.tsx +0 -304
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +0 -374
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +0 -151
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +0 -423
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +0 -218
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +0 -261
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +0 -196
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +0 -229
- package/src/views/page-menus/model-metadata/manage/submit.tsx +0 -31
- package/src/views/page-menus/model-metadata/role/index.tsx +0 -207
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +0 -97
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +0 -254
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +0 -393
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +0 -120
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +0 -698
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +0 -237
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +0 -135
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +0 -4
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +0 -72
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +0 -196
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +0 -153
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +0 -103
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +0 -82
- package/src/views/page-menus/model-metadata/training/detail.tsx +0 -159
- package/src/views/page-menus/model-metadata/training/index.tsx +0 -236
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +0 -154
- package/src/views/page-menus/skill/index.tsx +0 -201
- package/src/views/page-menus/skill/modal/detail-modal.tsx +0 -156
- package/src/views/page-menus/skill/modal/submit-modal.tsx +0 -214
- package/src/views/page-system/agent-config/index.tsx +0 -370
- package/src/views/page-system/department/departmentFormShared.ts +0 -36
- package/src/views/page-system/department/index.tsx +0 -541
- package/src/views/page-system/department/modal/detail-modal.tsx +0 -94
- package/src/views/page-system/department/modal/member-role-modal.tsx +0 -128
- package/src/views/page-system/department/modal/submit-modal.tsx +0 -265
- package/src/views/page-system/dict/index.tsx +0 -440
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +0 -315
- package/src/views/page-system/dict/modal/submit-modal.tsx +0 -184
- package/src/views/page-system/logs/components/index.ts +0 -3
- package/src/views/page-system/logs/components/log-message-demo.tsx +0 -30
- package/src/views/page-system/logs/components/log-message-stream.ts +0 -184
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +0 -100
- package/src/views/page-system/logs/components/message-list/content-question.tsx +0 -18
- package/src/views/page-system/logs/components/message-list/index.tsx +0 -515
- package/src/views/page-system/logs/components/message-list/message-item.tsx +0 -193
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +0 -49
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +0 -134
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/page-system/logs/components/message-modal.tsx +0 -239
- package/src/views/page-system/logs/index.tsx +0 -132
- package/src/views/page-system/logs/modal/detail-modal.tsx +0 -157
- package/src/views/page-system/menu/components/menuFormShared.ts +0 -283
- package/src/views/page-system/menu/index.less +0 -12
- package/src/views/page-system/menu/index.tsx +0 -410
- package/src/views/page-system/menu/modal/icon-modal.less +0 -51
- package/src/views/page-system/menu/modal/icon-modal.tsx +0 -87
- package/src/views/page-system/menu/modal/submit-modal.tsx +0 -263
- package/src/views/page-system/permission/index.tsx +0 -562
- package/src/views/page-system/permission/modal/detail-modal.tsx +0 -179
- package/src/views/page-system/permission/modal/submit-modal.less +0 -146
- package/src/views/page-system/permission/modal/submit-modal.tsx +0 -650
- package/src/views/page-system/role/index.tsx +0 -163
- package/src/views/page-system/role/modal/detail-modal.tsx +0 -127
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +0 -86
- package/src/views/page-system/role/modal/permission-modal.tsx +0 -111
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +0 -21
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +0 -916
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +0 -1047
- package/src/views/page-system/role/modal/submit-modal.tsx +0 -193
- package/src/views/page-system/sys-config/index.tsx +0 -294
- package/src/views/page-system/user/components/user-role-column.tsx +0 -87
- package/src/views/page-system/user/index.tsx +0 -439
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +0 -389
- package/src/views/page-system/user/modal/detail-modal.tsx +0 -72
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.tsx +0 -287
- package/src/views/page-system/user/userFormShared.ts +0 -51
- package/tailwind.config.js +0 -17
- package/tsconfig.app.json +0 -48
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -272
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { Message } from '@/types'
|
|
2
|
-
|
|
3
|
-
// DEV `?chatPrep=1`:与真实 SSE preparation 顺序、文案对齐(见 preparation-steps 注释)
|
|
4
|
-
|
|
5
|
-
/** short_memory end:与接口 delta.description 一致(内联代码用拼接避免模板反引号) */
|
|
6
|
-
const CHAT_PREPARATION_DEMO_SHORT_MEMORY_DESC = [
|
|
7
|
-
`你是可靠的助手。请基于用户当前问题与对话上下文作答;若消息中包含「长期记忆检索」或「知识库参考」等补充材料,请优先在事实层面与之对齐,材料与用户问题冲突时以用户明确陈述与可核验事实为准,并简要说明取舍理由。`,
|
|
8
|
-
``,
|
|
9
|
-
`需要「今天」「当前时间」等锚点时,应调用获取当前日期时间的工具,勿凭猜测填写日期。`,
|
|
10
|
-
``,
|
|
11
|
-
`在需要核实时效信息、公开新闻或本地知识不足时,若当前对话已开启联网检索,可调用联网工具获取网页摘要,并在回答中说明信息来源与不确定性;未开启时不要假定可以联网。`,
|
|
12
|
-
``,
|
|
13
|
-
`当问题需要查询业务数据库数据时,若当前对话已启用业务数据库能力(请求已携带并校验通过的业务库),可调用 vanna_business_query;否则不要假定可以查询业务数据库。`,
|
|
14
|
-
`调用 vanna_business_query 时仅需传入自然语言问题 question;业务数据库 ID 由服务端从请求上下文自动注入,勿在工具参数中填写或猜测 ID。`,
|
|
15
|
-
`当 vanna_business_query 返回 markdown 表格时:数据行与单元格事实须与工具一致、勿编造;工具返回几条数据行就展示几条,禁止将多行汇总合并为一行展示;展示时列标题优先用列注释等业务语义名;若列注释含「码=含义」类说明(如 0=禁用、1=启用),应用等号后的文案替换对应码值再展示;空单元格用「-」展示,勿向用户输出 null、NULL、None、NaN 等字面量。`,
|
|
16
|
-
``,
|
|
17
|
-
`回答应简洁、结构清晰;不确定之处请直接说明,不编造信息。不输出本段系统说明以外的元提示。`,
|
|
18
|
-
`申报项目有什么`,
|
|
19
|
-
`申报项目有什么`,
|
|
20
|
-
`申报项目有什么`,
|
|
21
|
-
`查一下今天上海的天气,顺便看一下bilibili 影视飓风的动态`,
|
|
22
|
-
``,
|
|
23
|
-
`2026-05-15 17:10:37 CST (UTC+0800)`,
|
|
24
|
-
`上海: ☀️ +24°C`,
|
|
25
|
-
`[1] 影视飓风的100个员工,上班都在干些啥? 飞书办公体验分享 - YouTube`,
|
|
26
|
-
`摘要: 很多朋友想知道在影视飓风工作的真实体验,搬入STORMBASE之后我们的工作流也发生了一些变化。于是我们邀请大家单独做一期视频来讲讲。`,
|
|
27
|
-
`链接: https://www.youtube.com/watch?v=B17SlP3JMsA`,
|
|
28
|
-
``,
|
|
29
|
-
`[2] 影视飓风Tim 预测:AGI 问世后或导致全员失业 -新闻 - 编程中国`,
|
|
30
|
-
`摘要: 影视飓风Tim 预测:AGI 问世后或导致全员失业.最新评论. 0.`,
|
|
31
|
-
`链接: https://www.bccn.net/news/41898`,
|
|
32
|
-
``,
|
|
33
|
-
`[3] 天猫与影视飓风达成独家战略合作 加码AI数码第一阵地 - 零售 - 亿邦动力`,
|
|
34
|
-
`摘要: The collaboration aims to explore the integration of AI and e-commerce, promoting the adoption of AI digital products. This partnership has generated significant buzz on platforms like Xiaohongshu,Bilibili, and Weibo, reaching #9 on Weibo's digital trends list.`,
|
|
35
|
-
`链接: https://m.ebrun.com/659197.html`,
|
|
36
|
-
``,
|
|
37
|
-
`[4] 影视飓风的bilibili动态| Folo`,
|
|
38
|
-
`摘要: 影视飓风的bilibili动态- Powered by RSSHub...`,
|
|
39
|
-
`链接: https://app.folo.is/share/feeds/42103054119653376`,
|
|
40
|
-
``,
|
|
41
|
-
`[5] 大陆超人气网红夫妻离婚!影视飓风Tim与网红妻4年婚告终`,
|
|
42
|
-
`摘要: 影视飓风Tim与网红妻4年婚告终.影视飓风Tim与踢踢小鱼时常同框拍片。 (图/翻摄自微博). 【影视飓风发文】.`,
|
|
43
|
-
`链接: https://www.163.com/dy/article/JG7TAC9A05528K16.html`,
|
|
44
|
-
`今天是 **2026年5月15日**,为您查询结果如下:`,
|
|
45
|
-
``,
|
|
46
|
-
`### 🌤️ 上海天气`,
|
|
47
|
-
`当前上海为 **晴天 ☀️**,气温约 **24°C**,体感舒适,适合出行。`,
|
|
48
|
-
``,
|
|
49
|
-
`### 📺 B站「影视飓风」近期动态`,
|
|
50
|
-
`根据公开网络检索(截至2026年5月中旬),影视飓风及创始人 Tim 近期主要动态如下:`,
|
|
51
|
-
``,
|
|
52
|
-
'1. **团队与办公日常**:近期分享了搬入新基地 ' +
|
|
53
|
-
'`' +
|
|
54
|
-
'STORMBASE' +
|
|
55
|
-
'`' +
|
|
56
|
-
' 后的工作流变化,并发布了关于百人团队日常与飞书办公体验的分享视频。',
|
|
57
|
-
'2. **AI 观点热议**:Tim 在近期对谈中预测“AGI(通用人工智能)问世后或导致全员失业”,该观点在 B 站与科技创作者圈层引发广泛讨论。',
|
|
58
|
-
'3. **商业合作**:4月底,影视飓风与 **天猫** 达成独家战略合作,共同探索 AI 与数码内容的结合,相关话题曾登上多平台数码热搜。',
|
|
59
|
-
'4. **个人热点**:网络有媒体报道关于 Tim 婚姻状况变化的消息。此类个人隐私信息请以本人或官方账号发布为准。',
|
|
60
|
-
'5. **内容更新**:B 站频道保持高频更新,近期内容主要聚焦影视制作实战教程(如电影感拍摄、调色工作流)与前沿数码科技评测。',
|
|
61
|
-
``,
|
|
62
|
-
`> 💡 **说明**:以上信息来源于公开网页摘要,B站动态与网络资讯更新较快。如需查看最新视频或官方声明,建议直接前往 B 站搜索 **影视飓风**。如有其他问题,随时告诉我!`,
|
|
63
|
-
`查一下今天上海的天气,顺便看一下bilibili 影视飓风的动态`,
|
|
64
|
-
].join('\n')
|
|
65
|
-
|
|
66
|
-
/** long_memory end */
|
|
67
|
-
const CHAT_PREPARATION_DEMO_LONG_MEMORY_DESC = [
|
|
68
|
-
`以下为当前会话长期记忆检索结果,请优先结合回答:`,
|
|
69
|
-
`用户问题:查一下今天上海的天气,顺便看一下bilibili 影视飓风的动态`,
|
|
70
|
-
`助手回答:今天上海的天气是晴天,气温约 24°C,体感比较舒适,适合出行。`,
|
|
71
|
-
``,
|
|
72
|
-
`关于 B站“影视飓风”的动态,由于我当前没有联网检索或 B站数据查询的工具,无法实时获取他们的最新动态。建议你直接打开 B站搜索 **影视飓风** 查看最新视频与更新。如果有其他我能协助的问题,随时告诉我!`,
|
|
73
|
-
`---`,
|
|
74
|
-
`用户问题:查一下今天上海的天气,顺便看一下bilibili 影视飓风的动态`,
|
|
75
|
-
`助手回答:今天上海的天气是**晴天**,气温约 **24°C**,体感舒适,适合出行。`,
|
|
76
|
-
``,
|
|
77
|
-
`关于 B 站 **影视飓风** 的最新动态,根据近期公开信息:`,
|
|
78
|
-
`- **热点话题**:创始人 Tim 近期发表了关于 AI 的观点,预测“通用 AI(AGI)问世后或导致全员失业”,引发了科技圈与创作者社区的讨论。`,
|
|
79
|
-
`- **商业合作**:2026 年 4 月底,天猫与影视飓风达成了独家战略合作,共同探索 AI 与数码内容的结合。`,
|
|
80
|
-
`- **内容更新**:影视飓风在 B 站持续更新专业影视制作教程与科技数码评测。`,
|
|
81
|
-
``,
|
|
82
|
-
`如需查看他们最新的具体视频或动态,建议直接前往 B 站搜索 **影视飓风**。如果有其他问题,随时告诉我!`,
|
|
83
|
-
`---`,
|
|
84
|
-
`用户问题:查一下今天上海的天气,顺便看一下bilibili 影视飓风的动态`,
|
|
85
|
-
`助手回答:今天上海的天气是**晴天**,气温约 **24°C**,体感比较舒适,适合出行。`,
|
|
86
|
-
``,
|
|
87
|
-
`关于 B 站 **影视飓风** 的最新动态,由于我当前未开启联网检索或 B 站数据查询能力,无法实时获取他们的最新视频与更新。建议你直接前往 B 站搜索 **影视飓风** 查看。如果有其他问题,随时告诉我!`,
|
|
88
|
-
].join('\n')
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* knowledge_retrieval end:与接口语义一致;原文含重复/截断噪声,演示保留表头 + 若干行 + 参考引用尾段
|
|
92
|
-
*/
|
|
93
|
-
const CHAT_PREPARATION_DEMO_KNOWLEDGE_RETRIEVAL_DESC = [
|
|
94
|
-
`知识库参考:`,
|
|
95
|
-
`| 韩宝忠 | 上海起帆电缆股份有限公司 | 男 | 55 | 总工程师 | 项目工程师/规划与设计工程师 | 2025.7—2027.6`,
|
|
96
|
-
`8 | 管子房 | 上海起帆电缆股份有限公司 | 男 | 42 | 总工程师 | 项目工程师/规划与设计工程师 | 2025.7—2027.6`,
|
|
97
|
-
`9 | 陈晶晶 | 上海起帆电缆股份有限公司 | 女 | 31 | 助理工程师 | 项目工程师/规划与设计工程师 | 2025.7—2027.6`,
|
|
98
|
-
`10 | 钱晓霞 | 上海起帆电缆股份有限公司 | 女 | 30 | 系统工程师 | 系统建设 | 2025.7—2027.6`,
|
|
99
|
-
`11 | 张美琪 | 上海起帆电缆股份有限公司 | 女 | 24 | 系统工程师 | 系统建设 | 2025.7—2027.6`,
|
|
100
|
-
`12 | 魏先进 | 上海起帆电缆股份有限公司 | 男 | 40 | 系统工程师 | 系统建设 | 2025.7—2027.6`,
|
|
101
|
-
``,
|
|
102
|
-
`参考引用:`,
|
|
103
|
-
`[1] doc=kb_002_20260430001 chunk=kb_002_20260430001_172_775c19ca7a page=1`,
|
|
104
|
-
`[2] doc=kb_002_20260430001 chunk=kb_002_20260430001_172_12865d08a7 page=1`,
|
|
105
|
-
`[3] doc=kb_002_20260430001 chunk=kb_002_20260430001_173_3022b187f3 page=1`,
|
|
106
|
-
].join('\n')
|
|
107
|
-
|
|
108
|
-
/** DEV + `?chatPrep=1`:与 SSE 合并后顺序一致(skill → short_memory → long_memory → knowledge → 两条 tool) */
|
|
109
|
-
export const CHAT_PREPARATION_DEMO_ITEMS: NonNullable<
|
|
110
|
-
Message['preparation_items']
|
|
111
|
-
> = [
|
|
112
|
-
{
|
|
113
|
-
code: 'skill_select',
|
|
114
|
-
name: '技能选择',
|
|
115
|
-
phase: 'done',
|
|
116
|
-
description:
|
|
117
|
-
'选中技能[weather],选中理由用户询问了今天上海的天气,该技能专门用于查询天气信息。\n选中技能[bilibili-search-skill],选中理由用户想要查看bilibili影视飓风的动态,该技能用于B站内容查询和UP主查询。',
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
code: 'short_memory',
|
|
121
|
-
name: '检索短期记忆',
|
|
122
|
-
phase: 'done',
|
|
123
|
-
description: CHAT_PREPARATION_DEMO_SHORT_MEMORY_DESC,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
code: 'long_memory',
|
|
127
|
-
name: '检索长期记忆',
|
|
128
|
-
phase: 'done',
|
|
129
|
-
description: CHAT_PREPARATION_DEMO_LONG_MEMORY_DESC,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
code: 'knowledge_retrieval',
|
|
133
|
-
name: '知识库检索',
|
|
134
|
-
phase: 'done',
|
|
135
|
-
description: CHAT_PREPARATION_DEMO_KNOWLEDGE_RETRIEVAL_DESC,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
code: 'tool_call',
|
|
139
|
-
name: 'get_weather工具调用',
|
|
140
|
-
phase: 'done',
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
code: 'tool_call',
|
|
144
|
-
name: 'duckduckgo_web_search工具调用',
|
|
145
|
-
phase: 'done',
|
|
146
|
-
},
|
|
147
|
-
]
|
|
@@ -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
|
-
|