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,12 +40,12 @@
|
|||||||
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
|
||||||
@ -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>
|
||||||
@ -171,15 +173,15 @@
|
|||||||
<div class="flex align-center">
|
<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>
|
||||||
@ -194,7 +196,7 @@
|
|||||||
:detail="executionDetail"
|
:detail="executionDetail"
|
||||||
:type="applicationDetail?.type"
|
:type="applicationDetail?.type"
|
||||||
/>
|
/>
|
||||||
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
|
<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