Skip to content

Commit 5cb0b30

Browse files
fix: pdf
1 parent c1a403b commit 5cb0b30

File tree

2 files changed

+80
-75
lines changed
  • ui/src

2 files changed

+80
-75
lines changed

ui/src/components/ai-chat/component/knowledge-source-component/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<span class="medium ellipsis" :title="dialogTitle" :id="titleId" :class="titleClass">
9090
{{ dialogTitle }}
9191
</span>
92-
<div class="flex align-center mr-8" v-if="dialogType === 'pdfDocument'">
92+
<!-- <div class="flex align-center mr-8" v-if="dialogType === 'pdfDocument'">
9393
<span class="mr-4">
9494
<el-button text>
9595
<el-icon> <Download /> </el-icon>
@@ -99,7 +99,7 @@
9999
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
100100
</span>
101101
<el-divider direction="vertical" />
102-
</div>
102+
</div> -->
103103
</div>
104104
</template>
105105
<div class="mb-8">
@@ -149,7 +149,7 @@ const showPDF = (item: any) => {
149149
return (
150150
item.document_name.toLocaleLowerCase().endsWith('.pdf') &&
151151
item.meta?.source_file_id &&
152-
!props.executionIsRightPanel
152+
props.executionIsRightPanel
153153
)
154154
}
155155
const dialogVisible = ref(false)

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

Lines changed: 77 additions & 72 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>
@@ -75,7 +75,7 @@
7575
@click="openResetPassword"
7676
>
7777
<el-icon>
78-
<Lock/>
78+
<Lock />
7979
</el-icon>
8080
{{ $t('views.login.resetPassword') }}
8181
</el-dropdown-item>
@@ -85,7 +85,7 @@
8585
style="padding-top: 8px; padding-bottom: 8px"
8686
@click="logout"
8787
>
88-
<AppIcon iconName="app-export"/>
88+
<AppIcon iconName="app-export" />
8989
{{ $t('layout.logout') }}
9090
</el-dropdown-item>
9191
</el-dropdown-menu>
@@ -100,7 +100,7 @@
100100
@click="isPcCollapse = !isPcCollapse"
101101
>
102102
<el-icon>
103-
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
103+
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
104104
</el-icon>
105105
</el-button>
106106
</div>
@@ -115,33 +115,33 @@
115115
</h4>
116116

117117
<span class="flex align-center" v-if="currentRecordList.length">
118+
<AppIcon
119+
v-if="paginationConfig.total"
120+
iconName="app-chat-record"
121+
class="color-secondary mr-8"
122+
style="font-size: 16px"
123+
></AppIcon>
124+
<span v-if="paginationConfig.total" class="lighter">
125+
{{ paginationConfig.total }} {{ $t('chat.question_count') }}
126+
</span>
127+
<el-dropdown class="ml-8">
118128
<AppIcon
119-
v-if="paginationConfig.total"
120-
iconName="app-chat-record"
121-
class="color-secondary mr-8"
122-
style="font-size: 16px"
129+
iconName="app-export"
130+
class="cursor"
131+
:title="$t('chat.exportRecords')"
123132
></AppIcon>
124-
<span v-if="paginationConfig.total" class="lighter">
125-
{{ paginationConfig.total }} {{ $t('chat.question_count') }}
126-
</span>
127-
<el-dropdown class="ml-8">
128-
<AppIcon
129-
iconName="app-export"
130-
class="cursor"
131-
:title="$t('chat.exportRecords')"
132-
></AppIcon>
133-
<template #dropdown>
134-
<el-dropdown-menu>
135-
<el-dropdown-item @click="exportMarkdown"
133+
<template #dropdown>
134+
<el-dropdown-menu>
135+
<el-dropdown-item @click="exportMarkdown"
136136
>{{ $t('common.export') }} Markdown</el-dropdown-item
137-
>
138-
<el-dropdown-item @click="exportHTML"
137+
>
138+
<el-dropdown-item @click="exportHTML"
139139
>{{ $t('common.export') }} HTML</el-dropdown-item
140-
>
141-
</el-dropdown-menu>
142-
</template>
143-
</el-dropdown>
144-
</span>
140+
>
141+
</el-dropdown-menu>
142+
</template>
143+
</el-dropdown>
144+
</span>
145145
</div>
146146
<div class="right-height chat-width">
147147
<AiChat
@@ -164,27 +164,37 @@
164164
</div>
165165
<div
166166
class="execution-detail-panel"
167-
:style="`width: ${ rightPanelSize }px`"
167+
:style="`width: ${rightPanelSize}px`"
168168
:resizable="false"
169169
collapsible
170170
>
171171
<div class="p-16 flex-between border-b">
172172
<h4 class="medium ellipsis" :title="rightPanelTitle">{{ rightPanelTitle }}</h4>
173173

