From 7d1e44c728a8e436fede1ceb8a62b5c4fb848b09 Mon Sep 17 00:00:00 2001 From: liudong <liudong> Date: 星期一, 19 八月 2024 17:32:43 +0800 Subject: [PATCH] agent会话名称修改 --- src/views/sessionManager/components/historySession.vue | 112 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 94 insertions(+), 18 deletions(-) diff --git a/src/views/sessionManager/components/historySession.vue b/src/views/sessionManager/components/historySession.vue index c355dce..e7c9c5e 100644 --- a/src/views/sessionManager/components/historySession.vue +++ b/src/views/sessionManager/components/historySession.vue @@ -8,7 +8,7 @@ top: 10px; left: -40px; font-size: 30px; - z-index: 9999; + z-index: 99; cursor: pointer" @click="emit('changeAgentType','1')" > @@ -47,22 +47,30 @@ class="item historyCenter-box" v-for="session in sessionList" @click="querySessionDetail(session)" + @mouseenter="handleMouseEnter(session)" + @mouseleave="handleMouseLeave(session)" > <div class="text" > <img :style="{ width: '16px' }" alt="dessert" - :src="session.avatar || imgSrc" + :src="session.icon ? httpUrl + session.icon : imgSrc" /> {{ session.name }} </div> <div class="time" - >{{ - moment(new Date(session.create_time)).format( - 'YYYY-MM-DD HH:mm:ss' - ) - }} + > + <span v-show="session.showtype == 1" style="font-size: 14px"> + {{ + moment(new Date(session.create_time)).format( + 'YYYY-MM-DD HH:mm:ss' + ) + }} + </span> </div> + <a-button type="text" @click.stop="deleteSession(session)" style="color: red;position: absolute;right: 10px;top: 10px;" v-show="session.showtype == 2"> + <icon-delete style="font-size: 14px" /> + </a-button> </div> </div> </a-scrollbar> @@ -77,7 +85,7 @@ import { useAppStore, useUserStore } from "@/store"; import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue"; -import { Message } from "@arco-design/web-vue"; +import { Message, Modal } from "@arco-design/web-vue"; import EventBus from '@/utils/EventBus'; import moment from "moment"; import { @@ -85,11 +93,15 @@ chatApi, getDialogListApi, getSessionDetailsApi, + deleteSessionApi, sessionListApi } from "@/api/session"; + import { queryCanvasList } from "@/api/Agent"; const emit = defineEmits(["querySessionDetail","changeAgentType"]); import logo from "@/assets/images/model.png"; +import { deleteKnow } from "@/api/kbList"; +import { getAgentSessionDetailsApi } from "@/api/agentSession"; const sessionList = ref([]); //浼氳瘽鍒楄〃 const activeSessionId = ref(""); const fieldNames = { value: "id", label: "name" }; @@ -100,6 +112,7 @@ const searchValue = ref(""); const selectValue = ref(""); const sectionList = ref({}); +const httpUrl = localStorage.getItem('httpUrl'); const imgSrc = ref(logo); const DialogList = async () => { const { code, data } = await getDialogListApi(); @@ -152,7 +165,12 @@ const querySessionList = async (id) => { const { code, data } = await sessionListApi(id); if (code === 200) { - sessionList.value = data; + sessionList.value = data.map((item) => { + return { + ...item, + showtype: 1 + } + }); @@ -161,20 +179,76 @@ } }; +//鏍规嵁浼氳瘽id鍒犻櫎浼氳瘽 +const deleteSession = async (session) => { + Modal.confirm({ + title: '鎻愮ず淇℃伅', + content: '纭鍒犻櫎鍚�', + okText: '纭畾', + cancelText: '鍙栨秷', + hideTitle: true, + onOk: async () => { + const { code } = await deleteSessionApi([session.id]); + if (code === 200) { + Message.success('鍒犻櫎鎴愬姛'); + querySessionList(''); + } + }, + onCancel: () => {}, + }); +}; const querySessionDetail = async (session) => { console.log(session, 'session'); - emit('changeAgentType','1'); - emit('querySessionDetail',session); + + + // 鏌ヨ鍘嗗彶璁板綍 + if (session.base == 'agent') { + // agent瀵硅薄鏁版嵁灏佽 + // const { code, data } = await getAgentSessionDetailsApi(session.app_id); + // if (code == 0) { + // console.log(data,'浼氳瘽璇︽儏'); + // let sessionObj = { + // id: session.app_id, + // dsl: data.dsl, + // title: session.name, + // } + // + // } + EventBus.emit("queryAgentSessionDetail",{ + ...sessionObj, + id: session.app_id, + }); + emit('changeAgentType','2'); + } else { + // 鐢熸垚鏅鸿兘浣撴柊鐨勫璇� + emit('changeAgentType','1'); + emit('querySessionDetail',session); + } + + + } + + +const handleMouseEnter = (session) => { + session.showtype = 2; +}; + +const handleMouseLeave = (session) => { + session.showtype = 1; +}; + onBeforeMount(()=>{ - DialogList() + // DialogList() + querySessionList(''); }) onMounted(() => { EventBus.on("history", () => { emit('changeAgentType','3'); - DialogList() + // DialogList() + querySessionList(''); }); }) @@ -218,22 +292,24 @@ width: 100%; margin-top: 30px; .historyCenter-box{ + position: relative; display: flex; width: 70%; margin-left: 15%; - //border: 1px solid var(--color-text-4); + //border: 1px solid var(--color-neutral-3); padding: 16px; border-radius: 12px; - background: var(--color-bg-2); + background: var(--color-bg-1); margin-top: 10px; cursor: pointer; justify-content: space-between; align-items: center; + color: var(--color-text-2); } .historyCenter-box:hover{ - color: #2a2a2b; - border: 1px solid var(--color-neutral-3); - //background: #e8e8ea; + color: var(--color-text-2); + //border: 1px solid var(--color-neutral-3); + background: var(--color-bg-3); box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09); } } -- Gitblit v1.8.0