Skip to content

Commit 9cce06b

Browse files
committed
fix: update logout behavior to redirect to login page and clean up formatting in ChatHistoryDrawer.vue and ResetPasswordDrawer.vue
1 parent ee8412f commit 9cce06b

File tree

3 files changed

+94
-85
lines changed

3 files changed

+94
-85
lines changed

ui/src/views/chat/embed/component/ChatHistoryDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const openResetPassword = () => {
138138
139139
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
140140
chatAPI.resetCurrentPassword(param).then(() => {
141-
logout()
141+
router.push({name: 'login'})
142142
})
143143
}
144144

ui/src/views/chat/mobile/component/ResetPasswordDrawer.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ function resetPassword() {
102102
resetPasswordFormRef.value?.validate().then(() => {
103103
chatAPI.resetCurrentPassword(resetPasswordForm.value).then(() => {
104104
MsgSuccess(t('common.modifySuccess'))
105-
chatUser.logout().then(() => {
106-
router.push({ name: 'login' })
107-
})
105+
router.push({name: 'login'})
108106
})
109107
})
110108
}

ui/src/views/chat/pc/index.vue

Lines changed: 92 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@
4040
chatUser.chat_profile.authentication_type === 'password'
4141
"
4242
>
43-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
43+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
4444
</el-avatar>
4545
<el-dropdown v-else trigger="click" type="primary" class="w-full">
4646
<div class="flex align-center">
4747
<el-avatar :size="32">
48-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
48+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
4949
</el-avatar>
5050
<span v-show="!isPcCollapse" class="ml-8 color-text-primary">{{
51-
chatUser.chatUserProfile?.nick_name
52-
}}</span>
51+
chatUser.chatUserProfile?.nick_name
52+
}}</span>
5353
</div>
5454

5555
<template #dropdown>
5656
<el-dropdown-menu style="min-width: 260px">
5757
<div class="flex align-center p-8">
5858
<div class="mr-8 flex align-center">
5959
<el-avatar :size="40">
60-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
60+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
6161
</el-avatar>
6262
</div>
6363
<div>
@@ -73,7 +73,9 @@
7373
style="padding-top: 8px; padding-bottom: 8px"
7474
@click="openResetPassword"
7575
>
76-
<el-icon><Lock /></el-icon>
76+
<el-icon>
77+
<Lock/>
78+
</el-icon>
7779
{{ $t('views.login.resetPassword') }}
7880
</el-dropdown-item>
7981
<el-dropdown-item
@@ -82,7 +84,7 @@
8284
style="padding-top: 8px; padding-bottom: 8px"
8385
@click="logout"
8486
>
85-
<AppIcon iconName="app-export" />
87+
<AppIcon iconName="app-export"/>
8688
{{ $t('layout.logout') }}
8789
</el-dropdown-item>
8890
</el-dropdown-menu>
@@ -97,21 +99,21 @@
9799
@click="isPcCollapse = !isPcCollapse"
98100
>
99101
<el-icon>
100-
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
102+
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
101103
</el-icon>
102104
</el-button>
103105
</div>
104106
<div
105107
class="chat-pc__right chat-background"
106108
:style="{ backgroundImage: `url(${applicationDetail?.chat_background})` }"
107109
>
108-
<div style="flex: 1">
109-
<div class="p-16-24 flex-between">
110-
<h4 class="ellipsis-1" style="width: 66%">
111-
{{ currentChatName }}
112-
</h4>
110+
<div style="flex: 1">
111+
<div class="p-16-24 flex-between">
112+
<h4 class="ellipsis-1" style="width: 66%">
113+
{{ currentChatName }}
114+
</h4>
113115

