Add Chatdoc feature (#40)

This commit is contained in:
AceDataCloud committed 2024-01-28 07:23:59 +00:00
1 parent 60752af1fb
commit 811a2bca09
51 files changed
+2742 -25

No files matched your search

+3 -5
View File
@@ -33,7 +33,7 @@ import AnsweringMark from './AnsweringMark.vue';
import copy from 'copy-to-clipboard';
import { ElAlert, ElButton } from 'element-plus';
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
import { IApplication, IChatMessage, IChatMessageState, ROLE_ASSISTANT } from '@/operators';
import { IApplication, IChatMessage, IChatMessageState } from '@/operators';
import CopyToClipboard from '../common/CopyToClipboard.vue';
import {
ERROR_CODE_API_ERROR,
@@ -43,7 +43,8 @@ import {
ERROR_CODE_TIMEOUT,
ERROR_CODE_TOO_MANY_REQUESTS,
ERROR_CODE_UNKNOWN,
ERROR_CODE_USED_UP
ERROR_CODE_USED_UP,
ROLE_ASSISTANT
} from '@/constants';
import message from '@/i18n/zh/common/message';
import { ROUTE_CONSOLE_APPLICATION_BUY } from '@/router';
@@ -125,9 +126,6 @@ export default defineComponent({
}
});
}
// onStop() {
// this.$emit('stop');
// }
}
});
</script>
+40
View File
@@ -0,0 +1,40 @@
<template>
<div class="box"></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'AnsweringMark',
data() {
return {};
},
computed: {
conversationId() {
return this.$route.params?.conversationId?.toString();
}
}
});
</script>
<style lang="scss">
@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.box {
width: 2px;
height: 16px;
margin-top: 3px;
background-color: var(--el-color-black);
animation: blink 1s infinite;
}
</style>
+198
View File
@@ -0,0 +1,198 @@
<template>
<div class="panel">
<el-skeleton v-if="loading && conversations === undefined" />
<div v-else class="conversations">
<div class="conversation" @click="onNewConversation">
<div class="icons">
<font-awesome-icon icon="fa-solid fa-plus" class="icon" />
</div>
<div class="title">
{{ $t('chatdoc.message.startNewChat') }}
</div>
</div>
<div
v-for="(conversation, conversationIndex) in conversations"
:key="conversationIndex"
:class="{ conversation: true, active: conversation.id === conversationId }"
@click="onClick(conversation.id)"
>
<div class="icons">
<font-awesome-icon icon="fa-regular fa-comment" class="icon" />
</div>
<div class="title">
<span v-if="conversation?.deleting">
{{ `${$t('chatdoc.message.confirmDelete')}?` }}
</span>
<span v-else-if="conversation?.editing">
<el-input v-model="conversation.title" @keydown.enter="onConfirm(conversation)" />
</span>
<span v-else-if="conversation?.title || conversation?.messages">{{
conversation?.title || conversation?.messages[conversation?.messages.length - 1]?.content
}}</span>
</div>
<div class="operations">
<font-awesome-icon
v-if="!conversation?.editing && !conversation.deleting"
icon="fa-solid fa-edit"
class="icon icon-edit"
@click.stop="conversation.editing = true"
/>
<font-awesome-icon
v-if="!conversation?.editing && !conversation.deleting"
icon="fa-solid fa-trash"
class="icon icon-delete"
@click.stop="conversation.deleting = true"
/>
<font-awesome-icon
v-if="conversation?.editing || conversation.deleting"
icon="fa-solid fa-check"
class="icon icon-confirm"
@click.stop="onConfirm(conversation)"
/>
<font-awesome-icon
v-if="conversation?.editing || conversation.deleting"
icon="fa-solid fa-xmark"
class="icon icon-cancel"
@click.stop="
conversation.editing = false;
conversation.deleting = false;
"
/>
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElSkeleton, ElInput } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { ROUTE_CHATDOC_CONVERSATION, ROUTE_CHATDOC_CONVERSATION_NEW } from '@/router/constants';
import { IChatdocRepository, chatdocOperator, IChatdocConversation } from '@/operators';
export default defineComponent({
name: 'SidePanel',
components: {
ElInput,
FontAwesomeIcon,
ElSkeleton
},
props: {},
emits: ['click'],
computed: {
repositoryId() {
return this.$route.params?.repositoryId?.toString();
},
conversationId() {
return this.$route.params?.conversationId?.toString();
},
repository(): IChatdocRepository | undefined {
return this.$store.state?.chatdoc?.repositories?.find((repository) => repository.id === this.repositoryId);
},
conversations() {
return this.repository?.conversations;
},
applications() {
return this.$store.state.chatdoc.applications;
}
},
methods: {
async onNewConversation() {
this.$router.push({
name: ROUTE_CHATDOC_CONVERSATION_NEW,
params: {
repositoryId: this.repositoryId
}
});
},
async onConfirm(conversation: IChatdocConversation) {
if (conversation?.deleting) {
await chatdocOperator.deleteConversation(conversation.id);
await this.$store.dispatch('chat/getConversations');
} else if (conversation?.editing) {
await chatdocOperator.updateConversation(conversation);
await this.$store.dispatch('chat/getConversations');
} else {
conversation.editing = true;
}
},
onClick(id: string) {
if (!id) {
return;
}
this.$router.push({
name: ROUTE_CHATDOC_CONVERSATION,
params: {
repositoryId: this.repositoryId,
conversationId: id
}
});
this.$emit('click', id);
}
}
});
</script>
<style lang="scss" scoped>
.panel {
display: flex;
flex-direction: column;
align-items: flex-end;
padding: 15px;
width: 300px;
height: 100%;
border-right: 1px solid #eee;
overflow-y: scroll;
.conversations {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
.conversation {
width: 100%;
height: 55px;
display: flex;
flex-direction: row;
padding: 10px;
margin-bottom: 5px;
border: 1px dashed hsl(0, 0%, 93%);
line-height: 30px;
border-radius: 10px;
color: #666;
cursor: pointer;
&.active,
&:hover {
background-color: #eee;
}
.icons {
width: 30px;
padding-left: 10px;
.icon {
font-size: 14px;
}
}
.title {
flex: 1;
font-size: 14px;
line-height: 32px;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 8px;
color: #666;
}
.operations {
width: 40px;
.icon {
cursor: pointer;
font-size: 14px;
margin-right: 6px;
}
}
}
}
}
</style>
@@ -0,0 +1,98 @@
<template>
<el-dialog v-model="dialogVisible" width="500px">
<el-form ref="form" label-width="60px">
<el-form-item :label="$t('chatdoc.field.name')" :prop="form.name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item :label="$t('chatdoc.field.description')" :prop="form.description">
<el-input v-model="form.description" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">{{ $t('common.button.create') }}</el-button>
</el-form-item>
</el-form>
</el-dialog>
<button class="btn btn-create" @click="dialogVisible = true">
<font-awesome-icon :icon="['fas', 'plus']" />
</button>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElButton, ElDialog, ElMessage, ElForm, ElFormItem, ElInput } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface IData {
dialogVisible: boolean;
creating: boolean;
form: {
name: string;
description: string;
};
}
export default defineComponent({
name: 'UploadDocument',
components: {
ElButton,
ElDialog,
ElForm,
ElFormItem,
ElInput,
FontAwesomeIcon
},
data(): IData {
return {
dialogVisible: false,
creating: false,
form: {
name: '',
description: ''
}
};
},
computed: {},
methods: {
async onSubmit() {
if (!this.form.name) {
ElMessage.error(this.$t('chatdoc.message.nameRequired'));
return;
}
this.creating = true;
this.$store
.dispatch('chatdoc/createRepository', {
name: this.form.name,
description: this.form.description
})
.then(() => {
this.creating = false;
ElMessage.success(this.$t('chatdoc.message.createDocumentSuccess'));
this.dialogVisible = false;
this.$store.dispatch('chatdoc/getRepositories');
})
.catch(() => {
this.creating = false;
ElMessage.error(this.$t('chatdoc.message.createRepositoryFailed'));
});
}
}
});
</script>
<style scoped lang="scss">
.btn.btn-create {
text-align: center;
cursor: pointer;
border: none;
width: 50px;
height: 50px;
border-radius: 50%;
margin-top: 5px;
background-color: #eee;
margin-bottom: 0;
}
.el-button {
border-radius: 20px;
}
</style>
+155
View File
@@ -0,0 +1,155 @@
<template>
<div class="input-box">
<span
:class="{
btn: true,
'btn-send': true,
disabled: !question
}"
@click="onSubmit"
>
<font-awesome-icon icon="fa-solid fa-location-arrow" class="icon icon-send" />
</span>
<el-input
v-model="questionValue"
:rows="1"
:disabled="disabled"
class="input"
type="textarea"
:placeholder="$t('chat.message.newMessagePlaceholder')"
@keydown.enter.exact.prevent="onSubmit"
>
</el-input>
<p class="info">{{ $t('chat.message.howToUse') }}</p>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElInput, ElMessage, ElTooltip, ElUpload } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { CHAT_MODEL_CHATGPT4_VISION, IChatModel } from '@/operators';
export default defineComponent({
name: 'InputBox',
components: {
ElInput,
FontAwesomeIcon
},
props: {
disabled: {
type: Boolean,
required: false,
default: false
},
question: {
type: String,
required: true
}
},
emits: ['update:question', 'submit'],
data() {
return {
questionValue: this.question,
fileList: []
};
},
computed: {
model(): IChatModel {
return this.$store.state.chat.model;
}
},
watch: {
questionValue(val: string) {
this.$emit('update:question', val);
},
question(val: string) {
if (val !== this.questionValue) {
this.questionValue = val;
}
},
references(val: string[]) {
if (val.length === 0) {
this.fileList = [];
}
}
},
methods: {
onSubmit() {
if (!this.question) {
return;
}
this.$emit('submit');
}
}
});
</script>
<style lang="scss">
.input-box {
.input {
textarea {
border: none;
background: none;
box-shadow: none;
resize: none;
line-height: 30px;
height: 40px;
}
}
.el-upload-list {
position: absolute;
width: 400px;
bottom: 45px;
}
.el-textarea.is-disabled .el-textarea__inner {
background-color: initial;
}
}
</style>
<style lang="scss" scoped>
.input-box {
position: relative;
width: 100%;
border: 1px solid #eee;
border-radius: 10px;
background: none;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
top: 30px;
.input {
border: none;
width: calc(100% - 80px);
margin-left: 5px;
}
.info {
display: block;
position: absolute;
font-size: 12px;
color: #666;
margin-top: 5px;
margin-left: 3px;
}
.btn {
display: block;
z-index: 100;
cursor: pointer;
position: absolute;
top: 7px;
&.btn-send {
right: 15px;
&.disabled {
.icon-send {
color: #eee;
}
cursor: not-allowed;
}
.icon-send {
font-size: 16px;
color: #666;
}
}
}
}
</style>
+175
View File
@@ -0,0 +1,175 @@
<template>
<div
:class="{
message: true,
[message.role as string]: true,
hidden: errorText && message.role === 'assistant'
}"
:role="message.role"
>
<div class="content">
<markdown-renderer :content="message?.content" />
<answering-mark v-if="message.state === messageState.PENDING" />
</div>
<div class="operations">
<copy-to-clipboard :content="message.content!" class="btn-copy" />
</div>
</div>
<el-alert v-if="errorText" class="error" :title="errorText" type="error" :closable="false" />
<el-button v-if="showBuyMore" type="primary" class="btn btn-buy" size="small" @click="onBuyMore">
{{ $t('common.button.buyMore') }}
</el-button>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import AnsweringMark from './AnsweringMark.vue';
import copy from 'copy-to-clipboard';
import { ElAlert, ElButton } from 'element-plus';
import MarkdownRenderer from '@/components/common/MarkdownRenderer.vue';
import { IChatdocMessage, IChatdocMessageState } from '@/operators';
import CopyToClipboard from '../common/CopyToClipboard.vue';
import {
ERROR_CODE_API_ERROR,
ERROR_CODE_BAD_REQUEST,
ERROR_CODE_CONTENT_TOO_LARGE,
ERROR_CODE_NOT_APPLIED,
ERROR_CODE_TIMEOUT,
ERROR_CODE_TOO_MANY_REQUESTS,
ERROR_CODE_UNKNOWN,
ERROR_CODE_USED_UP,
ROLE_ASSISTANT
} from '@/constants';
import message from '@/i18n/zh/common/message';
interface IData {
copied: boolean;
messageState: typeof IChatdocMessageState;
}
export default defineComponent({
name: 'Message',
components: {
CopyToClipboard,
AnsweringMark,
MarkdownRenderer,
ElAlert,
ElButton
},
props: {
message: {
type: Object as () => IChatdocMessage,
required: true
}
},
emits: ['stop'],
data(): IData {
return {
copied: false,
messageState: IChatdocMessageState
};
},
computed: {
errorText() {
if (!this.message.error || !this.message.error?.code) {
return undefined;
}
switch (this.message.error?.code) {
case ERROR_CODE_USED_UP:
return this.$t('chatdoc.message.errorUsedUp');
case ERROR_CODE_API_ERROR:
return this.$t('chatdoc.message.errorApiError');
case ERROR_CODE_BAD_REQUEST:
return this.$t('chatdoc.message.errorBadRequest');
case ERROR_CODE_TIMEOUT:
return this.$t('chatdoc.message.errorTimeout');
case ERROR_CODE_TOO_MANY_REQUESTS:
return this.$t('chatdoc.message.errorTooManyRequests');
case ERROR_CODE_CONTENT_TOO_LARGE:
return this.$t('chatdoc.message.errorContentTooLarge');
case ERROR_CODE_NOT_APPLIED:
return this.$t('chatdoc.message.errorNotApplied');
case ERROR_CODE_UNKNOWN:
default:
return this.$t('chatdoc.message.errorUnknown');
}
},
showBuyMore() {
return this.message.role === ROLE_ASSISTANT && this.message.error?.code === ERROR_CODE_USED_UP;
}
},
methods: {
onCopy() {
copy(this.message.content!.toString(), {
debug: true
});
this.copied = true;
setTimeout(() => {
this.copied = false;
}, 3000);
},
onBuyMore() {}
}
});
</script>
<style lang="scss" scoped>
.error {
width: fit-content;
padding: 10px 5px 8px 5px;
height: 45px;
border-radius: 10px;
border-bottom-left-radius: 0;
}
.btn-buy {
margin: 10px auto;
border-radius: 20px;
}
.message {
display: flex;
flex-direction: column;
margin-bottom: 15px;
&[role='system'] {
display: none;
}
&.hidden {
display: none;
}
&.assistant {
align-items: start;
.content {
background-color: var(--el-bg-color-page);
color: var(--el-color-black);
border-bottom-left-radius: 0;
}
}
&.user {
align-items: end;
.content {
background-color: var(--el-color-primary);
color: var(--el-color-white);
border-bottom-right-radius: 0;
}
}
.content {
border-radius: 10px;
padding: 8px 15px;
max-width: 800px;
.image {
max-width: 100%;
max-height: 300px;
margin: 5px 0;
border-radius: 10px;
}
}
.operations {
display: block;
.btn-copy {
color: var(--el-text-color-regular);
font-size: 14px;
}
}
}
</style>
+192
View File
@@ -0,0 +1,192 @@
<template>
<div class="panel">
<el-skeleton v-if="loading && repositories === undefined" />
<div v-else class="repositories">
<div class="repository" @click="onNewRepository">
<div class="icons">
<font-awesome-icon icon="fa-solid fa-plus" class="icon" />
</div>
<div class="title">
{{ $t('chatdoc.message.startNewChat') }}
</div>
</div>
<div
v-for="(repository, repositoryIndex) in repositories"
:key="repositoryIndex"
:class="{ repository: true, active: repository.id === repositoryId }"
@click="onClick(repository.id)"
>
<div class="icons">
<font-awesome-icon icon="fa-regular fa-comment" class="icon" />
</div>
<div class="title">
<span v-if="repository?.deleting">
{{ `${$t('chatdoc.message.confirmDelete')}?` }}
</span>
<span v-else-if="repository?.editing">
<el-input v-model="repository.title" @keydown.enter="onConfirm(repository)" />
</span>
<span v-else-if="repository?.title || repository?.messages">{{
repository?.title || repository?.messages[repository?.messages.length - 1]?.content
}}</span>
</div>
<div class="operations">
<font-awesome-icon
v-if="!repository?.editing && !repository.deleting"
icon="fa-solid fa-edit"
class="icon icon-edit"
@click.stop="repository.editing = true"
/>
<font-awesome-icon
v-if="!repository?.editing && !repository.deleting"
icon="fa-solid fa-trash"
class="icon icon-delete"
@click.stop="repository.deleting = true"
/>
<font-awesome-icon
v-if="repository?.editing || repository.deleting"
icon="fa-solid fa-check"
class="icon icon-confirm"
@click.stop="onConfirm(repository)"
/>
<font-awesome-icon
v-if="repository?.editing || repository.deleting"
icon="fa-solid fa-xmark"
class="icon icon-cancel"
@click.stop="
repository.editing = false;
repository.deleting = false;
"
/>
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
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, IChatdocRepository } from '@/operators';
import { Status } from '@/store/common/models';
export default defineComponent({
name: 'SidePanel',
components: {
ElInput,
FontAwesomeIcon,
ElSkeleton
},
props: {},
emits: ['click'],
computed: {
repositoryId() {
return this.$route.params?.id?.toString();
},
repositories() {
return this.$store.state.chatdoc.repositories;
},
applications() {
return this.$store.state.chatdoc.applications;
},
loading() {
return this.$store.state.chatdoc.getRepositoriesStatus === Status.Request;
}
},
methods: {
async onNewRepository() {
this.$router.push({
name: ROUTE_CHAT_CONVERSATION_NEW
});
},
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_NEW,
params: {
repositoryId: this.repositoryId
}
});
this.$emit('click', id);
}
}
});
</script>
<style lang="scss" scoped>
.panel {
display: flex;
flex-direction: column;
align-items: flex-end;
padding: 15px;
width: 300px;
height: 100%;
border-right: 1px solid #eee;
overflow-y: scroll;
.repositories {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
.repository {
width: 100%;
height: 55px;
display: flex;
flex-direction: row;
padding: 10px;
margin-bottom: 5px;
border: 1px dashed hsl(0, 0%, 93%);
line-height: 30px;
border-radius: 10px;
color: #666;
cursor: pointer;
&.active,
&:hover {
background-color: #eee;
}
.icons {
width: 30px;
padding-left: 10px;
.icon {
font-size: 14px;
}
}
.title {
flex: 1;
font-size: 14px;
line-height: 32px;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 8px;
color: #666;
}
.operations {
width: 40px;
.icon {
cursor: pointer;
font-size: 14px;
margin-right: 6px;
}
}
}
}
}
</style>
+105
View File
@@ -0,0 +1,105 @@
<template>
<el-dialog v-model="dialogVisible">
<el-upload
v-model:file-list="fileList"
accept=".docx,.doc,.pdf,.txt"
drag
:class="{
upload: true
}"
name="file"
:show-file-list="true"
:limit="1"
:multiple="false"
action="/api/v1/files/"
:on-exceed="onExceed"
:on-error="onError"
:on-success="onSuccess"
:headers="headers"
>
<el-icon v-if="!learning" class="el-icon--upload"><upload-filled /></el-icon>
<div v-if="!learning" class="el-upload__text">{{ $t('chatdoc.message.dragOrClickToUpload') }}</div>
<div v-if="learning">{{ $t('chatdoc.message.learningDocument') }}</div>
</el-upload>
</el-dialog>
<el-button type="primary" @click="dialogVisible = true">{{ $t('chatdoc.button.uploadDocuments') }}</el-button>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElButton, ElDialog, ElUpload, ElIcon, ElMessage, UploadFiles } from 'element-plus';
import { UploadFilled } from '@element-plus/icons-vue';
interface IData {
dialogVisible: boolean;
fileList: UploadFiles;
learning: boolean;
}
export default defineComponent({
name: 'UploadDocument',
components: {
ElButton,
ElDialog,
ElUpload,
ElIcon,
UploadFilled
},
data(): IData {
return {
dialogVisible: false,
fileList: [],
learning: false
};
},
computed: {
headers() {
return {
Authorization: `Bearer ${this.$store.state.token.access}`
};
},
urls(): string[] {
// @ts-ignore
return this.fileList.map((file: UploadFile) => file?.response?.file_url);
}
},
async mounted() {},
methods: {
onExceed() {
ElMessage.warning(this.$t('chatdoc.message.uploadDocumentsExceed'));
},
onError() {
ElMessage.error(this.$t('chatdoc.message.uploadDocumentsError'));
},
async onSuccess() {
ElMessage.success(this.$t('chatdoc.message.uploadDocumentsSuccess'));
ElMessage.info(this.$t('chatdoc.message.startCreateDocument'));
this.learning = true;
this.$store
.dispatch('chatdoc/createDocument', {
repositoryId: this.$route.params.repositoryId,
fileUrl: this.urls[0],
fileName: this.fileList[0].name
})
.then(() => {
ElMessage.success(this.$t('chatdoc.message.createDocumentSuccess'));
this.dialogVisible = false;
this.$store.dispatch('chatdoc/getDocuments', { repositoryId: this.$route.params.repositoryId });
})
.catch(() => {
ElMessage.error(this.$t('chatdoc.message.createDocumentError'));
})
.finally(() => {
this.fileList = [];
this.learning = false;
});
}
}
});
</script>
<style scoped lang="scss">
.el-button {
border-radius: 20px;
}
</style>
+16 -2
View File
@@ -76,6 +76,10 @@ import { defineComponent } from 'vue';
import { ElButton, ElTooltip, ElMenu, ElMenuItem } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import {
ROUTE_CHATDOC_INDEX,
ROUTE_CHATDOC_CONVERSATION,
ROUTE_CHATDOC_MANAGE,
ROUTE_CHATDOC_SETTING,
ROUTE_CHAT_CONVERSATION,
ROUTE_CHAT_CONVERSATION_NEW,
ROUTE_CONSOLE_ROOT,
@@ -106,7 +110,6 @@ export default defineComponent({
},
displayName: this.$t('common.nav.chat'),
icon: 'fa-regular fa-comment',
image: 'https://cdn.zhishuyun.com/9ad12c99b2.png/thumb_100x100',
routes: [ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW]
});
}
@@ -117,11 +120,21 @@ export default defineComponent({
},
displayName: this.$t('common.nav.midjourney'),
icon: 'fa-solid fa-palette',
image: 'https://cdn.zhishuyun.com/83ee211091.png/thumb_100x100',
routes: [ROUTE_MIDJOURNEY_INDEX, ROUTE_MIDJOURNEY_HISTORY]
});
}
if (this.$config.navigation?.chatdoc) {
links.push({
route: {
name: ROUTE_CHATDOC_INDEX
},
displayName: this.$t('common.nav.chatdoc'),
icon: 'fa-solid fa-file-lines',
routes: [ROUTE_CHATDOC_INDEX, ROUTE_CHATDOC_CONVERSATION, ROUTE_CHATDOC_MANAGE, ROUTE_CHATDOC_SETTING]
});
}
return {
links,
activeIndex: this.$route.name as string
@@ -173,6 +186,7 @@ export default defineComponent({
await this.$store.dispatch('resetAll');
await this.$store.dispatch('chat/resetAll');
await this.$store.dispatch('midjourney/resetAll');
await this.$store.dispatch('chatdoc/resetAll');
},
onConsole() {
this.$router.push({ name: ROUTE_CONSOLE_ROOT });