From bfe893e818c75815b249fbfaed954458930d5600 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期日, 29 九月 2024 10:53:29 +0800 Subject: [PATCH] recordSetTable group --- src/views/project/yw/dataManage/knowledge/Knowledge.vue | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/views/project/yw/dataManage/knowledge/Knowledge.vue b/src/views/project/yw/dataManage/knowledge/Knowledge.vue index 2093eae..478cab6 100644 --- a/src/views/project/yw/dataManage/knowledge/Knowledge.vue +++ b/src/views/project/yw/dataManage/knowledge/Knowledge.vue @@ -26,12 +26,33 @@ 1涓煡璇� </span> <span class="set_desc_text"> + <span class="set_desc_icon ywifont ywicon-fenshu_an"> </span> + {{ item.scope }} + </span> + <span class="set_desc_text"> <span class="set_desc_icon ywifont ywicon-cshy-shizhong"> </span> {{ item.create_time }}鏇存柊 + </span> + <span + :class="{ + 'text-orange-500': item.publish === SupervisorPublished.N, + 'text-green-500': item.publish === SupervisorPublished.Y, + }" + class="text-[12px]" + > + {{ supervisorPublishedMap[item.publish] }} </span> </div> </div> <div class="set_btn_group"> + <el-button + link + class="text-[12px]" + @click="publishKnowledgeBase(item)" + :style="{ color: item.publish === SupervisorPublished.Y ? '#f97316' : '#22c55e' }" + >{{ item.publish === SupervisorPublished.Y ? '涓嬫灦' : '鍙戝竷' }} + </el-button> + <el-divider direction="vertical" /> <el-button link class="text-[12px] text-[#686682]" @click="viewKnowledgeBase(item)">鏌ョ湅 </el-button> <el-divider direction="vertical" /> <el-button link class="text-[12px] text-[#686682]" @click="openChatTest(item)">瀵硅瘽娴嬭瘯 </el-button> @@ -65,16 +86,22 @@ <script setup lang="ts"> import { useDraggable } from '@vueuse/core'; +import axios, { CancelTokenSource } from 'axios'; import { ElMessage, ElMessageBox } from 'element-plus'; import { nextTick, onMounted, ref } from 'vue'; import { useRouter } from 'vue-router'; -import { check_docvector_validate, delete_docvector_name, get_docvector_list } from '/@/api/knowledge/docvector'; +import { + check_docvector_validate, + delete_docvector_name, + get_docvector_list, + publish_docvector_name, +} from '/@/api/knowledge/docvector'; import Chat from '/@/components/chat/Chat.vue'; import { useQueryTable } from '/@/hooks/useQueryTable'; import mittBus from '/@/utils/mitt'; import { useCompRef } from '/@/utils/types'; +import { SupervisorPublished, supervisorPublishedMap } from '/@/views/project/yw/lowCode/sqlAmis/types'; import knowledgeLeft from '/static/images/knowledge/data_type_1.png'; - const router = useRouter(); //#region ====================== 鑾峰彇鐭ヨ瘑搴搒heet鍒楄〃 ====================== const knowledgeBaseList = ref([]); @@ -122,6 +149,7 @@ knowledge_title: row.title, knowledge_desc: row.desc, knowledge_prompt: row.prompt, + knowledge_scope: row.scope, }, }); }; @@ -133,6 +161,17 @@ knowledge_title: row.title, }, }); +}; +//鍙戝竷 +const publishKnowledgeBase = async (row) => { + const res = await publish_docvector_name({ + knowlg_id: row.id, + publish: row.publish === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y, + }); + if (res.json_ok) { + row.publish = row.publish === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y; + ElMessage.success('鍚屾鎴愬姛'); + } }; //#endregion @@ -154,7 +193,9 @@ chatTestIsShow.value = true; nextTick(() => { chatRef.value.clear(); - chatRef.value.autoSend(row.prompt); + // setTimeout(() => { + // chatRef.value.autoSend(row.title); + // }, 30); }); }; @@ -176,7 +217,9 @@ }, }); -const questionAi = async (text) => { +const questionAi = async (text, sourceObj: { source: CancelTokenSource }) => { + const currentSource = axios.CancelToken.source(); + sourceObj.source = currentSource; const res = await check_docvector_validate( { knowlg_id: chatTestMapRow.value.id, @@ -184,6 +227,7 @@ }, { loading: false, + cancelToken: currentSource.token, } ); return res; -- Gitblit v1.9.3