114-
<span class="flex align-center" v-if="currentRecordList.length">
116+
<span class="flex align-center" v-if="currentRecordList.length">
115117
<AppIcon
116118
v-if="paginationConfig.total"
117119
iconName="app-chat-record"
@@ -130,73 +132,73 @@
130132
<template #dropdown>
131133
<el-dropdown-menu>
132134
<el-dropdown-item @click="exportMarkdown"
133-
>{{ $t('common.export') }} Markdown</el-dropdown-item
135+
>{{ $t('common.export') }} Markdown</el-dropdown-item
134136
>
135137
<el-dropdown-item @click="exportHTML"
136-
>{{ $t('common.export') }} HTML</el-dropdown-item
138+
>{{ $t('common.export') }} HTML</el-dropdown-item
137139
>
138140
</el-dropdown-menu>
139141
</template>
140142
</el-dropdown>
141143
</span>
142-
</div>
143-
<div class="right-height chat-width">
144-
<AiChat
145-
ref="AiChatRef"
146-
v-model:applicationDetails="applicationDetail"
147-
:available="applicationAvailable"
148-
type="ai-chat"
149-
:appId="applicationDetail?.id"
150-
:record="currentRecordList"
151-
:chatId="currentChatId"
152-
executionIsRightPanel
153-
@refresh="refresh"
154-
@scroll="handleScroll"
155-
@open-execution-detail="openExecutionDetail"
156-
@openParagraph="openKnowledgeSource"
157-
@openParagraphDocument="openParagraphDocument"
158-
>
159-
</AiChat>
160-
</div>
161144
</div>
162-
<div
163-
class="execution-detail-panel"
164-
:style="`width: ${ rightPanelSize }px`"
165-
:resizable="false"
166-
collapsible
167-
>
168-
<div class="p-16 flex-between border-b">
169-
<h4 class="medium ellipsis" :title="rightPanelTitle">{{ rightPanelTitle }}</h4>
170-
 
171-
<div class="flex align-center">
145+
<div class="right-height chat-width">
146+
<AiChat
147+
ref="AiChatRef"
148+
v-model:applicationDetails="applicationDetail"
149+
:available="applicationAvailable"
150+
type="ai-chat"
151+
:appId="applicationDetail?.id"
152+
:record="currentRecordList"
153+
:chatId="currentChatId"
154+
executionIsRightPanel
155+
@refresh="refresh"
156+
@scroll="handleScroll"
157+
@open-execution-detail="openExecutionDetail"
158+
@openParagraph="openKnowledgeSource"
159+
@openParagraphDocument="openParagraphDocument"
160+
>
161+
</AiChat>
162+
</div>
163+
</div>
164+
<div
165+
class="execution-detail-panel"
166+
:style="`width: ${ rightPanelSize }px`"
167+
:resizable="false"
168+
collapsible
169+
>
170+
<div class="p-16 flex-between border-b">
171+
<h4 class="medium ellipsis" :title="rightPanelTitle">{{ rightPanelTitle }}</h4>
172+
 
173+
<div class="flex align-center">
172174
<span v-if="rightPanelType === 'paragraphDocument'" class="mr-4">
173175
<el-button text>
174-
<el-icon> <Download /> </el-icon>
176+
<el-icon> <Download/> </el-icon>
175177
</el-button>
176178
</span>
177-
<span v-if="rightPanelType === 'paragraphDocument'">
178-
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
179+
<span v-if="rightPanelType === 'paragraphDocument'">
180+
<el-button text> <app-icon iconName="app-export" size="20"/></el-button>
179181
</span>
180-
<span>
182+
<span>
181183
<el-button text @click="closeExecutionDetail">
182-
<el-icon size="20"><Close /></el-icon
183-
></el-button>
184+
<el-icon size="20"><Close/></el-icon
185+
></el-button>
184186
</span>
185-
</div>
186-
</div>
187-
<div class="execution-detail-content" v-loading="rightPanelLoading">
188-
<ParagraphSourceContent
189-
v-if="rightPanelType === 'knowledgeSource'"
190-
:detail="rightPanelDetail"
191-
/>
192-
<ExecutionDetailContent
193-
v-if="rightPanelType === 'executionDetail'"
194-
:detail="executionDetail"
195-
:type="applicationDetail?.type"
196-
/>
197-
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
198187
</div>
199188
</div>
189+
<div class="execution-detail-content" v-loading="rightPanelLoading">
190+
<ParagraphSourceContent
191+
v-if="rightPanelType === 'knowledgeSource'"
192+
:detail="rightPanelDetail"
193+
/>
194+
<ExecutionDetailContent
195+
v-if="rightPanelType === 'executionDetail'"
196+
:detail="executionDetail"
197+
:type="applicationDetail?.type"
198+
/>
199+
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
200+
</div>
201+
</div>
200202
</div>
201203
</div>
202204

