| | |
| | | 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> |
| | |
| | | |
| | | <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 ====================== 获取知识库sheet列表 ====================== |
| | | const knowledgeBaseList = ref([]); |
| | |
| | | knowledge_title: row.title, |
| | | knowledge_desc: row.desc, |
| | | knowledge_prompt: row.prompt, |
| | | knowledge_scope: row.scope, |
| | | }, |
| | | }); |
| | | }; |
| | |
| | | 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 |
| | | |
| | |
| | | chatTestIsShow.value = true; |
| | | nextTick(() => { |
| | | chatRef.value.clear(); |
| | | chatRef.value.autoSend(row.prompt); |
| | | // setTimeout(() => { |
| | | // chatRef.value.autoSend(row.title); |
| | | // }, 30); |
| | | }); |
| | | }; |
| | | |
| | |
| | | }, |
| | | }); |
| | | |
| | | 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, |
| | |
| | | }, |
| | | { |
| | | loading: false, |
| | | cancelToken: currentSource.token, |
| | | } |
| | | ); |
| | | return res; |