wujingjing
2025-02-26 08c6ecf506bfc7003894775fe57d98d9b11f3d9e
src/components/chat/chatComponents/knowledgeCom/KnowledgeCom.vue
@@ -1,7 +1,7 @@
<template>
   <div class="space-y-7">
      <div v-for="(item, index) in data" :key="index">
         <div v-html="md.render(item.answer)"></div>
         <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)">
@@ -16,18 +16,31 @@
<script setup lang="ts">
import { md } from '../../libs/markdown';
import { chatComProps } from '../common';
defineProps(['data'])
const props = defineProps(chatComProps);
const pageLinkClick = (item) => {
   const nwin = window.open('');
   nwin.document.write(md.render(item.page_content))
   nwin.document.write(md.render(item.page_content));
   nwin.focus();
   if(item.metadata.Title){
      nwin.document.title = item.metadata.Title
   if (item.metadata.Title) {
      nwin.document.title = item.metadata.Title;
   }
};
</script>
<style scoped lang="scss"></style>
<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>