fix: update logout behavior to redirect to login page and clean up formatting in ChatHistoryDrawer.vue and ResetPasswordDrawer.vue
This commit is contained in:
parent
ee8412f34d
commit
9cce06b9f1
@ -138,7 +138,7 @@ const openResetPassword = () => {
|
|||||||
|
|
||||||
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
||||||
chatAPI.resetCurrentPassword(param).then(() => {
|
chatAPI.resetCurrentPassword(param).then(() => {
|
||||||
logout()
|
router.push({name: 'login'})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,9 +102,7 @@ function resetPassword() {
|
|||||||
resetPasswordFormRef.value?.validate().then(() => {
|
resetPasswordFormRef.value?.validate().then(() => {
|
||||||
chatAPI.resetCurrentPassword(resetPasswordForm.value).then(() => {
|
chatAPI.resetCurrentPassword(resetPasswordForm.value).then(() => {
|
||||||
MsgSuccess(t('common.modifySuccess'))
|
MsgSuccess(t('common.modifySuccess'))
|
||||||
chatUser.logout().then(() => {
|
router.push({name: 'login'})
|
||||||
router.push({ name: 'login' })
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,16 +40,16 @@
|
|||||||
chatUser.chat_profile.authentication_type === 'password'
|
chatUser.chat_profile.authentication_type === 'password'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-dropdown v-else trigger="click" type="primary" class="w-full">
|
<el-dropdown v-else trigger="click" type="primary" class="w-full">
|
||||||
<div class="flex align-center">
|
<div class="flex align-center">
|
||||||
<el-avatar :size="32">
|
<el-avatar :size="32">
|
||||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<span v-show="!isPcCollapse" class="ml-8 color-text-primary">{{
|
<span v-show="!isPcCollapse" class="ml-8 color-text-primary">{{
|
||||||
chatUser.chatUserProfile?.nick_name
|
chatUser.chatUserProfile?.nick_name
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<div class="flex align-center p-8">
|
<div class="flex align-center p-8">
|
||||||
<div class="mr-8 flex align-center">
|
<div class="mr-8 flex align-center">
|
||||||
<el-avatar :size="40">
|
<el-avatar :size="40">
|
||||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -73,7 +73,9 @@
|
|||||||
style="padding-top: 8px; padding-bottom: 8px"
|
style="padding-top: 8px; padding-bottom: 8px"
|
||||||
@click="openResetPassword"
|
@click="openResetPassword"
|
||||||
>
|
>
|
||||||
<el-icon><Lock /></el-icon>
|
<el-icon>
|
||||||
|
<Lock/>
|
||||||
|
</el-icon>
|
||||||
{{ $t('views.login.resetPassword') }}
|
{{ $t('views.login.resetPassword') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@ -82,7 +84,7 @@
|
|||||||
style="padding-top: 8px; padding-bottom: 8px"
|
style="padding-top: 8px; padding-bottom: 8px"
|
||||||
@click="logout"
|
@click="logout"
|
||||||
>
|
>
|
||||||
<AppIcon iconName="app-export" />
|
<AppIcon iconName="app-export"/>
|
||||||
{{ $t('layout.logout') }}
|
{{ $t('layout.logout') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
@ -97,7 +99,7 @@
|
|||||||
@click="isPcCollapse = !isPcCollapse"
|
@click="isPcCollapse = !isPcCollapse"
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
|
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -105,13 +107,13 @@
|
|||||||
class="chat-pc__right chat-background"
|
class="chat-pc__right chat-background"
|
||||||
:style="{ backgroundImage: `url(${applicationDetail?.chat_background})` }"
|
:style="{ backgroundImage: `url(${applicationDetail?.chat_background})` }"
|
||||||
>
|
>
|
||||||
<div style="flex: 1">
|
<div style="flex: 1">
|
||||||
<div class="p-16-24 flex-between">
|
<div class="p-16-24 flex-between">
|
||||||
<h4 class="ellipsis-1" style="width: 66%">
|
<h4 class="ellipsis-1" style="width: 66%">
|
||||||
{{ currentChatName }}
|
{{ currentChatName }}
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<span class="flex align-center" v-if="currentRecordList.length">
|
<span class="flex align-center" v-if="currentRecordList.length">
|
||||||
<AppIcon
|
<AppIcon
|
||||||
v-if="paginationConfig.total"
|
v-if="paginationConfig.total"
|
||||||
iconName="app-chat-record"
|
iconName="app-chat-record"
|
||||||
@ -130,73 +132,73 @@
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item @click="exportMarkdown"
|
<el-dropdown-item @click="exportMarkdown"
|
||||||
>{{ $t('common.export') }} Markdown</el-dropdown-item
|
>{{ $t('common.export') }} Markdown</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item @click="exportHTML"
|
<el-dropdown-item @click="exportHTML"
|
||||||
>{{ $t('common.export') }} HTML</el-dropdown-item
|
>{{ $t('common.export') }} HTML</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
<div class="right-height chat-width">
|
|
||||||
<AiChat
|
|
||||||
ref="AiChatRef"
|
|
||||||
v-model:applicationDetails="applicationDetail"
|
|
||||||
:available="applicationAvailable"
|
|
||||||
type="ai-chat"
|
|
||||||
:appId="applicationDetail?.id"
|
|
||||||
:record="currentRecordList"
|
|
||||||
:chatId="currentChatId"
|
|
||||||
executionIsRightPanel
|
|
||||||
@refresh="refresh"
|
|
||||||
@scroll="handleScroll"
|
|
||||||
@open-execution-detail="openExecutionDetail"
|
|
||||||
@openParagraph="openKnowledgeSource"
|
|
||||||
@openParagraphDocument="openParagraphDocument"
|
|
||||||
>
|
|
||||||
</AiChat>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="right-height chat-width">
|
||||||
class="execution-detail-panel"
|
<AiChat
|
||||||
:style="`width: ${ rightPanelSize }px`"
|
ref="AiChatRef"
|
||||||
:resizable="false"
|
v-model:applicationDetails="applicationDetail"
|
||||||
collapsible
|
:available="applicationAvailable"
|
||||||
>
|
type="ai-chat"
|
||||||
<div class="p-16 flex-between border-b">
|
:appId="applicationDetail?.id"
|
||||||
<h4 class="medium ellipsis" :title="rightPanelTitle">{{ rightPanelTitle }}</h4>
|
:record="currentRecordList"
|
||||||
|
:chatId="currentChatId"
|
||||||
<div class="flex align-center">
|
executionIsRightPanel
|
||||||
|
@refresh="refresh"
|
||||||
|
@scroll="handleScroll"
|
||||||
|
@open-execution-detail="openExecutionDetail"
|
||||||
|
@openParagraph="openKnowledgeSource"
|
||||||
|
@openParagraphDocument="openParagraphDocument"
|
||||||
|
>
|
||||||
|
</AiChat>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="execution-detail-panel"
|
||||||
|
:style="`width: ${ rightPanelSize }px`"
|
||||||
|
:resizable="false"
|
||||||
|
collapsible
|
||||||
|
>
|
||||||
|
<div class="p-16 flex-between border-b">
|
||||||
|
<h4 class="medium ellipsis" :title="rightPanelTitle">{{ rightPanelTitle }}</h4>
|
||||||
|
|
||||||
|
<div class="flex align-center">
|
||||||
<span v-if="rightPanelType === 'paragraphDocument'" class="mr-4">
|
<span v-if="rightPanelType === 'paragraphDocument'" class="mr-4">
|
||||||
<el-button text>
|
<el-button text>
|
||||||
<el-icon> <Download /> </el-icon>
|
<el-icon> <Download/> </el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="rightPanelType === 'paragraphDocument'">
|
<span v-if="rightPanelType === 'paragraphDocument'">
|
||||||
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
|
<el-button text> <app-icon iconName="app-export" size="20"/></el-button>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<el-button text @click="closeExecutionDetail">
|
<el-button text @click="closeExecutionDetail">
|
||||||
<el-icon size="20"><Close /></el-icon
|
<el-icon size="20"><Close/></el-icon
|
||||||
></el-button>
|
></el-button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="execution-detail-content" v-loading="rightPanelLoading">
|
|
||||||
<ParagraphSourceContent
|
|
||||||
v-if="rightPanelType === 'knowledgeSource'"
|
|
||||||
:detail="rightPanelDetail"
|
|
||||||
/>
|
|
||||||
<ExecutionDetailContent
|
|
||||||
v-if="rightPanelType === 'executionDetail'"
|
|
||||||
:detail="executionDetail"
|
|
||||||
:type="applicationDetail?.type"
|
|
||||||
/>
|
|
||||||
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="execution-detail-content" v-loading="rightPanelLoading">
|
||||||
|
<ParagraphSourceContent
|
||||||
|
v-if="rightPanelType === 'knowledgeSource'"
|
||||||
|
:detail="rightPanelDetail"
|
||||||
|
/>
|
||||||
|
<ExecutionDetailContent
|
||||||
|
v-if="rightPanelType === 'executionDetail'"
|
||||||
|
:detail="executionDetail"
|
||||||
|
:type="applicationDetail?.type"
|
||||||
|
/>
|
||||||
|
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -209,27 +211,30 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, nextTick, computed, watch } from 'vue'
|
import {ref, onMounted, nextTick, computed, watch} from 'vue'
|
||||||
import { marked } from 'marked'
|
import {marked} from 'marked'
|
||||||
import { saveAs } from 'file-saver'
|
import {saveAs} from 'file-saver'
|
||||||
import chatAPI from '@/api/chat/chat'
|
import chatAPI from '@/api/chat/chat'
|
||||||
|
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import useResize from '@/layout/hooks/useResize'
|
import useResize from '@/layout/hooks/useResize'
|
||||||
import { hexToRgba } from '@/utils/theme'
|
import {hexToRgba} from '@/utils/theme'
|
||||||
import { useRouter } from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
|
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
|
||||||
import { t } from '@/locales'
|
import {t} from '@/locales'
|
||||||
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
|
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
|
||||||
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
|
import ExecutionDetailContent
|
||||||
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
|
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
|
||||||
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
|
import ParagraphSourceContent
|
||||||
|
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
|
||||||
|
import ParagraphDocumentContent
|
||||||
|
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
|
||||||
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
|
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
|
||||||
import { cloneDeep } from 'lodash'
|
import {cloneDeep} from 'lodash'
|
||||||
|
|
||||||
useResize()
|
useResize()
|
||||||
|
|
||||||
const { common, chatUser } = useStore()
|
const {common, chatUser} = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const isCollapse = ref(false)
|
const isCollapse = ref(false)
|
||||||
@ -245,7 +250,7 @@ watch(
|
|||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
chatUser.logout().then(() => {
|
chatUser.logout().then(() => {
|
||||||
router.push({ name: 'login' })
|
router.push({name: 'login'})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +261,7 @@ const openResetPassword = () => {
|
|||||||
|
|
||||||
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
||||||
chatAPI.resetCurrentPassword(param).then(() => {
|
chatAPI.resetCurrentPassword(param).then(() => {
|
||||||
logout()
|
router.push({name: 'login'})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +289,8 @@ const applicationDetail = computed({
|
|||||||
get: () => {
|
get: () => {
|
||||||
return props.application_profile
|
return props.application_profile
|
||||||
},
|
},
|
||||||
set: (v) => {},
|
set: (v) => {
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const chatLogData = ref<any[]>([])
|
const chatLogData = ref<any[]>([])
|
||||||
@ -305,6 +311,7 @@ function refreshFieldTitle(chatId: string, abstract: string) {
|
|||||||
find.abstract = abstract
|
find.abstract = abstract
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteLog(row: any) {
|
function deleteLog(row: any) {
|
||||||
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
||||||
if (currentChatId.value === row.id) {
|
if (currentChatId.value === row.id) {
|
||||||
@ -435,7 +442,7 @@ async function exportMarkdown(): Promise<void> {
|
|||||||
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
|
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
|
||||||
.join('\n')
|
.join('\n')
|
||||||
|
|
||||||
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
|
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
|
||||||
saveAs(blob, suggestedName)
|
saveAs(blob, suggestedName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +453,7 @@ async function exportHTML(): Promise<void> {
|
|||||||
.join('\n')
|
.join('\n')
|
||||||
const htmlContent: any = marked(markdownContent)
|
const htmlContent: any = marked(markdownContent)
|
||||||
|
|
||||||
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
|
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
|
||||||
saveAs(blob, suggestedName)
|
saveAs(blob, suggestedName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,6 +473,7 @@ const rightPanelType = ref('')
|
|||||||
const rightPanelLoading = ref(false)
|
const rightPanelLoading = ref(false)
|
||||||
const executionDetail = ref<any[]>([])
|
const executionDetail = ref<any[]>([])
|
||||||
const rightPanelDetail = ref<any>()
|
const rightPanelDetail = ref<any>()
|
||||||
|
|
||||||
async function openExecutionDetail(row: any) {
|
async function openExecutionDetail(row: any) {
|
||||||
rightPanelSize.value = 400
|
rightPanelSize.value = 400
|
||||||
rightPanelTitle.value = t('chat.executionDetails.title')
|
rightPanelTitle.value = t('chat.executionDetails.title')
|
||||||
@ -534,10 +542,12 @@ function closeExecutionDetail() {
|
|||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.execution-detail-content {
|
.execution-detail-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: calc(100% - 63px);
|
height: calc(100% - 63px);
|
||||||
|
|
||||||
.execution-details {
|
.execution-details {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
@ -550,6 +560,7 @@ function closeExecutionDetail() {
|
|||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1000px) {
|
@media only screen and (max-width: 1000px) {
|
||||||
.chat-width {
|
.chat-width {
|
||||||
max-width: 100% !important;
|
max-width: 100% !important;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user