From c79dd89ef0c5a0e75c86136202e5c408c184a2f8 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期六, 24 八月 2024 19:25:39 +0800
Subject: [PATCH] 新建会话修改
---
src/views/sessionManager/components/chatMenu.vue | 83 ++++++++++++++++++++++++++++-------------
1 files changed, 57 insertions(+), 26 deletions(-)
diff --git a/src/views/sessionManager/components/chatMenu.vue b/src/views/sessionManager/components/chatMenu.vue
index c82f0ec..0744d8e 100644
--- a/src/views/sessionManager/components/chatMenu.vue
+++ b/src/views/sessionManager/components/chatMenu.vue
@@ -9,16 +9,17 @@
}">
<div class="myAgentToolIcon___gaAKI myAgentToolIconNew___DBZrW">
<img
- src="../../../assets/images/talkbg.svg"
+ src="@/assets/images/talk.png"
style="width: 24px"
- alt=""></div>
+ alt="">
+ </div>
</div>
<div data-testid="msh-sidebar-history" class="myAgentTool___Y1_mC" @click="()=>{
EventBus.emit('history')
}">
<div class="myAgentToolIcon___gaAKI myAgentToolIconHistory___GTLWk" >
<img
- src="../../../assets/images/history.svg"
+ src="@/assets/images/historybg.png"
style="width: 24px"
alt="">
</div>
@@ -27,7 +28,7 @@
EventBus.emit('smartAi')
}">
<div class="myAgentToolIcon___gaAKI myAgentToolIconSquare___Rj1o_"><img
- src="../../../assets/images/agentbg.svg"
+ src="@/assets/images/agent.png"
style="width: 24px"
alt=""></div>
</div>
@@ -86,13 +87,13 @@
<div class="myAgentBoxImgLayout___u69B_">
<div class="MuiBox-root css-5nczy5">
<img
- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/guess.png"
+ :src="item.icon ? httpUrl + item.icon:imgSrc"
alt=""
style="border-radius: 50%; width: 100%; height: 100%;">
</div>
<span class="myAgentBoxImgLayoutTip___xHV4m">{{item.name}}</span>
</div>
- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq" @click="deleteSession(item)">
+ <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq" @click.stop="deleteSession(item)">
<div class="myAgentBoxImgDeleteInner____Hawc" >浠庝晶杈规爮绉婚櫎</div>
</div>
</div>
@@ -120,9 +121,11 @@
sessionListApi
} from "@/api/session";
import { Message } from "@arco-design/web-vue";
+const httpUrl = localStorage.getItem('httpUrl');
import EventBus from '@/utils/EventBus';
const emit = defineEmits(["querySessionDetail","changeAgentType","createSession"]);
-import logo from "@/assets/images/model.png";
+import { appUsageSessionListApi, deleteAppUsage } from "@/api/Agent";
+import { getAgentSessionDetailsApi } from "@/api/agentSession";
const activeSessionId = ref("");
const fieldNames = { value: "id", label: "name" };
const dialogs = ref([]);
@@ -133,24 +136,25 @@
const selectValue = ref("");
const sectionList = ref({});
const sessionList = ref([]); //鐢ㄦ埛鎿嶄綔浼氳瘽鍒楄〃
-
+import img1 from '@/assets/images/talkbg.png'
+import logo from "@/assets/images/model.png";
+const imgSrc = ref(logo);
// 鏌ヨ鍘嗗彶鐢ㄦ埛涔犳儻浼氳瘽鍒楄〃
const querySessionList = async (id) => {
- const { code, data } = await sessionListApi(id);
+ const { code, data } = await appUsageSessionListApi('');
if (code === 200) {
sessionList.value = data.map((item) => {
return {
...item,
- showtype: 1
}
});
- sessionList.value.splice(0, 5);
- console.log(sessionList.value);
+ // sessionList.value.splice(0, 5);
+ console.log(sessionList.value,'鐢ㄦ埛涔犳儻浼氳瘽鍒楄〃');
} else {
- Message.warning("鏌ヨ澶辫触");
+ // Message.warning("鏌ヨ澶辫触");
}
};
@@ -159,15 +163,26 @@
const createNewSession = async (session) => {
console.log(session, 'session');
// 鏌ヨ鍘嗗彶璁板綍
- // if (session.type == '1') {
- // // 鐢熸垚鏅鸿兘浣撴柊鐨勫璇�
- // emit('createSession',session.id);
- // emit('changeAgentType','1');
- // } else {
- // // 鐢熸垚agent鏂扮殑瀵硅瘽
- // EventBus.emit("createAgent",session);
- // emit('changeAgentType','2');
- // }
+ if (session.app_type == '1') {
+ // 鐢熸垚鏅鸿兘浣撴柊鐨勫璇�
+ emit('createSession',session.app_id,`鍜�${session.name}鐨勪細璇漙);
+ emit('changeAgentType','1');
+ } else {
+ // 鐢熸垚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("createAgent",sessionObj);
+ emit('changeAgentType','2');
+ }
+
+ }
@@ -178,10 +193,24 @@
//鏍规嵁浼氳瘽id鍒犻櫎浼氳瘽
const deleteSession = async (session) => {
- const { code } = await deleteSessionApi([session.id]);
+ const { code } = await deleteAppUsage({
+ app_id:session.app_id
+ });
if (code === 200) {
// Message.success('鍒犻櫎鎴愬姛');
- querySessionList('');
+ const { code, data } = await appUsageSessionListApi('');
+ if (code === 200) {
+ sessionList.value = data;
+ // sessionList.value.splice(0, 5);
+ console.log(sessionList.value,'鐢ㄦ埛涔犳儻浼氳瘽鍒楄〃');
+ if(sessionList.value.length == 0){
+ // 鐢熸垚鏅鸿兘浣撴柊鐨勫璇�
+ emit('createSession','');
+ emit('changeAgentType','1');
+ }
+ } else {
+ // Message.warning("鏌ヨ澶辫触");
+ }
}
};
@@ -195,10 +224,12 @@
})
onMounted(() => {
-
+ EventBus.on("queryAppUsageList", (data) => {
+ querySessionList('');
+ })
})
onBeforeUnmount(() => {
-
+ EventBus.off("queryAppUsageList");
});
--
Gitblit v1.8.0