zhangnuoyan преди 2 години
родител
ревизия
b4f6686ad6
променени са 2 файла, в които са добавени 177 реда и са изтрити 2 реда
  1. 176 1
      src/components/DialogWrap.vue
  2. 1 1
      src/components/DocumentCards.vue

+ 176 - 1
src/components/DialogWrap.vue

@@ -142,6 +142,12 @@
                                 </div>
                             </div>
                         </section>
+                        <p
+                            v-if="type === 'knowledge' && item.answer"
+                            style="margin-top: 10px; font-size: 18px; font-weight: bold"
+                        >
+                            答案生成结果
+                        </p>
                         <p v-if="item.answer" :style="{ 'margin-top': type === 'knowledge' ? '12px' : '0' }">
                             {{ item.answer }}
                         </p>
@@ -151,6 +157,46 @@
                             {{ item.answer }}
                         </p>
                     </div>
+                    <div v-if="type === 'knowledge' && item.other" class="knowledge-wrap">
+                        <header>
+                            <p>来源</p>
+                            <p @click="goKnowledge">查看全部关联 ></p>
+                        </header>
+                        <section>
+                            <div v-for="(knowledge, knowledgeIndex) in knowledgeList" :key="knowledgeIndex">
+                                <a-popover :title="knowledge.name" position="left">
+                                    <div>
+                                        <span>{{ knowledgeIndex + 1 }}</span>
+                                        <span>{{ knowledge.name }}</span>
+                                    </div>
+                                    <template #content>
+                                        <div class="knowledge-detail">
+                                            <div class="knowledge-content">
+                                                {{ knowledge.contents[knowledge.page] }}
+                                            </div>
+                                            <div class="knowledge-footer">
+                                                <p>检索片段</p>
+                                                <p>
+                                                    <span
+                                                        v-for="(content, contentIndex) in knowledge.contents"
+                                                        :key="contentIndex"
+                                                        :class="{ active: knowledge.page === contentIndex }"
+                                                        @click="
+                                                            () => {
+                                                                knowledge.page = contentIndex;
+                                                            }
+                                                        "
+                                                        >{{ contentIndex + 1 }}</span
+                                                    >
+                                                </p>
+                                                <p @click="goKnowledge(knowledge.id)">查看详情></p>
+                                            </div>
+                                        </div>
+                                    </template>
+                                </a-popover>
+                            </div>
+                        </section>
+                    </div>
                     <div class="dialog-other" v-if="item?.other">
                         <p v-if="isSetting">
                             <img src="@/assets/icons/check.png" width="16" />