174174
<div class="flex align-center">
175-
<span v-if="rightPanelType === 'paragraphDocument'" class="mr-4">
175+
<span v-if="rightPanelType === 'paragraphDocument'" class="mr-4">
176+
<a
177+
:href="
178+
getFileUrl(rightPanelDetail?.meta?.source_file_id) ||
179+
rightPanelDetail?.meta?.source_url
180+
"
181+
target="_blank"
182+
class="ellipsis-1"
183+
:title="rightPanelDetail?.document_name?.trim()"
184+
>
176185
<el-button text>
177-
<el-icon> <Download/> </el-icon>
186+
<el-icon> <Download /> </el-icon>
178187
</el-button>
179-
</span>
180-
<span v-if="rightPanelType === 'paragraphDocument'">
181-
<el-button text> <app-icon iconName="app-export" size="20"/></el-button>
182-
</span>
188+
</a>
189+
</span>
190+
<!-- <span v-if="rightPanelType === 'paragraphDocument'">
191+
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
192+
</span> -->
183193
<span>
184-
<el-button text @click="closeExecutionDetail">
185-
<el-icon size="20"><Close/></el-icon
186-
></el-button>
187-
</span>
194+
<el-button text @click="closeExecutionDetail">
195+
<el-icon size="20"><Close /></el-icon
196+
></el-button>
197+
</span>
188198
</div>
189199
</div>
190200
<div class="execution-detail-content" v-loading="rightPanelLoading">
@@ -197,7 +207,7 @@
197207
:detail="executionDetail"
198208
:type="applicationDetail?.type"
199209
/>
200-
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
210+
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
201211
</div>
202212
</div>
203213
</div>
@@ -212,30 +222,27 @@
212222
</template>
213223

214224
<script setup lang="ts">
215-
import {ref, onMounted, nextTick, computed, watch} from 'vue'
216-
import {marked} from 'marked'
217-
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'
218228
import chatAPI from '@/api/chat/chat'
219229
220230
import useStore from '@/stores'
221231
import useResize from '@/layout/hooks/useResize'
222-
import {hexToRgba} from '@/utils/theme'
223-
import {useRouter} from 'vue-router'
232+
import { hexToRgba } from '@/utils/theme'
233+
import { useRouter } from 'vue-router'
224234
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
225-
import {t} from '@/locales'
226-
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
227-
import ExecutionDetailContent
228-
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
229-
import ParagraphSourceContent
230-
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
231-
import ParagraphDocumentContent
232-
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
235+
import { t } from '@/locales'
236+
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
237+
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
238+
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
239+
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
233240
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
234-
import {cloneDeep} from 'lodash'
235-
241+
import { cloneDeep } from 'lodash'
242+
import { getFileUrl } from '@/utils/common'
236243
useResize()
237244
238-
const {common, chatUser} = useStore()
245+
const { common, chatUser } = useStore()
239246
const router = useRouter()
240247
241248
const isCollapse = ref(false)
@@ -251,7 +258,7 @@ watch(
251258
252259
const logout = () => {
253260
chatUser.logout().then(() => {
254-
router.push({name: 'login'})
261+
router.push({ name: 'login' })
255262
})
256263
}
257264
@@ -262,7 +269,7 @@ const openResetPassword = () => {
262269
263270
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
264271
chatAPI.resetCurrentPassword(param).then(() => {
265-
router.push({name: 'login'})
272+
router.push({ name: 'login' })
266273
})
267274
}
268275
@@ -290,8 +297,7 @@ const applicationDetail = computed({
290297
get: () => {
291298
return props.application_profile
292299
},
293-
set: (v) => {
294-
},
300+
set: (v) => {},
295301
})
296302
297303
const chatLogData = ref<any[]>([])
@@ -326,15 +332,14 @@ function deleteLog(row: any) {
326332
})
327333
}
328334
329-
330335
function clearChat() {
331-
chatAPI.clearChat(left_loading, ).then(() => {
336+
chatAPI.clearChat(left_loading).then(() => {
332337
currentChatId.value = 'new'
333-
currentChatName.value = t('chat.createChat')
334-
paginationConfig.value.current_page = 1
335-
paginationConfig.value.total = 0
336-
currentRecordList.value = []
337-
getChatLog(applicationDetail.value.id)
338+
currentChatName.value = t('chat.createChat')
339+
paginationConfig.value.current_page = 1
340+
paginationConfig.value.total = 0
341+
currentRecordList.value = []
342+
getChatLog(applicationDetail.value.id)
338343
})
339344
}
340345
@@ -455,7 +460,7 @@ async function exportMarkdown(): Promise<void> {
455460
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
456461
.join('\n')
457462
458-
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
463+
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
459464
saveAs(blob, suggestedName)
460465
}
461466
@@ -466,7 +471,7 @@ async function exportHTML(): Promise<void> {
466471
.join('\n')
467472
const htmlContent: any = marked(markdownContent)
468473
469-
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
474+
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
470475
saveAs(blob, suggestedName)
471476
}
472477

0 commit comments

Comments
 (0)