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,471 +0,0 @@
|
|
|
1
|
-
import { approveFeedbackAPI, rejectFeedbackAPI, updateFeedbackAPI } from '@/api/menus/feedback'
|
|
2
|
-
import ConfirmDialog from '@/components/common/modal/confirm-dialog'
|
|
3
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
4
|
-
import { useToast } from '@/contexts/ToastContext'
|
|
5
|
-
import {
|
|
6
|
-
type FeedbackDatasetItem,
|
|
7
|
-
feedbackStatusI18nKey,
|
|
8
|
-
isFeedbackPending,
|
|
9
|
-
} from '@/types/feedback'
|
|
10
|
-
import { parseBackendDate } from '@/utils/date'
|
|
11
|
-
import {
|
|
12
|
-
markdownRehypePlugins,
|
|
13
|
-
markdownRemarkPlugins,
|
|
14
|
-
} from '@/utils/markdown-math-plugins'
|
|
15
|
-
import { useMutation } from '@tanstack/react-query'
|
|
16
|
-
import clsx from 'clsx'
|
|
17
|
-
import {
|
|
18
|
-
CheckCircle,
|
|
19
|
-
Edit3,
|
|
20
|
-
Loader2,
|
|
21
|
-
Save,
|
|
22
|
-
ThumbsDown,
|
|
23
|
-
ThumbsUp,
|
|
24
|
-
Trash2,
|
|
25
|
-
X,
|
|
26
|
-
XCircle,
|
|
27
|
-
} from 'lucide-react'
|
|
28
|
-
import { useEffect, useRef, useState } from 'react'
|
|
29
|
-
import { useTranslation } from 'react-i18next'
|
|
30
|
-
import type { Options as ReactMarkdownOptions } from 'react-markdown'
|
|
31
|
-
import ReactMarkdown from 'react-markdown'
|
|
32
|
-
|
|
33
|
-
export interface FeedbackDatasetListProps {
|
|
34
|
-
pageConfig: {
|
|
35
|
-
fetchTableData?: () => Promise<void>
|
|
36
|
-
onDelete?: (record: { id: string }) => void
|
|
37
|
-
}
|
|
38
|
-
tableData: FeedbackDatasetItem[]
|
|
39
|
-
loading: boolean
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function FeedbackDatasetList({
|
|
43
|
-
pageConfig,
|
|
44
|
-
tableData,
|
|
45
|
-
loading,
|
|
46
|
-
}: FeedbackDatasetListProps) {
|
|
47
|
-
const { t } = useTranslation()
|
|
48
|
-
const { showToast } = useToast()
|
|
49
|
-
const { hasPermission } = useAuth()
|
|
50
|
-
|
|
51
|
-
const listTopRef = useRef<HTMLDivElement>(null)
|
|
52
|
-
|
|
53
|
-
const [editingId, setEditingId] = useState<string | null>(null)
|
|
54
|
-
const [editPrompt, setEditPrompt] = useState('')
|
|
55
|
-
const [editCompletion, setEditCompletion] = useState('')
|
|
56
|
-
const [reviewConfirm, setReviewConfirm] = useState<{
|
|
57
|
-
open: boolean
|
|
58
|
-
id: string
|
|
59
|
-
action: 'approve' | 'reject'
|
|
60
|
-
}>({ open: false, id: '', action: 'approve' })
|
|
61
|
-
|
|
62
|
-
const updateMutation = useMutation({
|
|
63
|
-
mutationFn: async (vars: { id: string; data: any }) => {
|
|
64
|
-
const response = await updateFeedbackAPI(
|
|
65
|
-
{
|
|
66
|
-
id: vars.id,
|
|
67
|
-
question: vars.data.question,
|
|
68
|
-
answer: vars.data.answer,
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
// Axios 响应对象:response.data 是实际的响应数据
|
|
72
|
-
const responseData = response.data
|
|
73
|
-
// 检查业务逻辑是否成功
|
|
74
|
-
if (responseData && responseData.success === false) {
|
|
75
|
-
throw new Error(responseData.message || t('common.operation_failed'))
|
|
76
|
-
}
|
|
77
|
-
return responseData
|
|
78
|
-
},
|
|
79
|
-
onSuccess: (data, variables) => {
|
|
80
|
-
void pageConfig.fetchTableData?.()
|
|
81
|
-
setEditingId(null)
|
|
82
|
-
|
|
83
|
-
if (variables.data.question || variables.data.answer) {
|
|
84
|
-
showToast(t('common.saved'), 'success')
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
setTimeout(() => {
|
|
88
|
-
listTopRef.current?.scrollIntoView({
|
|
89
|
-
behavior: 'smooth',
|
|
90
|
-
block: 'start',
|
|
91
|
-
})
|
|
92
|
-
}, 100)
|
|
93
|
-
},
|
|
94
|
-
onError: (error: any) => {
|
|
95
|
-
console.error('更新失败:', error)
|
|
96
|
-
},
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
if (editingId) {
|
|
101
|
-
requestAnimationFrame(() => {
|
|
102
|
-
const element = document.getElementById(`feedback-item-${editingId}`)
|
|
103
|
-
element?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
}, [editingId])
|
|
107
|
-
|
|
108
|
-
const handleEdit = (item: FeedbackDatasetItem) => {
|
|
109
|
-
setEditingId(item.id)
|
|
110
|
-
setEditPrompt(item.question)
|
|
111
|
-
setEditCompletion(item.answer)
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const handleCancelEdit = () => {
|
|
115
|
-
setEditingId(null)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const handleSave = (id: string) => {
|
|
119
|
-
updateMutation.mutate({
|
|
120
|
-
id,
|
|
121
|
-
data: {
|
|
122
|
-
question: editPrompt,
|
|
123
|
-
answer: editCompletion,
|
|
124
|
-
},
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/** 调用审核通过或拒绝接口(需在确认框 onOk 中执行) */
|
|
129
|
-
const submitReview = async (id: string, action: 'approve' | 'reject') => {
|
|
130
|
-
const response =
|
|
131
|
-
action === 'approve'
|
|
132
|
-
? await approveFeedbackAPI(id)
|
|
133
|
-
: await rejectFeedbackAPI(id)
|
|
134
|
-
const responseData = response.data
|
|
135
|
-
if (responseData && responseData.success === false) {
|
|
136
|
-
throw new Error(responseData.message || t('common.operation_failed'))
|
|
137
|
-
}
|
|
138
|
-
showToast(
|
|
139
|
-
action === 'approve'
|
|
140
|
-
? t('menus.feedback.toast.approved')
|
|
141
|
-
: t('menus.feedback.toast.rejected'),
|
|
142
|
-
'success',
|
|
143
|
-
)
|
|
144
|
-
void pageConfig.fetchTableData?.()
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
listTopRef.current?.scrollIntoView({
|
|
147
|
-
behavior: 'smooth',
|
|
148
|
-
block: 'start',
|
|
149
|
-
})
|
|
150
|
-
}, 100)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** 打开审核确认弹框(与删除确认同款 ConfirmDialog) */
|
|
154
|
-
const openReviewConfirm = (id: string, action: 'approve' | 'reject') => {
|
|
155
|
-
setReviewConfirm({ open: true, id, action })
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** 关闭审核确认弹框 */
|
|
159
|
-
const closeReviewConfirm = () => {
|
|
160
|
-
setReviewConfirm((prev) => ({ ...prev, open: false }))
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** 确认审核:调用接口后关闭弹框 */
|
|
164
|
-
const confirmReview = async () => {
|
|
165
|
-
try {
|
|
166
|
-
await submitReview(reviewConfirm.id, reviewConfirm.action)
|
|
167
|
-
closeReviewConfirm()
|
|
168
|
-
} catch (err) {
|
|
169
|
-
console.log(err instanceof Error ? err.message : String(err))
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (loading && (!tableData || tableData.length === 0)) {
|
|
174
|
-
return (
|
|
175
|
-
<div className="flex flex-col justify-center items-center h-64">
|
|
176
|
-
<Loader2 className="animate-spin h-8 w-8 text-blue-600 mb-2" />
|
|
177
|
-
<p>{t('common.loading')}</p>
|
|
178
|
-
</div>
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const feedbackList = tableData || []
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<>
|
|
186
|
-
<div className="space-y-6 scroll-mt-24" ref={listTopRef}>
|
|
187
|
-
{feedbackList.length === 0 ? (
|
|
188
|
-
<div className="text-center py-12 bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700">
|
|
189
|
-
<p className="text-gray-500 dark:text-gray-400">
|
|
190
|
-
{t('menus.feedback.no_records')}
|
|
191
|
-
</p>
|
|
192
|
-
</div>
|
|
193
|
-
) : (
|
|
194
|
-
feedbackList.map((item) => {
|
|
195
|
-
const isEditing = editingId === item.id
|
|
196
|
-
const statusKey = feedbackStatusI18nKey(item.status)
|
|
197
|
-
return (
|
|
198
|
-
<div
|
|
199
|
-
key={item.id}
|
|
200
|
-
id={`feedback-item-${item.id}`}
|
|
201
|
-
className="group bg-white dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm overflow-hidden flex flex-col">
|
|
202
|
-
<div className="px-6 py-4 border-b border-gray-100 dark:border-gray-700 flex justify-between items-center bg-gray-50/50 dark:bg-gray-800/50">
|
|
203
|
-
<div className="flex items-center gap-3 flex-wrap">
|
|
204
|
-
<span
|
|
205
|
-
className={clsx(
|
|
206
|
-
'px-2.5 py-1 rounded-full text-xs font-bold uppercase tracking-wide',
|
|
207
|
-
statusKey === 'pending' &&
|
|
208
|
-
'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-200',
|
|
209
|
-
statusKey === 'approved' &&
|
|
210
|
-
'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-200',
|
|
211
|
-
statusKey === 'rejected' &&
|
|
212
|
-
'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-200',
|
|
213
|
-
)}>
|
|
214
|
-
{t(`menus.feedback.status.${statusKey}`)}
|
|
215
|
-
</span>
|
|
216
|
-
{item.evaluationType === 10 && (
|
|
217
|
-
<span className="flex items-center gap-1 text-xs font-medium text-green-600 dark:text-green-400">
|
|
218
|
-
<ThumbsUp size={14} /> {t('menus.feedback.like')}
|
|
219
|
-
</span>
|
|
220
|
-
)}
|
|
221
|
-
{item.evaluationType === 20 && (
|
|
222
|
-
<span className="flex items-center gap-1 text-xs font-medium text-red-600 dark:text-red-400">
|
|
223
|
-
<ThumbsDown size={14} /> {t('menus.feedback.dislike')}
|
|
224
|
-
</span>
|
|
225
|
-
)}
|
|
226
|
-
|
|
227
|
-
<span className="text-xs text-gray-400 ml-2">
|
|
228
|
-
{t('menus.feedback.submitted_at')}:{' '}
|
|
229
|
-
{parseBackendDate(item.createTime)?.format('yyyy-MM-dd hh:mm:ss') ??
|
|
230
|
-
item.createTime}
|
|
231
|
-
</span>
|
|
232
|
-
</div>
|
|
233
|
-
|
|
234
|
-
{(item.reviewBy || item.reviewTime) && (
|
|
235
|
-
<div className="text-xs text-gray-500 flex items-center gap-2 shrink-0">
|
|
236
|
-
{item.reviewBy && (
|
|
237
|
-
<span>
|
|
238
|
-
{t('menus.feedback.reviewed_by', {
|
|
239
|
-
name: item.reviewBy,
|
|
240
|
-
})}
|
|
241
|
-
</span>
|
|
242
|
-
)}
|
|
243
|
-
{item.reviewTime && (
|
|
244
|
-
<span className="text-gray-400">
|
|
245
|
-
(
|
|
246
|
-
{parseBackendDate(item.reviewTime)?.format(
|
|
247
|
-
'yyyy-MM-dd hh:mm:ss',
|
|
248
|
-
) ?? item.reviewTime}
|
|
249
|
-
)
|
|
250
|
-
</span>
|
|
251
|
-
)}
|
|
252
|
-
</div>
|
|
253
|
-
)}
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
<div className="divide-y divide-gray-100 dark:divide-gray-700 flex-1">
|
|
257
|
-
<div className="p-6 bg-gray-50/30 dark:bg-gray-800/20">
|
|
258
|
-
<div className="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-2">
|
|
259
|
-
{t('menus.feedback.user_input')}
|
|
260
|
-
</div>
|
|
261
|
-
{isEditing ? (
|
|
262
|
-
<textarea
|
|
263
|
-
autoFocus
|
|
264
|
-
value={editPrompt}
|
|
265
|
-
onChange={(e) => setEditPrompt(e.target.value)}
|
|
266
|
-
className="w-full h-32 p-3 text-sm bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none font-mono text-gray-800 dark:text-gray-100"
|
|
267
|
-
/>
|
|
268
|
-
) : (
|
|
269
|
-
<div className="prose dark:prose-invert prose-sm max-w-none text-gray-800 dark:text-gray-200 break-words">
|
|
270
|
-
<ReactMarkdown
|
|
271
|
-
remarkPlugins={markdownRemarkPlugins}
|
|
272
|
-
rehypePlugins={markdownRehypePlugins}
|
|
273
|
-
components={{
|
|
274
|
-
table: ({ ...props }) => (
|
|
275
|
-
<table
|
|
276
|
-
className="min-w-full divide-y divide-gray-200 dark:divide-gray-700 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"
|
|
277
|
-
{...props}
|
|
278
|
-
/>
|
|
279
|
-
),
|
|
280
|
-
thead: ({ ...props }) => (
|
|
281
|
-
<thead
|
|
282
|
-
className="bg-gray-50 dark:bg-gray-800"
|
|
283
|
-
{...props}
|
|
284
|
-
/>
|
|
285
|
-
),
|
|
286
|
-
tbody: ({ ...props }) => (
|
|
287
|
-
<tbody
|
|
288
|
-
className="divide-y divide-gray-200 dark:divide-gray-700 bg-white dark:bg-gray-900"
|
|
289
|
-
{...props}
|
|
290
|
-
/>
|
|
291
|
-
),
|
|
292
|
-
tr: ({ ...props }) => <tr {...props} />,
|
|
293
|
-
th: ({ ...props }) => (
|
|
294
|
-
<th
|
|
295
|
-
className="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-r border-gray-200 dark:border-gray-700 last:border-r-0"
|
|
296
|
-
{...props}
|
|
297
|
-
/>
|
|
298
|
-
),
|
|
299
|
-
td: ({ ...props }) => (
|
|
300
|
-
<td
|
|
301
|
-
className="px-3 py-2 whitespace-normal text-sm text-gray-700 dark:text-gray-300 border-r border-gray-200 dark:border-gray-700 last:border-r-0"
|
|
302
|
-
{...props}
|
|
303
|
-
/>
|
|
304
|
-
),
|
|
305
|
-
}}>
|
|
306
|
-
{item.question}
|
|
307
|
-
</ReactMarkdown>
|
|
308
|
-
</div>
|
|
309
|
-
)}
|
|
310
|
-
</div>
|
|
311
|
-
|
|
312
|
-
<div className="p-6 bg-blue-50/10 dark:bg-blue-900/5">
|
|
313
|
-
<div className="text-xs font-semibold text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2">
|
|
314
|
-
{t('menus.feedback.ai_response')}
|
|
315
|
-
</div>
|
|
316
|
-
{isEditing ? (
|
|
317
|
-
<textarea
|
|
318
|
-
value={editCompletion}
|
|
319
|
-
onChange={(e) => setEditCompletion(e.target.value)}
|
|
320
|
-
className="w-full h-64 p-3 text-sm bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg focus:ring-2 focus:ring-blue-500 outline-none font-mono text-gray-800 dark:text-gray-100"
|
|
321
|
-
/>
|
|
322
|
-
) : (
|
|
323
|
-
<div className="prose dark:prose-invert prose-sm max-w-none text-gray-900 dark:text-gray-100 break-words">
|
|
324
|
-
<ReactMarkdown
|
|
325
|
-
remarkPlugins={
|
|
326
|
-
markdownRemarkPlugins as ReactMarkdownOptions['remarkPlugins']
|
|
327
|
-
}
|
|
328
|
-
rehypePlugins={
|
|
329
|
-
markdownRehypePlugins as ReactMarkdownOptions['rehypePlugins']
|
|
330
|
-
}
|
|
331
|
-
components={{
|
|
332
|
-
table: ({ ...props }) => (
|
|
333
|
-
<table
|
|
334
|
-
className="min-w-full divide-y divide-gray-200 dark:divide-gray-700 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden my-4"
|
|
335
|
-
{...props}
|
|
336
|
-
/>
|
|
337
|
-
),
|
|
338
|
-
thead: ({ ...props }) => (
|
|
339
|
-
<thead
|
|
340
|
-
className="bg-gray-50 dark:bg-gray-800"
|
|
341
|
-
{...props}
|
|
342
|
-
/>
|
|
343
|
-
),
|
|
344
|
-
tbody: ({ ...props }) => (
|
|
345
|
-
<tbody
|
|
346
|
-
className="divide-y divide-gray-200 dark:divide-gray-700 bg-white dark:bg-gray-900"
|
|
347
|
-
{...props}
|
|
348
|
-
/>
|
|
349
|
-
),
|
|
350
|
-
tr: ({ ...props }) => <tr {...props} />,
|
|
351
|
-
th: ({ ...props }) => (
|
|
352
|
-
<th
|
|
353
|
-
className="px-3 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-r border-gray-200 dark:border-gray-700 last:border-r-0"
|
|
354
|
-
{...props}
|
|
355
|
-
/>
|
|
356
|
-
),
|
|
357
|
-
td: ({ ...props }) => (
|
|
358
|
-
<td
|
|
359
|
-
className="px-3 py-2 whitespace-normal text-sm text-gray-700 dark:text-gray-300 border-r border-gray-200 dark:border-gray-700 last:border-r-0"
|
|
360
|
-
{...props}
|
|
361
|
-
/>
|
|
362
|
-
),
|
|
363
|
-
}}>
|
|
364
|
-
{item.answer}
|
|
365
|
-
</ReactMarkdown>
|
|
366
|
-
</div>
|
|
367
|
-
)}
|
|
368
|
-
</div>
|
|
369
|
-
</div>
|
|
370
|
-
|
|
371
|
-
<div className="px-6 py-4 bg-gray-50 dark:bg-gray-800/50 border-t border-gray-100 dark:border-gray-700 flex justify-between items-center sticky bottom-0 z-10">
|
|
372
|
-
<div className="text-xs text-gray-400 font-mono select-all">
|
|
373
|
-
ID: {item.id}
|
|
374
|
-
</div>
|
|
375
|
-
|
|
376
|
-
<div className="flex items-center gap-3 flex-wrap justify-end">
|
|
377
|
-
{isEditing ? (
|
|
378
|
-
<>
|
|
379
|
-
<button
|
|
380
|
-
type="button"
|
|
381
|
-
onClick={() => handleSave(item.id)}
|
|
382
|
-
className="flex items-center gap-1 px-3 py-1.5 bg-blue-600 hover:bg-blue-700 active:scale-95 active:bg-blue-800 text-white rounded-lg text-xs font-medium transition-all">
|
|
383
|
-
<Save size={14} /> {t('common.save')}
|
|
384
|
-
</button>
|
|
385
|
-
<button
|
|
386
|
-
type="button"
|
|
387
|
-
onClick={handleCancelEdit}
|
|
388
|
-
className="p-1.5 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700 active:scale-90 active:bg-gray-300 dark:active:bg-gray-600 rounded-lg transition-all">
|
|
389
|
-
<X size={16} />
|
|
390
|
-
</button>
|
|
391
|
-
</>
|
|
392
|
-
) : (
|
|
393
|
-
isFeedbackPending(item.status) &&
|
|
394
|
-
hasPermission('feedback-manage:edit') && (
|
|
395
|
-
<button
|
|
396
|
-
type="button"
|
|
397
|
-
onClick={() => handleEdit(item)}
|
|
398
|
-
className="p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 active:scale-90 active:bg-blue-100 dark:active:bg-blue-900/40 rounded-lg transition-all border border-transparent hover:border-blue-100 dark:hover:border-blue-800"
|
|
399
|
-
title={t('menus.feedback.actions.edit')}>
|
|
400
|
-
<Edit3 size={16} />
|
|
401
|
-
</button>
|
|
402
|
-
)
|
|
403
|
-
)}
|
|
404
|
-
|
|
405
|
-
{(isFeedbackPending(item.status) || isEditing) && (
|
|
406
|
-
<div className="h-4 w-px bg-gray-300 dark:bg-gray-600" />
|
|
407
|
-
)}
|
|
408
|
-
|
|
409
|
-
{isFeedbackPending(item.status) &&
|
|
410
|
-
!isEditing &&
|
|
411
|
-
(hasPermission('feedback-manage:approve') || hasPermission('feedback-manage:reject')) && (
|
|
412
|
-
<>
|
|
413
|
-
{hasPermission('feedback-manage:approve') && (
|
|
414
|
-
<button
|
|
415
|
-
type="button"
|
|
416
|
-
onClick={() => openReviewConfirm(item.id, 'approve')}
|
|
417
|
-
className="flex items-center gap-1 px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg text-sm font-medium transition-transform active:scale-95 shadow-sm">
|
|
418
|
-
<CheckCircle size={16} />{' '}
|
|
419
|
-
{t('menus.feedback.actions.approve')}
|
|
420
|
-
</button>
|
|
421
|
-
)}
|
|
422
|
-
{hasPermission('feedback-manage:reject') && (
|
|
423
|
-
<button
|
|
424
|
-
type="button"
|
|
425
|
-
onClick={() => openReviewConfirm(item.id, 'reject')}
|
|
426
|
-
className="flex items-center gap-1 px-4 py-2 bg-white dark:bg-gray-800 border border-red-200 dark:border-red-900/50 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg text-sm font-medium transition-transform active:scale-95">
|
|
427
|
-
<XCircle size={16} />{' '}
|
|
428
|
-
{t('menus.feedback.actions.reject')}
|
|
429
|
-
</button>
|
|
430
|
-
)}
|
|
431
|
-
</>
|
|
432
|
-
)}
|
|
433
|
-
|
|
434
|
-
{hasPermission('feedback-manage:delete') && (
|
|
435
|
-
<button
|
|
436
|
-
type="button"
|
|
437
|
-
onClick={() => pageConfig.onDelete?.({ id: item.id })}
|
|
438
|
-
className="ml-2 p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 active:scale-90 active:bg-red-100 dark:active:bg-red-900/40 rounded-lg transition-all"
|
|
439
|
-
title={t('menus.feedback.actions.delete')}>
|
|
440
|
-
<Trash2 size={16} />
|
|
441
|
-
</button>
|
|
442
|
-
)}
|
|
443
|
-
</div>
|
|
444
|
-
</div>
|
|
445
|
-
</div>
|
|
446
|
-
)
|
|
447
|
-
})
|
|
448
|
-
)}
|
|
449
|
-
</div>
|
|
450
|
-
|
|
451
|
-
<ConfirmDialog
|
|
452
|
-
isOpen={reviewConfirm.open}
|
|
453
|
-
danger={reviewConfirm.action === 'reject'}
|
|
454
|
-
title={
|
|
455
|
-
reviewConfirm.action === 'approve'
|
|
456
|
-
? t('menus.feedback.confirm_approve_title')
|
|
457
|
-
: t('menus.feedback.confirm_reject_title')
|
|
458
|
-
}
|
|
459
|
-
message={
|
|
460
|
-
reviewConfirm.action === 'approve'
|
|
461
|
-
? t('menus.feedback.confirm_approve_message')
|
|
462
|
-
: t('menus.feedback.confirm_reject_message')
|
|
463
|
-
}
|
|
464
|
-
confirmText={t('common.ok')}
|
|
465
|
-
cancelText={t('common.cancel')}
|
|
466
|
-
onClose={closeReviewConfirm}
|
|
467
|
-
onConfirm={confirmReview}
|
|
468
|
-
/>
|
|
469
|
-
</>
|
|
470
|
-
)
|
|
471
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { deleteFeedbacksAPI, getFeedbackPageAPI } from '@/api/menus/feedback'
|
|
2
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
3
|
-
import type { FeedbackStatusFilter } from '@/types/feedback'
|
|
4
|
-
import ListPageView, { createListPageConfig } from '@components/table-view'
|
|
5
|
-
import clsx from 'clsx'
|
|
6
|
-
import { Download, MessageSquareQuote } from 'lucide-react'
|
|
7
|
-
import { useState } from 'react'
|
|
8
|
-
import { useTranslation } from 'react-i18next'
|
|
9
|
-
import { FeedbackDatasetList } from './components/feedback-dataset-list'
|
|
10
|
-
import ExportFeedbackModal from './modal/export-feedback-modal'
|
|
11
|
-
|
|
12
|
-
/** 列表顶部状态筛选是否与当前搜索条件一致(空值为「全部」) */
|
|
13
|
-
function isFeedbackStatusTabActive(
|
|
14
|
-
current: unknown,
|
|
15
|
-
tab: FeedbackStatusFilter,
|
|
16
|
-
): boolean {
|
|
17
|
-
if (tab === '') {
|
|
18
|
-
return current === '' || current === undefined || current === null
|
|
19
|
-
}
|
|
20
|
-
return current === tab
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const FEEDBACK_STATUS_TABS: Array<{
|
|
24
|
-
value: FeedbackStatusFilter
|
|
25
|
-
i18nKey: 'pending' | 'approved' | 'rejected' | 'all'
|
|
26
|
-
}> = [
|
|
27
|
-
{ value: 0, i18nKey: 'pending' },
|
|
28
|
-
{ value: 1, i18nKey: 'approved' },
|
|
29
|
-
{ value: 2, i18nKey: 'rejected' },
|
|
30
|
-
{ value: '', i18nKey: 'all' },
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
const useListPageConfig = createListPageConfig({
|
|
34
|
-
tableAPI: getFeedbackPageAPI,
|
|
35
|
-
deleteAPI: deleteFeedbacksAPI,
|
|
36
|
-
pageInfo: {
|
|
37
|
-
title: 'menus.feedback.title_dataset',
|
|
38
|
-
subTitle: 'menus.feedback.subtitle_dataset',
|
|
39
|
-
},
|
|
40
|
-
pagination: { page: 1, pageSize: 10, total: 0 },
|
|
41
|
-
initialSearchFormData: {
|
|
42
|
-
status: '',
|
|
43
|
-
userName: '',
|
|
44
|
-
evaluationType: '',
|
|
45
|
-
startTime: '',
|
|
46
|
-
endTime: '',
|
|
47
|
-
},
|
|
48
|
-
searchFields: [
|
|
49
|
-
{
|
|
50
|
-
prop: 'userName',
|
|
51
|
-
label: 'menus.feedback.filter_content',
|
|
52
|
-
placeholder: 'menus.feedback.search_content_placeholder',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
prop: 'evaluationType',
|
|
56
|
-
label: 'menus.feedback.filter_score',
|
|
57
|
-
placeholder: 'menus.feedback.search_score_placeholder',
|
|
58
|
-
type: 'select',
|
|
59
|
-
options: [
|
|
60
|
-
// {label: 'menus.feedback.score_all', value: '',},
|
|
61
|
-
{label: 'menus.feedback.like', value: '10',},
|
|
62
|
-
{label: 'menus.feedback.dislike', value: '20',}
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
prop: 'startDate',
|
|
67
|
-
label: 'menus.feedback.search_date_range_label',
|
|
68
|
-
placeholder: [
|
|
69
|
-
'menus.feedback.search_date_range_ph_start',
|
|
70
|
-
'menus.feedback.search_date_range_ph_end',
|
|
71
|
-
],
|
|
72
|
-
type: 'dateRange',
|
|
73
|
-
rangeStartProp: 'startTime',
|
|
74
|
-
rangeEndProp: 'endTime',
|
|
75
|
-
format: 'YYYY-MM-DD HH:mm:ss',
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
table: { showPagination: true },
|
|
79
|
-
deleteConfirm: {
|
|
80
|
-
title: 'menus.feedback.confirm_delete_title',
|
|
81
|
-
content: 'menus.feedback.confirm_delete_message',
|
|
82
|
-
okText: 'common.delete',
|
|
83
|
-
cancelText: 'common.cancel',
|
|
84
|
-
},
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
function IndexView() {
|
|
88
|
-
const { t } = useTranslation()
|
|
89
|
-
const { hasPermission } = useAuth()
|
|
90
|
-
const [exportOpen, setExportOpen] = useState(false)
|
|
91
|
-
const [exportSnapshot, setExportSnapshot] = useState<{
|
|
92
|
-
paginationData?: { page?: number; pageSize?: number }
|
|
93
|
-
listQuery?: { sort?: string; order?: 'asc' | 'desc' }
|
|
94
|
-
searchFormData?: Record<string, unknown>
|
|
95
|
-
}>({})
|
|
96
|
-
|
|
97
|
-
const pageConfig = useListPageConfig()
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<div className="menus-feedback-page">
|
|
101
|
-
<ListPageView
|
|
102
|
-
pageConfig={pageConfig}
|
|
103
|
-
headerActions={
|
|
104
|
-
<>
|
|
105
|
-
{hasPermission('feedback-manage:export') && (
|
|
106
|
-
<button
|
|
107
|
-
type="button"
|
|
108
|
-
onClick={() => {
|
|
109
|
-
setExportSnapshot({
|
|
110
|
-
paginationData: pageConfig.paginationData,
|
|
111
|
-
listQuery: pageConfig.listQuery,
|
|
112
|
-
searchFormData: pageConfig.searchFormData as Record<
|
|
113
|
-
string,
|
|
114
|
-
unknown
|
|
115
|
-
>,
|
|
116
|
-
})
|
|
117
|
-
setExportOpen(true)
|
|
118
|
-
}}
|
|
119
|
-
className="px-4 py-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 rounded-lg text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 active:scale-95 active:bg-gray-100 dark:active:bg-gray-600 transition-all flex items-center gap-2 mr-2"
|
|
120
|
-
title={t('menus.feedback.export.title')}>
|
|
121
|
-
<Download size={16} />
|
|
122
|
-
<span className="hidden sm:inline">
|
|
123
|
-
{t('menus.feedback.export.action')}
|
|
124
|
-
</span>
|
|
125
|
-
</button>
|
|
126
|
-
)}
|
|
127
|
-
{FEEDBACK_STATUS_TABS.map(({ value, i18nKey }) => (
|
|
128
|
-
<button
|
|
129
|
-
key={i18nKey}
|
|
130
|
-
type="button"
|
|
131
|
-
onClick={() =>
|
|
132
|
-
pageConfig.patchSearchAndRefresh?.({ status: value })
|
|
133
|
-
}
|
|
134
|
-
className={clsx(
|
|
135
|
-
'px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 active:scale-95',
|
|
136
|
-
isFeedbackStatusTabActive(
|
|
137
|
-
(pageConfig.searchFormData as { status?: unknown })
|
|
138
|
-
?.status,
|
|
139
|
-
value,
|
|
140
|
-
)
|
|
141
|
-
? 'bg-blue-600 text-white shadow-lg shadow-blue-600/20 scale-105 active:bg-blue-700'
|
|
142
|
-
: 'bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-gray-200 active:bg-gray-300 dark:active:bg-gray-600',
|
|
143
|
-
)}>
|
|
144
|
-
{t(`menus.feedback.status.${i18nKey}`)}
|
|
145
|
-
</button>
|
|
146
|
-
))}
|
|
147
|
-
</>
|
|
148
|
-
}
|
|
149
|
-
renderList={() => (
|
|
150
|
-
<FeedbackDatasetList
|
|
151
|
-
pageConfig={pageConfig}
|
|
152
|
-
tableData={pageConfig.tableData}
|
|
153
|
-
loading={pageConfig.loading}
|
|
154
|
-
/>
|
|
155
|
-
)}
|
|
156
|
-
/>
|
|
157
|
-
<ExportFeedbackModal
|
|
158
|
-
isOpen={exportOpen}
|
|
159
|
-
onClose={() => setExportOpen(false)}
|
|
160
|
-
listSnapshot={exportSnapshot}
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export default IndexView
|