diff --git a/src/components/chatdoc/Conversations.vue b/src/components/chatdoc/Conversations.vue new file mode 100644 index 0000000..3a1f965 --- /dev/null +++ b/src/components/chatdoc/Conversations.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/src/components/chatdoc/SidePanel.vue b/src/components/chatdoc/SidePanel.vue index 3f4b5fe..c2f70a4 100644 --- a/src/components/chatdoc/SidePanel.vue +++ b/src/components/chatdoc/SidePanel.vue @@ -69,8 +69,7 @@ import { defineComponent } from 'vue'; import { ElSkeleton, ElInput } from 'element-plus'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW } from '@/router/constants'; -import { chatdocOperator } from '@/operators'; -import { IChatRepository } from '@/operators/chatdoc/models'; +import { chatdocOperator, IChatdocRepository } from '@/operators'; import { Status } from '@/store/common/models'; export default defineComponent({ @@ -102,25 +101,25 @@ export default defineComponent({ name: ROUTE_CHAT_CONVERSATION_NEW }); }, - async onConfirm(repository: IChatRepository) { - if (repository?.deleting) { - await chatdocOperator.deleteRepository(repository.id); - await this.$store.dispatch('chatdoc/getRepositories'); - } else if (repository?.editing) { - await chatdocOperator.updateRepository(repository); - await this.$store.dispatch('chatdoc/getRepositories'); - } else { - repository.editing = true; - } + async onConfirm(repository: IChatdocRepository) { + // if (repository?.deleting) { + // await chatdocOperator.deleteRepository(repository.id); + // await this.$store.dispatch('chatdoc/getRepositories'); + // } else if (repository?.editing) { + // await chatdocOperator.updateRepository(repository); + // await this.$store.dispatch('chatdoc/getRepositories'); + // } else { + // repository.editing = true; + // } }, onClick(id: string) { if (!id) { return; } this.$router.push({ - name: ROUTE_CHAT_CONVERSATION, + name: ROUTE_CHAT_CONVERSATION_NEW, params: { - id + repositoryId: this.repositoryId } }); this.$emit('click', id); diff --git a/src/components/chatdoc/UploadDocument.vue b/src/components/chatdoc/UploadDocument.vue new file mode 100644 index 0000000..9dea361 --- /dev/null +++ b/src/components/chatdoc/UploadDocument.vue @@ -0,0 +1,97 @@ + + + diff --git a/src/components/common/Navigator.vue b/src/components/common/Navigator.vue index 9435cef..bb526e7 100644 --- a/src/components/common/Navigator.vue +++ b/src/components/common/Navigator.vue @@ -77,7 +77,7 @@ import { ElButton, ElTooltip, ElMenu, ElMenuItem } from 'element-plus'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; import { ROUTE_CHATDOC_INDEX, - ROUTE_CHATDOC_CHAT, + ROUTE_CHATDOC_CONVERSATION, ROUTE_CHATDOC_KNOWLEDGE, ROUTE_CHATDOC_SETTING, ROUTE_CHAT_CONVERSATION, @@ -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_CHAT, ROUTE_CHATDOC_KNOWLEDGE, ROUTE_CHATDOC_SETTING] + routes: [ROUTE_CHATDOC_INDEX, ROUTE_CHATDOC_CONVERSATION, ROUTE_CHATDOC_KNOWLEDGE, ROUTE_CHATDOC_SETTING] }); } diff --git a/src/i18n/zh/chatdoc/button.ts b/src/i18n/zh/chatdoc/button.ts new file mode 100644 index 0000000..77d211c --- /dev/null +++ b/src/i18n/zh/chatdoc/button.ts @@ -0,0 +1,3 @@ +export default { + uploadDocuments: '上传文档' +}; diff --git a/src/i18n/zh/chatdoc/field.ts b/src/i18n/zh/chatdoc/field.ts new file mode 100644 index 0000000..0d46961 --- /dev/null +++ b/src/i18n/zh/chatdoc/field.ts @@ -0,0 +1,11 @@ +export default { + fileName: '文件名', + createdAt: '创建时间', + fileExtension: '文件类型', + fileUrl: '文件链接', + fileSize: '文件大小', + state: '状态', + stateProcessing: '学习中', + stateCompleted: '学习完成', + stateFailed: '学习失败' +}; diff --git a/src/i18n/zh/chatdoc/index.ts b/src/i18n/zh/chatdoc/index.ts index e59502a..ea8125c 100644 --- a/src/i18n/zh/chatdoc/index.ts +++ b/src/i18n/zh/chatdoc/index.ts @@ -1,5 +1,7 @@ import message from './message'; import title from './title'; import nav from './nav'; +import field from './field'; +import button from './button'; -export default { message, title, nav }; +export default { message, title, nav, field, button }; diff --git a/src/i18n/zh/chatdoc/message.ts b/src/i18n/zh/chatdoc/message.ts index 6fc6a63..707f0f7 100644 --- a/src/i18n/zh/chatdoc/message.ts +++ b/src/i18n/zh/chatdoc/message.ts @@ -1,31 +1,12 @@ export default { - startNewChat: '开始新的会话', - uploadFile: '上传文件', - noToken: '请先申请对应服务', - newMessagePlaceholder: '请输入你的问题...', - noInput: '问题不能为空', - uploadReferencesExceed: '最多只能上传 1 个文件', - uploadReferencesError: '上传文件失败,请稍后重试', - notApplied: '您尚未申请该服务,请先申请', - tryForFree: '免费使用', - question1: '写一段 JavaScript 代码,输出 Hello World', - question2: '写一封邮件给晓伟,告诉他我刚刚搬家了', - question3: '用简单的术语解释量子计算的基本原理', - question4: '虚拟现实对艺术创作产生了怎样的影响?', - question5: '隐私保护和数据安全如何影响法律实践?', - question6: '如何应对当今世界复杂的税务法规变化?', - question7: '如何结合不同地区的文化背景创作独特美食?', - question8: '如何通过旅行体验汲取文学创作灵感?', - question9: '如何从不同行业的成功案例中获取商业创意?', - errorApiError: '回答失败,请稍后重试', - errorBadRequest: '请求内容不规范,请重新提问', - errorNoConversation: '对话内容不存在或者已经过期,请发起新的会话', - errorContentTooLarge: '问题内容过长,请缩短后重试', - errorTooManyRequests: '您的操作过于频繁,请稍后重试', - errorUsedUp: '您的套餐次数已经用完,请购买更多次数继续使用', - errorUnknown: '服务器出现未知错误,请稍后重试或联系客服', - errorTimeout: '回答问题超时,请稍后重试', - errorNotApplied: '您尚未申请该服务,请先申请再继续提问', - confirmDelete: '确定删除', - howToUse: '按 Shift+Enter 键可以换行' + introductionForKnowledge: '知识库中可添加文档,在机器人回答时,可运用库中的知识进行回复。', + uploadDocumentsExceed: '上传文档数量超过限制', + uploadDocumentsError: '上传文档失败', + uploadDocumentsSuccess: '上传文档成功', + createDocumentSuccess: '录入文档成功', + startCreateDocument: '开始录入文档...', + createDocumentError: '录入文档失败', + dragOrClickToUpload: '拖拽或点击上传', + learningDocument: '学习中,请稍后...', + startNewChat: '开始新会话' }; diff --git a/src/i18n/zh/chatdoc/title.ts b/src/i18n/zh/chatdoc/title.ts index 49a3fb8..48dd644 100644 --- a/src/i18n/zh/chatdoc/title.ts +++ b/src/i18n/zh/chatdoc/title.ts @@ -1,9 +1,3 @@ export default { - chat: 'AI问答', - example: '样例', - capabilities: '功能', - limitations: '限制', - complexQuestion: '解答复杂问题', - professionalQuestion: '咨询专业问题', - getTips: '获取灵感创意' + knowledge: '我的知识库' }; diff --git a/src/layouts/Chatdoc.vue b/src/layouts/Chatdoc.vue index 6c38652..f3ea070 100644 --- a/src/layouts/Chatdoc.vue +++ b/src/layouts/Chatdoc.vue @@ -1,6 +1,6 @@