Skip to content

Commit 452c874

Browse files
committed
fix: 修复引用分段详情弹框和执行详情里的文档名称不能点的缺陷
--bug=1049682 --user=王孝刚 【应用】引用分段详情弹框和执行详情里的文档名称不能点 https://www.tapd.cn/57709429/s/1619877
1 parent c3d92e8 commit 452c874

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

ui/src/components/ai-chat/KnowledgeSource.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
</div>
2121
<div class="ml-8" v-else>
2222
<a
23-
@click="openLink(item.source_url)"
23+
:href="
24+
item.source_url && !item.source_url.endsWith('/')
25+
? item.source_url + '/'
26+
: item.source_url
27+
"
28+
target="_blank"
2429
class="ellipsis"
2530
:title="item?.document_name?.trim()"
2631
>
@@ -98,14 +103,6 @@ const uniqueParagraphList = computed(() => {
98103
}) || []
99104
)
100105
})
101-
102-
function openLink(url: string) {
103-
// 如果url不是以/结尾,加上/
104-
if (url && !url.endsWith('/')) {
105-
url += '/'
106-
}
107-
window.open(url, '_blank')
108-
}
109106
</script>
110107
<style lang="scss" scoped>
111108
.source_dataset-button {

ui/src/components/ai-chat/component/ParagraphCard.vue

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,25 @@
2020
<el-text class="flex align-center" style="width: 70%">
2121
<img :src="getImgUrl(data?.document_name?.trim())" alt="" width="20" class="mr-4" />
2222

23-
<span class="ellipsis" :title="data?.document_name?.trim()">
24-
{{ data?.document_name.trim() }}</span
25-
>
23+
<template v-if="meta?.source_url">
24+
<a
25+
:href="
26+
meta?.source_url && !meta?.source_url.endsWith('/')
27+
? meta?.source_url + '/'
28+
: meta?.source_url
29+
"
30+
target="_blank"
31+
class="ellipsis"
32+
:title="data?.document_name?.trim()"
33+
>
34+
{{ data?.document_name?.trim() }}
35+
</a>
36+
</template>
37+
<template v-else>
38+
<span class="ellipsis" :title="data?.document_name?.trim()">
39+
{{ data?.document_name?.trim() }}
40+
</span>
41+
</template>
2642
</el-text>
2743
<div class="flex align-center" style="line-height: 32px">
2844
<AppAvatar class="mr-8 avatar-blue" shape="square" :size="18">
@@ -37,6 +53,8 @@
3753
</template>
3854
<script setup lang="ts">
3955
import { getImgUrl } from '@/utils/utils'
56+
import { computed } from 'vue'
57+
4058
const props = defineProps({
4159
data: {
4260
type: Object,
@@ -47,11 +65,22 @@ const props = defineProps({
4765
default: 0
4866
}
4967
})
68+
const isMetaObject = computed(() => typeof props.data.meta === 'object')
69+
const parsedMeta = computed(() => {
70+
try {
71+
return JSON.parse(props.data.meta)
72+
} catch (e) {
73+
return {}
74+
}
75+
})
76+
77+
const meta = computed(() => (isMetaObject.value ? props.data.meta : parsedMeta.value))
5078
</script>
5179
<style lang="scss" scoped>
5280
.paragraph-source-card-height {
5381
height: 260px;
5482
}
83+
5584
@media only screen and (max-width: 768px) {
5685
.paragraph-source-card-height {
5786
height: 285px;

0 commit comments

Comments
 (0)