Skip to content

Commit cc52925

Browse files
committed
fix: clean up formatting and remove unnecessary whitespace in index.vue
1 parent 1a7bdd5 commit cc52925

1 file changed

Lines changed: 43 additions & 31 deletions

File tree

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

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

5858
<template #dropdown>
5959
<el-dropdown-menu style="min-width: 260px">
6060
<div class="flex align-center p-8">
6161
<div class="mr-8 flex align-center">
6262
<el-avatar :size="40">
63-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
63+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
6464
</el-avatar>
6565
</div>
6666
<div>
@@ -84,7 +84,7 @@
8484
style="padding-top: 8px; padding-bottom: 8px"
8585
@click="logout"
8686
>
87-
<AppIcon iconName="app-export" class="color-secondary" />
87+
<AppIcon iconName="app-export" class="color-secondary"/>
8888
{{ $t('layout.logout') }}
8989
</el-dropdown-item>
9090
</el-dropdown-menu>
@@ -99,7 +99,7 @@
9999
@click="isPcCollapse = !isPcCollapse"
100100
>
101101
<el-icon>
102-
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
102+
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
103103
</el-icon>
104104
</el-button>
105105
</div>
@@ -148,13 +148,13 @@
148148
<template #dropdown>
149149
<el-dropdown-menu>
150150
<el-dropdown-item @click="exportMarkdown"
151-
>{{ $t('common.export') }} Markdown</el-dropdown-item
151+
>{{ $t('common.export') }} Markdown</el-dropdown-item
152152
>
153153
<el-dropdown-item @click="exportHTML"
154-
>{{ $t('common.export') }} HTML</el-dropdown-item
154+
>{{ $t('common.export') }} HTML</el-dropdown-item
155155
>
156156
<el-dropdown-item @click="openPDFExport"
157-
>{{ $t('common.export') }} PDF</el-dropdown-item
157+
>{{ $t('common.export') }} PDF</el-dropdown-item
158158
>
159159
</el-dropdown-menu>
160160
</template>
@@ -208,8 +208,8 @@
208208
</span> -->
209209
<span>
210210
<el-button text @click="closeExecutionDetail">
211-
<el-icon size="20"><Close /></el-icon
212-
></el-button>
211+
<el-icon size="20"><Close/></el-icon
212+
></el-button>
213213
</span>
214214
</div>
215215
</div>
@@ -225,7 +225,7 @@
225225
:detail="executionDetail"
226226
:appType="applicationDetail?.type"
227227
/>
228-
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
228+
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
229229
</el-scrollbar>
230230
</div>
231231
</div>
@@ -242,31 +242,36 @@
242242
</template>
243243

244244
<script setup lang="ts">
245-
import { ref, onMounted, nextTick, computed, watch, provide } from 'vue'
246-
import { marked } from 'marked'
247-
import { saveAs } from 'file-saver'
245+
import {ref, onMounted, nextTick, computed, watch, provide} from 'vue'
246+
import {marked} from 'marked'
247+
import {saveAs} from 'file-saver'
248248
import chatAPI from '@/api/chat/chat'
249249
import useStore from '@/stores'
250250
import useResize from '@/layout/hooks/useResize'
251-
import { hexToRgba } from '@/utils/theme'
252-
import { useRoute, useRouter } from 'vue-router'
251+
import {hexToRgba} from '@/utils/theme'
252+
import {useRoute, useRouter} from 'vue-router'
253253
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
254-
import { t } from '@/locales'
255-
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
256-
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
257-
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
258-
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
254+
import {t} from '@/locales'
255+
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
256+
import ExecutionDetailContent
257+
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
258+
import ParagraphSourceContent
259+
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
260+
import ParagraphDocumentContent
261+
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
259262
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
260-
import { cloneDeep } from 'lodash'
261-
import { getFileUrl } from '@/utils/common'
263+
import {cloneDeep} from 'lodash'
264+
import {getFileUrl} from '@/utils/common'
262265
import PdfExport from '@/components/pdf-export/index.vue'
266+
import JSEncrypt from "jsencrypt";
263267
268+
const {user} = useStore()
264269
useResize()
265270
266271
provide('scrollData', loadInfiniteScroll)
267272
provide('chatLogPagination', () => chatLogPagination)
268273
const pdfExportRef = ref<InstanceType<typeof PdfExport>>()
269-
const { common, chatUser } = useStore()
274+
const {common, chatUser} = useStore()
270275
const router = useRouter()
271276
const openPDFExport = () => {
272277
pdfExportRef.value?.open(document.getElementById('chatListId'))
@@ -301,8 +306,13 @@ const openResetPassword = () => {
301306
}
302307
303308
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
304-
chatAPI.resetCurrentPassword(param).then(() => {
305-
router.push({ name: 'login' })
309+
const JSEncryptCtor = (JSEncrypt as any)?.default ? (JSEncrypt as any).default : JSEncrypt;
310+
const js = new (JSEncryptCtor as any)();
311+
js.setPublicKey(user.rsaKey);
312+
const jsonData = JSON.stringify(param);
313+
const encryptedBase64 = js.encrypt(jsonData);
314+
chatAPI.resetCurrentPassword({encryptedData: encryptedBase64}).then(() => {
315+
router.push({name: 'login'})
306316
})
307317
}
308318
@@ -329,7 +339,8 @@ const applicationDetail = computed({
329339
get: () => {
330340
return props.application_profile
331341
},
332-
set: (v) => {},
342+
set: (v) => {
343+
},
333344
})
334345
335346
const chatLogData = ref<any[]>([])
@@ -413,6 +424,7 @@ const chatLogPagination = ref({
413424
page_size: 20,
414425
current_page: 1,
415426
})
427+
416428
function getChatLog(refresh?: boolean) {
417429
chatAPI
418430
.pageChat(chatLogPagination.value.current_page, chatLogPagination.value.page_size, left_loading)
@@ -509,7 +521,7 @@ async function exportMarkdown(): Promise<void> {
509521
})
510522
.join('\n')
511523
512-
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
524+
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
513525
saveAs(blob, suggestedName)
514526
}
515527
@@ -531,7 +543,7 @@ async function exportHTML(): Promise<void> {
531543
.join('\n')
532544
const htmlContent: any = marked(markdownContent)
533545
534-
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
546+
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
535547
saveAs(blob, suggestedName)
536548
}
537549

0 commit comments

Comments
 (0)