Skip to content

Commit 79b590d

Browse files
committed
fix: clean up code formatting and improve consistency in index.vue
1 parent 7683c39 commit 79b590d

File tree

1 file changed

+43
-31
lines changed

1 file changed

+43
-31
lines changed

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

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

5656
<template #dropdown>
5757
<el-dropdown-menu style="min-width: 260px">
5858
<div class="flex align-center p-8">
5959
<div class="mr-8 flex align-center">
6060
<el-avatar :size="40">
61-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
61+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
6262
</el-avatar>
6363
</div>
6464
<div>
@@ -83,7 +83,7 @@
8383
style="padding-top: 8px; padding-bottom: 8px"
8484
@click="logout"
8585
>
86-
<AppIcon iconName="app-export" class="color-secondary" />
86+
<AppIcon iconName="app-export" class="color-secondary"/>
8787
{{ $t('layout.logout') }}
8888
</el-dropdown-item>
8989
</el-dropdown-menu>
@@ -98,7 +98,7 @@
9898
@click="isPcCollapse = !isPcCollapse"
9999
>
100100
<el-icon>
101-
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
101+
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
102102
</el-icon>
103103
</el-button>
104104
</div>
@@ -134,13 +134,13 @@
134134
<template #dropdown>
135135
<el-dropdown-menu>
136136
<el-dropdown-item @click="exportMarkdown"
137-
>{{ $t('common.export') }} Markdown</el-dropdown-item
137+
>{{ $t('common.export') }} Markdown</el-dropdown-item
138138
>
139139
<el-dropdown-item @click="exportHTML"
140-
>{{ $t('common.export') }} HTML</el-dropdown-item
140+
>{{ $t('common.export') }} HTML</el-dropdown-item
141141
>
142142
<el-dropdown-item @click="openPDFExport"
143-
>{{ $t('common.export') }} PDF</el-dropdown-item
143+
>{{ $t('common.export') }} PDF</el-dropdown-item
144144
>
145145
</el-dropdown-menu>
146146
</template>
@@ -191,8 +191,8 @@
191191
</span> -->
192192
<span>
193193
<el-button text @click="closeExecutionDetail">
194-
<el-icon size="20"><Close /></el-icon
195-
></el-button>
194+
<el-icon size="20"><Close/></el-icon
195+
></el-button>
196196
</span>
197197
</div>
198198
</div>
@@ -206,7 +206,7 @@
206206
:detail="executionDetail"
207207
:appType="applicationDetail?.type"
208208
/>
209-
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
209+
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
210210
</div>
211211
</div>
212212
</div>
@@ -222,31 +222,36 @@
222222
</template>
223223

224224
<script setup lang="ts">
225-
import { ref, onMounted, nextTick, computed, watch } from 'vue'
226-
import { marked } from 'marked'
227-
import { saveAs } from 'file-saver'
225+
import {ref, onMounted, nextTick, computed, watch} from 'vue'
226+
import {marked} from 'marked'
227+
import {saveAs} from 'file-saver'
228228
import chatAPI from '@/api/chat/chat'
229229
import useStore from '@/stores'
230230
import useResize from '@/layout/hooks/useResize'
231-
import { hexToRgba } from '@/utils/theme'
232-
import { useRouter } from 'vue-router'
231+
import {hexToRgba} from '@/utils/theme'
232+
import {useRoute, useRouter} from 'vue-router'
233233
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
234-
import { t } from '@/locales'
235-
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
236-
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
237-
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
238-
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
234+
import {t} from '@/locales'
235+
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
236+
import ExecutionDetailContent
237+
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
238+
import ParagraphSourceContent
239+
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
240+
import ParagraphDocumentContent
241+
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
239242
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
240-
import { cloneDeep } from 'lodash'
241-
import { getFileUrl } from '@/utils/common'
243+
import {cloneDeep} from 'lodash'
244+
import {getFileUrl} from '@/utils/common'
242245
import PdfExport from '@/components/pdf-export/index.vue'
246+
243247
useResize()
244248
const pdfExportRef = ref<InstanceType<typeof PdfExport>>()
245-
const { common, chatUser } = useStore()
249+
const {common, chatUser} = useStore()
246250
const router = useRouter()
247251
const openPDFExport = () => {
248252
pdfExportRef.value?.open(document.getElementById('chatListId'))
249253
}
254+
const route = useRoute()
250255
const isCollapse = ref(false)
251256
const isPcCollapse = ref(false)
252257
watch(
@@ -260,7 +265,10 @@ watch(
260265
261266
const logout = () => {
262267
chatUser.logout().then(() => {
263-
router.push({ name: 'login' })
268+
router.push({
269+
name: 'login',
270+
query: route.query,
271+
})
264272
})
265273
}
266274
@@ -271,7 +279,7 @@ const openResetPassword = () => {
271279
272280
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
273281
chatAPI.resetCurrentPassword(param).then(() => {
274-
router.push({ name: 'login' })
282+
router.push({name: 'login'})
275283
})
276284
}
277285
@@ -299,7 +307,8 @@ const applicationDetail = computed({
299307
get: () => {
300308
return props.application_profile
301309
},
302-
set: (v) => {},
310+
set: (v) => {
311+
},
303312
})
304313
305314
const chatLogData = ref<any[]>([])
@@ -461,7 +470,7 @@ async function exportMarkdown(): Promise<void> {
461470
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
462471
.join('\n')
463472
464-
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
473+
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
465474
saveAs(blob, suggestedName)
466475
}
467476
@@ -472,7 +481,7 @@ async function exportHTML(): Promise<void> {
472481
.join('\n')
473482
const htmlContent: any = marked(markdownContent)
474483
475-
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
484+
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
476485
saveAs(blob, suggestedName)
477486
}
478487
@@ -578,13 +587,16 @@ function closeExecutionDetail() {
578587
max-width: 80%;
579588
margin: 0 auto;
580589
}
590+
581591
.chat-pc__right {
582592
width: calc(100vw - 280px);
583593
--execution-detail-panel-width: 400px;
594+
584595
.execution-detail-panel {
585596
width: var(--execution-detail-panel-width, 400px);
586597
}
587598
}
599+
588600
@media only screen and (max-width: 1000px) {
589601
.chat-width {
590602
max-width: 100% !important;

0 commit comments

Comments
 (0)