fix: 修复历史记录不显示图片的缺陷

--bug=1050151 --user=王孝刚 【应用】演示界面、全屏嵌入、浮窗嵌入历史记录和对话日志中不显示上传的图片 https://www.tapd.cn/57709429/s/1627628

(cherry picked from commit adad526a4f)
This commit is contained in:
wxg0103 2024-12-10 15:44:37 +08:00 committed by shaohuzhang1
parent d5c701277b
commit 347689efef

View File

@ -20,7 +20,10 @@
<template v-for="(item, index) in document_list" :key="index">
<el-card shadow="never" style="--el-card-padding: 8px" class="download-file cursor">
<div class="download-button flex align-center" @click="downloadFile(item)">
<el-icon class="mr-4"><Download /></el-icon>
<el-icon class="mr-4">
<Download />
</el-icon>
点击下载文件
</div>
<div class="show flex align-center">
<img :src="getImgUrl(item && item?.name)" alt="" width="24" />
@ -61,6 +64,7 @@
import { type chatType } from '@/api/type/application'
import { getImgUrl, getAttrsArray, downloadByURL } from '@/utils/utils'
import { onMounted, computed } from 'vue'
const props = defineProps<{
application: any
chatRecord: chatType
@ -68,20 +72,20 @@ const props = defineProps<{
const document_list = computed(() => {
if (props.chatRecord?.upload_meta) {
return props.chatRecord.upload_meta?.document_list || []
} else if (props.chatRecord.execution_details?.length > 0) {
return props.chatRecord.execution_details[0]?.document_list || []
} else {
return []
}
const startNode = props.chatRecord.execution_details?.find(
(detail) => detail.type === 'start-node'
)
return startNode?.document_list || []
})
const image_list = computed(() => {
if (props.chatRecord?.upload_meta) {
return props.chatRecord.upload_meta?.image_list || []
} else if (props.chatRecord.execution_details?.length > 0) {
return props.chatRecord.execution_details[0]?.image_list || []
} else {
return []
}
const startNode = props.chatRecord.execution_details?.find(
(detail) => detail.type === 'start-node'
)
return startNode?.image_list || []
})
function downloadFile(item: any) {
@ -94,21 +98,26 @@ onMounted(() => {})
.download-file {
width: 200px;
height: 43px;
&:hover {
color: var(--el-color-primary);
border: 1px solid var(--el-color-primary);
.download-button {
display: block;
text-align: center;
line-height: 26px;
}
.show {
display: none;
}
}
.show {
display: block;
}
.download-button {
display: none;
}