@@ -209,27 +211,30 @@
209211
</template>
210212

211213
<script setup lang="ts">
212-
import { ref, onMounted, nextTick, computed, watch } from 'vue'
213-
import { marked } from 'marked'
214-
import { saveAs } from 'file-saver'
214+
import {ref, onMounted, nextTick, computed, watch} from 'vue'
215+
import {marked} from 'marked'
216+
import {saveAs} from 'file-saver'
215217
import chatAPI from '@/api/chat/chat'
216218
217219
import useStore from '@/stores'
218220
import useResize from '@/layout/hooks/useResize'
219-
import { hexToRgba } from '@/utils/theme'
220-
import { useRouter } from 'vue-router'
221+
import {hexToRgba} from '@/utils/theme'
222+
import {useRouter} from 'vue-router'
221223
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
222-
import { t } from '@/locales'
223-
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
224-
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
225-
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
226-
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
224+
import {t} from '@/locales'
225+
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
226+
import ExecutionDetailContent
227+
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
228+
import ParagraphSourceContent
229+
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
230+
import ParagraphDocumentContent
231+
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
227232
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
228-
import { cloneDeep } from 'lodash'
233+
import {cloneDeep} from 'lodash'
229234
230235
useResize()
231236
232-
const { common, chatUser } = useStore()
237+
const {common, chatUser} = useStore()
233238
const router = useRouter()
234239
235240
const isCollapse = ref(false)
@@ -245,7 +250,7 @@ watch(
245250
246251
const logout = () => {
247252
chatUser.logout().then(() => {
248-
router.push({ name: 'login' })
253+
router.push({name: 'login'})
249254
})
250255
}
251256
@@ -256,7 +261,7 @@ const openResetPassword = () => {
256261
257262
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
258263
chatAPI.resetCurrentPassword(param).then(() => {
259-
logout()
264+
router.push({name: 'login'})
260265
})
261266
}
262267
@@ -284,7 +289,8 @@ const applicationDetail = computed({
284289
get: () => {
285290
return props.application_profile
286291
},
287-
set: (v) => {},
292+
set: (v) => {
293+
},
288294
})
289295
290296
const chatLogData = ref<any[]>([])
@@ -305,6 +311,7 @@ function refreshFieldTitle(chatId: string, abstract: string) {
305311
find.abstract = abstract
306312
}
307313
}
314+
308315
function deleteLog(row: any) {
309316
chatAPI.deleteChat(row.id, left_loading).then(() => {
310317
if (currentChatId.value === row.id) {
@@ -435,7 +442,7 @@ async function exportMarkdown(): Promise<void> {
435442
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
436443
.join('\n')
437444
438-
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
445+
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
439446
saveAs(blob, suggestedName)
440447
}
441448
@@ -446,7 +453,7 @@ async function exportHTML(): Promise<void> {
446453
.join('\n')
447454
const htmlContent: any = marked(markdownContent)
448455
449-
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
456+
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
450457
saveAs(blob, suggestedName)
451458
}
452459
@@ -466,6 +473,7 @@ const rightPanelType = ref('')
466473
const rightPanelLoading = ref(false)
467474
const executionDetail = ref<any[]>([])
468475
const rightPanelDetail = ref<any>()
476+
469477
async function openExecutionDetail(row: any) {
470478
rightPanelSize.value = 400
471479
rightPanelTitle.value = t('chat.executionDetails.title')
@@ -534,10 +542,12 @@ function closeExecutionDetail() {
534542
background: #ffffff;
535543
height: 100%;
536544
overflow: hidden;
545+
537546
.execution-detail-content {
538547
flex: 1;
539548
overflow: hidden;
540549
height: calc(100% - 63px);
550+
541551
.execution-details {
542552
padding: 16px;
543553
}
@@ -550,6 +560,7 @@ function closeExecutionDetail() {
550560
max-width: 80%;
551561
margin: 0 auto;
552562
}
563+
553564
@media only screen and (max-width: 1000px) {
554565
.chat-width {
555566
max-width: 100% !important;

0 commit comments

Comments
 (0)