wujingjing
2025-02-20 68df4582c1edaf1952e6c21d769981e348fb3d04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
    <div class="space-y-7">
        <div v-for="(item, index) in data" :key="index">
            <div class="markdown-it" v-html="md.render(item.answer)"></div>
            <div class="space-y-1 mt-2">
                <div v-for="(cItem, index) in item.contexts" :key="index">
                    <div class="text-blue-500 cursor-pointer inline-block" @click="pageLinkClick(cItem)">
                        <SvgIcon name="ele-Link" />
                        <span class="ml-2">{{ cItem.metadata?.Title }}</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script setup lang="ts">
import { md } from '../../libs/markdown';
import { chatComProps } from '../common';
 
const props = defineProps(chatComProps);
 
const pageLinkClick = (item) => {
    const nwin = window.open('');
    nwin.document.write(md.render(item.page_content));
    nwin.focus();
    if (item.metadata.Title) {
        nwin.document.title = item.metadata.Title;
    }
};
</script>
<style scoped lang="scss">
:deep(table) {
    border-collapse: collapse;
    width: 100%;
    thead {
        background-color: #f2f2f2;
    }
    th,
    td {
        border: 1px solid #ebebeb;
        padding: 8px;
        text-align: center;
    }
}
</style>