@@ -214,6 +260,44 @@ export default defineComponent({
     },
     props: ["open", "suggestions", "agentInfo", "userInfo", "isSetting", "readonly", "type", "list"],
     setup(props, { emit }) {
+        const knowledgeList = ref([
+            {
+                id: "111",
+                name: "十四届全国人大二次会议政府工作报告1.docx ",
+                page: 0,
+                contents: [
+                    `促进社会综合融资成本稳中有降。畅通货币政策传导机制,避免资金沉
+                    淀空转。增强资本市场内在稳定性。保持人民币汇率在合理均衡水平上的基本
+                    稳定。大力发展科技金融、绿色金融、普惠金融、养老金融、数字金融。优化
+                    融资增信、风险分担、信息共享等配套措施,更好满足中小微企业融资需求。
+                    增强宏观政策取向一致性。围绕发展大局,加强财政、货币、就业、产业、
+                    区域、科技、环保等政策协调配合,把非经济性政策纳入宏观政策取向一致性
+                    评估,强化政策统筹,确保同向发力、形成合力。各地区各部门制定政策要认`,
+                    `制定推动文化传承发展的政策举措。深入推进国家文化数字化战略。
+                    深化全民阅读活动。完善网络综合治理,培育积极健康、向上向善的网络文化。
+                    创新实施文化惠民工程,提高公共文化场馆免费开放服务水平。大力发展文化
+                    产业。开展第四次全国文物普查,加强文物系统性保护和合理利用。推进非物`
+                ]
+            },
+            {
+                id: "222",
+                name: "十四届全国人大二次会议政府工作报告2.docx ",
+                page: 0,
+                contents: [
+                    `促进社会综合融资成本稳中有降。畅通货币政策传导机制,避免资金沉
+                    淀空转。增强资本市场内在稳定性。保持人民币汇率在合理均衡水平上的基本
+                    稳定。大力发展科技金融、绿色金融、普惠金融、养老金融、数字金融。优化
+                    融资增信、风险分担、信息共享等配套措施,更好满足中小微企业融资需求。
+                    增强宏观政策取向一致性。围绕发展大局,加强财政、货币、就业、产业、
+                    区域、科技、环保等政策协调配合,把非经济性政策纳入宏观政策取向一致性
+                    评估,强化政策统筹,确保同向发力、形成合力。各地区各部门制定政策要认`,
+                    `制定推动文化传承发展的政策举措。深入推进国家文化数字化战略。
+                    深化全民阅读活动。完善网络综合治理,培育积极健康、向上向善的网络文化。
+                    创新实施文化惠民工程,提高公共文化场馆免费开放服务水平。大力发展文化
+                    产业。开展第四次全国文物普查,加强文物系统性保护和合理利用。推进非物`
+                ]
+            }
+        ]);
         const DOCUMENT_RESULT = {
             type: "document",
             text: "谷歌知识库",
@@ -385,6 +469,7 @@ export default defineComponent({
                 mockLink(text);
             }
         };
+        const goKnowledge = () => {};
         onBeforeUnmount(() => {
             helper.$bus.off("send-message");
             helper.$bus.off("clear-message");
@@ -403,6 +488,7 @@ export default defineComponent({
             });
         });
         return {
+            goKnowledge,
             randomKey,
             openDocument,
             showFeedback,
@@ -417,7 +503,8 @@ export default defineComponent({
             feedbackAnswer,
             handleOk,
             handleCancel,
-            stopWriting
+            stopWriting,
+            knowledgeList
         };
     }
 });
@@ -434,6 +521,94 @@ export default defineComponent({
 }
 </style>
 <style scoped>
+.knowledge-detail {
+    width: 320px;
+    padding-top: 20px;
+    .knowledge-content {
+        height: 300px;
+        overflow-y: auto;
+        line-height: 30px;
+    }
+    .knowledge-footer {
+        border-top: 1px solid rgba(229, 229, 229, 1);
+        margin-top: 20px;
+        padding-top: 20px;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        p {
+            &:nth-child(1) {
+                opacity: 0.8;
+            }
+            &:nth-child(2) {
+                flex: 1;
+                display: flex;
+                justify-content: left;
+                margin: 0 30px;
+                > span {
+                    margin: 0 5px;
+                    cursor: pointer;
+                    &:hover,
+                    &.active {
+                        color: #00aea3;
+                    }
+                }
+            }
+            &:nth-child(3) {
+                font-weight: bold;
+                cursor: pointer;
+                &:hover {
+                    color: #00aea3;
+                }
+            }
+        }
+    }
+}
+.knowledge-wrap {
+    padding: 10px 0 20px 50px;
+    > header {
+        display: flex;
+        justify-content: space-between;
+        > p {
+            &:nth-child(1) {
+                color: #7f7f7f;
+                font-weight: bold;
+            }
+            &:nth-child(2) {
+                cursor: pointer;
+                &:hover {
+                    color: #00aea3;
+                }
+            }
+        }
+    }
+    > section {
+        > div {
+            > div {
+                height: 40px;
+                display: inline-flex;
+                align-items: center;
+                > span {
+                    &:nth-child(1) {
+                        display: inline-block;
+                        background-color: rgba(0, 174, 163, 0.2);
+                        color: #00aea3;
+                        padding: 1px 5px;
+                        border-radius: 2px;
+                        margin-right: 5px;
+                        font-size: 12px;
+                    }
+                    &:nth-child(2) {
+                        cursor: pointer;
+                        &:hover {
+                            color: #00aea3;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
 .dialog-absolute {
     .dialog-header {
         position: absolute;

+ 1 - 1
src/components/DocumentCards.vue

@@ -168,7 +168,7 @@ import { defineComponent, ref, inject, reactive } from "vue";
 export default defineComponent({
     props: ["data", "hasUpload", "hasSlider", "uploadImg"],
     setup() {
-        const showUpload = ref(true);
+        const showUpload = ref(false);
         const { helper } = inject("$global");
         const maxSize = 30 * 1024 * 1024;
         const fileList = [];