From 159f6ad042734e174d7f6245b4013bdfd3dc4f92 Mon Sep 17 00:00:00 2001 From: Germey Date: Sun, 28 Jan 2024 15:22:20 +0800 Subject: [PATCH] update manage --- src/components/chatdoc/CreateRepository.vue | 8 +++ src/components/chatdoc/UploadDocument.vue | 6 +- src/components/common/Navigator.vue | 4 +- src/i18n/zh/chatdoc/message.ts | 14 ++-- src/i18n/zh/chatdoc/nav.ts | 2 +- src/i18n/zh/chatdoc/title.ts | 5 +- src/layouts/Chatdoc.vue | 32 +++++++--- src/pages/chatdoc/Conversation.vue | 27 +++++++- src/pages/chatdoc/Index.vue | 64 +++++++++++++++++-- .../chatdoc/{Knowledge.vue => Manage.vue} | 43 +++++++++++-- src/router/chatdoc.ts | 8 +-- src/router/constants.ts | 2 +- src/store/chatdoc/mutations.ts | 1 + 13 files changed, 180 insertions(+), 36 deletions(-) rename src/pages/chatdoc/{Knowledge.vue => Manage.vue} (76%) diff --git a/src/components/chatdoc/CreateRepository.vue b/src/components/chatdoc/CreateRepository.vue index 0f7805c..178ee1d 100644 --- a/src/components/chatdoc/CreateRepository.vue +++ b/src/components/chatdoc/CreateRepository.vue @@ -54,6 +54,10 @@ export default defineComponent({ computed: {}, methods: { async onSubmit() { + if (!this.form.name) { + ElMessage.error(this.$t('chatdoc.message.nameRequired')); + return; + } this.creating = true; this.$store .dispatch('chatdoc/createRepository', { @@ -87,4 +91,8 @@ export default defineComponent({ background-color: #eee; margin-bottom: 0; } + +.el-button { + border-radius: 20px; +} diff --git a/src/components/chatdoc/UploadDocument.vue b/src/components/chatdoc/UploadDocument.vue index 776210e..a5d598a 100644 --- a/src/components/chatdoc/UploadDocument.vue +++ b/src/components/chatdoc/UploadDocument.vue @@ -82,14 +82,16 @@ export default defineComponent({ fileName: this.fileList[0].name }) .then(() => { - this.learning = false; ElMessage.success(this.$t('chatdoc.message.createDocumentSuccess')); this.dialogVisible = false; this.$store.dispatch('chatdoc/getDocuments', { repositoryId: this.$route.params.repositoryId }); }) .catch(() => { - this.learning = false; ElMessage.error(this.$t('chatdoc.message.createDocumentError')); + }) + .finally(() => { + this.fileList = []; + this.learning = false; }); } } diff --git a/src/components/common/Navigator.vue b/src/components/common/Navigator.vue index bb526e7..1864514 100644 --- a/src/components/common/Navigator.vue +++ b/src/components/common/Navigator.vue @@ -78,7 +78,7 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { ROUTE_CHATDOC_INDEX, ROUTE_CHATDOC_CONVERSATION, - ROUTE_CHATDOC_KNOWLEDGE, + ROUTE_CHATDOC_MANAGE, ROUTE_CHATDOC_SETTING, ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW, @@ -131,7 +131,7 @@ export default defineComponent({ }, displayName: this.$t('common.nav.chatdoc'), icon: 'fa-solid fa-file-lines', - routes: [ROUTE_CHATDOC_INDEX, ROUTE_CHATDOC_CONVERSATION, ROUTE_CHATDOC_KNOWLEDGE, ROUTE_CHATDOC_SETTING] + routes: [ROUTE_CHATDOC_INDEX, ROUTE_CHATDOC_CONVERSATION, ROUTE_CHATDOC_MANAGE, ROUTE_CHATDOC_SETTING] }); } diff --git a/src/i18n/zh/chatdoc/message.ts b/src/i18n/zh/chatdoc/message.ts index cd7dfc5..ded4d27 100644 --- a/src/i18n/zh/chatdoc/message.ts +++ b/src/i18n/zh/chatdoc/message.ts @@ -1,12 +1,14 @@ export default { introductionForKnowledge: '知识库中可添加文档,在机器人回答时,可运用库中的知识进行回复。', + introductionForRepository: + '知识库是一组文档的集合,您可以在知识库中添加文档,机器人在回答时,会从知识库中的文档中进行回复。', uploadDocumentsExceed: '上传文档数量超过限制', uploadDocumentsError: '上传文档失败', uploadDocumentsSuccess: '上传文档成功', - createDocumentSuccess: '录入文档成功', - startCreateDocument: '开始录入文档...', - createDocumentError: '录入文档失败', - dragOrClickToUpload: '拖拽或点击上传', + createDocumentSuccess: '学习文档成功', + startCreateDocument: '开始学习文档...', + createDocumentError: '学习文档失败', + dragOrClickToUpload: '拖拽或点击上传文档', learningDocument: '学习中,请稍后...', startNewChat: '开始新会话', errorApiError: '回答失败,请稍后重试', @@ -23,5 +25,7 @@ export default { createRepositorySuccess: '创建知识库成功', createRepositoryFailed: '创建知识库失败', deleteRepositorySuccess: '删除知识库成功', - deleteDocumentSuccess: '删除文档成功' + deleteDocumentSuccess: '删除文档成功', + currentRepository: '当前知识库', + nameRequired: '名称不能为空' }; diff --git a/src/i18n/zh/chatdoc/nav.ts b/src/i18n/zh/chatdoc/nav.ts index 641081b..074d904 100644 --- a/src/i18n/zh/chatdoc/nav.ts +++ b/src/i18n/zh/chatdoc/nav.ts @@ -1,5 +1,5 @@ export default { chat: '对话', setting: '设置', - knowledge: '知识库' + manage: '管理' }; diff --git a/src/i18n/zh/chatdoc/title.ts b/src/i18n/zh/chatdoc/title.ts index 8f3f59f..55b480a 100644 --- a/src/i18n/zh/chatdoc/title.ts +++ b/src/i18n/zh/chatdoc/title.ts @@ -1,4 +1,5 @@ export default { - knowledge: '我的知识库', - createRepository: '创建知识库' + manage: '管理知识库', + createRepository: '创建知识库', + repositories: '知识库列表' }; diff --git a/src/layouts/Chatdoc.vue b/src/layouts/Chatdoc.vue index 7355843..0dc27c0 100644 --- a/src/layouts/Chatdoc.vue +++ b/src/layouts/Chatdoc.vue @@ -1,6 +1,10 @@