From 5e6e726564e5cf1520f95b7f4f13707a39da4bad Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期五, 30 八月 2024 19:43:42 +0800
Subject: [PATCH] fix: 修改bug
---
src/views/sessionManager/components/chatMenu.vue | 355 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 258 insertions(+), 97 deletions(-)
diff --git a/src/views/sessionManager/components/chatMenu.vue b/src/views/sessionManager/components/chatMenu.vue
index f0fc1d0..b0c40fb 100644
--- a/src/views/sessionManager/components/chatMenu.vue
+++ b/src/views/sessionManager/components/chatMenu.vue
@@ -2,116 +2,279 @@
<div class="layoutNavMoveCenter">
<div class="layoutNavMove___j5ets">
<div class="myAgent___djnd_ myAgentAnim myAgentlight___yK7Gk">
-<!-- <div data-testid="msh-sidebar-main" class="myAgentHome___PG6IZ"></div>-->
+ <div data-testid="msh-sidebar-main" class="myAgentHome___PG6IZ"></div>
<div class="myAgentLine___Isl6E"></div>
- <div class="myAgentTool___Y1_mC" data-testid="msh-sidebar-new" @click="()=>{
- EventBus.emit('newChat')
- }">
+ <div
+ class="myAgentTool___Y1_mC"
+ data-testid="msh-sidebar-new"
+ @click="
+ () => {
+ EventBus.emit('newChat');
+ }
+ "
+ >
<div class="myAgentToolIcon___gaAKI myAgentToolIconNew___DBZrW">
<img
- src="../../../assets/images/talkbg.svg"
- style="width: 24px"
- 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/icon-new.png"
style="width: 24px"
- alt="">
+ alt=""
+ />
</div>
</div>
- <div data-testid="msh-sidebar-square" class="myAgentTool___Y1_mC myAgentToolSquare___dbLm1" @click="()=>{
- EventBus.emit('smartAi')
- }">
- <div class="myAgentToolIcon___gaAKI myAgentToolIconSquare___Rj1o_"><img
- src="../../../assets/images/agentbg.svg"
- style="width: 24px"
- alt=""></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/historybg.png"
+ style="width: 24px"
+ alt=""
+ /> -->
+ <img
+ src="@/assets/images/icon-histy.png"
+ style="width: 24px"
+ alt=""
+ />
+ </div>
</div>
- <div class="myAgentLine___Isl6E" style="margin-top: 4px;"></div>
- <div class="myAgentBox___zrCit myAgentBoxhistoryconph28t7lagf3d1bhq0">
- <div class="myAgentBoxImg___Mgu9e">
- <div class="myAgentBoxImgLayout___u69B_">
- <div class="MuiBox-root css-5nczy5"><img
- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/academic.png" alt=""
- style="border-radius: 50%; width: 100%; height: 100%;"></div>
- <span class="myAgentBoxImgLayoutTip___xHV4m">瀛︽湳鎼滅储</span></div>
- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">
- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>
+ <div
+ data-testid="msh-sidebar-square"
+ class="myAgentTool___Y1_mC myAgentToolSquare___dbLm1"
+ @click="
+ () => {
+ EventBus.emit('smartAi');
+ }
+ "
+ >
+ <div class="myAgentToolIcon___gaAKI myAgentToolIconSquare___Rj1o_">
+ <!-- <img src="@/assets/images/agent.png" style="width: 24px" alt=""/> -->
+ <img
+ src="@/assets/images/icon-zhi.png"
+ style="width: 24px"
+ alt=""
+ />
+ </div>
+ </div>
+ <div class="myAgentLine___Isl6E" style="margin-top: 4px"></div>
+ <div id="myAgentBox">
+ <!-- <div class="myAgentBox___zrCit">-->
+ <!-- <div class="myAgentBoxImg___Mgu9e">-->
+ <!-- <div class="myAgentBoxImgLayout___u69B_">-->
+ <!-- <div class="MuiBox-root css-5nczy5"><img-->
+ <!-- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/academic.png" alt=""-->
+ <!-- style="border-radius: 50%; width: 100%; height: 100%;"></div>-->
+ <!-- <span class="myAgentBoxImgLayoutTip___xHV4m">瀛︽湳鎼滅储</span></div>-->
+ <!-- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">-->
+ <!-- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- <div class="myAgentBox___zrCit">-->
+ <!-- <div class="myAgentBoxImg___Mgu9e">-->
+ <!-- <div class="myAgentBoxImgLayout___u69B_">-->
+ <!-- <div class="MuiBox-root css-5nczy5"><img-->
+ <!-- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/paper_rewrite.png" alt=""-->
+ <!-- style="border-radius: 50%; width: 100%; height: 100%;"></div>-->
+ <!-- <span class="myAgentBoxImgLayoutTip___xHV4m">璁烘枃鏀瑰啓</span></div>-->
+ <!-- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">-->
+ <!-- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- <div class="myAgentBox___zrCit">-->
+ <!-- <div class="myAgentBoxImg___Mgu9e">-->
+ <!-- <div class="myAgentBoxImgLayout___u69B_">-->
+ <!-- <div class="MuiBox-root css-5nczy5"><img-->
+ <!-- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/prompt.png" alt=""-->
+ <!-- style="border-radius: 50%; width: 100%; height: 100%;"></div>-->
+ <!-- <span class="myAgentBoxImgLayoutTip___xHV4m">鎻愮ず璇嶄笓瀹�</span></div>-->
+ <!-- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">-->
+ <!-- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- <div class="myAgentBox___zrCit">-->
+ <!-- <div class="myAgentBoxImg___Mgu9e">-->
+ <!-- <div class="myAgentBoxImgLayout___u69B_">-->
+ <!-- <div class="MuiBox-root css-5nczy5"><img-->
+ <!-- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/taro.png" alt=""-->
+ <!-- style="border-radius: 50%; width: 100%; height: 100%;"></div>-->
+ <!-- <span class="myAgentBoxImgLayoutTip___xHV4m">濉旂綏甯�</span></div>-->
+ <!-- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">-->
+ <!-- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <!-- </div>-->
+ <div class="myAgentBox___zrCit" v-for="item in sessionList">
+ <div class="myAgentBoxImg___Mgu9e" @click="createNewSession(item)">
+ <div class="myAgentBoxImgLayout___u69B_">
+ <div class="MuiBox-root css-5nczy5">
+ <img
+ :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.stop="deleteSession(item)"
+ >
+ <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>
+ </div>
</div>
</div>
</div>
- <div class="myAgentBox___zrCit myAgentBoxhistoryconpgu0t7lagecg63730">
- <div class="myAgentBoxImg___Mgu9e">
- <div class="myAgentBoxImgLayout___u69B_">
- <div class="MuiBox-root css-5nczy5"><img
- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/paper_rewrite.png" alt=""
- style="border-radius: 50%; width: 100%; height: 100%;"></div>
- <span class="myAgentBoxImgLayoutTip___xHV4m">璁烘枃鏀瑰啓</span></div>
- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">
- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>
- </div>
- </div>
- </div>
- <div class="myAgentBox___zrCit myAgentBoxhistoryconpg00t7lagbbsfqkq0">
- <div class="myAgentBoxImg___Mgu9e">
- <div class="myAgentBoxImgLayout___u69B_">
- <div class="MuiBox-root css-5nczy5"><img
- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/prompt.png" alt=""
- style="border-radius: 50%; width: 100%; height: 100%;"></div>
- <span class="myAgentBoxImgLayoutTip___xHV4m">鎻愮ず璇嶄笓瀹�</span></div>
- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">
- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>
- </div>
- </div>
- </div>
- <div class="myAgentBox___zrCit myAgentBoxhistoryconpgbgt7lagcavlq340">
- <div class="myAgentBoxImg___Mgu9e">
- <div class="myAgentBoxImgLayout___u69B_">
- <div class="MuiBox-root css-5nczy5"><img
- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/taro.png" alt=""
- style="border-radius: 50%; width: 100%; height: 100%;"></div>
- <span class="myAgentBoxImgLayoutTip___xHV4m">濉旂綏甯�</span></div>
- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">
- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>
- </div>
- </div>
- </div>
- <div class="myAgentBox___zrCit myAgentBoxhistoryconpgbot7lagcavlq34g">
- <div class="myAgentBoxImg___Mgu9e">
- <div class="myAgentBoxImgLayout___u69B_">
- <div class="MuiBox-root css-5nczy5"><img
- src="https://kimi-img.moonshot.cn/prod-chat-kimi/avatar/kimiplus/guess.png" alt=""
- style="border-radius: 50%; width: 100%; height: 100%;"></div>
- <span class="myAgentBoxImgLayoutTip___xHV4m">鐚滅寽鎴戝湪鎯宠皝</span></div>
- <div data-testid="msh-sidebar-bot-delete" class="myAgentBoxImgDelete___qXZuq">
- <div class="myAgentBoxImgDeleteInner____Hawc">浠庝晶杈规爮绉婚櫎</div>
- </div>
- </div>
- </div>
- <div class="myAgentLine___Isl6E" style="margin-top: 4px;"></div>
+ <!-- <div class="myAgentLine___Isl6E" style="margin-top: 4px;"></div>-->
</div>
</div>
</div>
</template>
<script setup lang="ts">
-import {
- IconClose,
- IconSearch,
- IconTiktokColor
-} from "@arco-design/web-vue/es/icon";
-import { useAppStore, useUserStore } from "@/store";
-import { computed, nextTick, onMounted, watch, reactive, ref } from "vue";
+ import {
+ IconClose,
+ IconSearch,
+ IconTiktokColor,
+ } from '@arco-design/web-vue/es/icon';
+ import { useAppStore, useUserStore } from '@/store';
+ import {
+ computed,
+ nextTick,
+ onMounted,
+ watch,
+ reactive,
+ ref,
+ onBeforeMount,
+ onBeforeUnmount,
+ } from 'vue';
+ import {
+ addSessionApi,
+ chatApi,
+ getDialogListApi,
+ getSessionDetailsApi,
+ deleteSessionApi,
+ 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 { appUsageSessionListApi, deleteAppUsage } from '@/api/Agent';
+ import { getAgentSessionDetailsApi } from '@/api/agentSession';
+ const activeSessionId = ref('');
+ const fieldNames = { value: 'id', label: 'name' };
+ const dialogs = ref([]);
+ const dialogObj = reactive({});
+ const agentObj = reactive({});
+ const agentList = ref([]);
+ const searchValue = ref('');
+ 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);
-import { Message } from "@arco-design/web-vue";
-import EventBus from '@/utils/EventBus';
+ // 鏌ヨ鍘嗗彶鐢ㄦ埛涔犳儻浼氳瘽鍒楄〃
+ const querySessionList = async (id) => {
+ const { code, data } = await appUsageSessionListApi('');
+ if (code === 200) {
+ sessionList.value = data.map((item) => {
+ return {
+ ...item,
+ };
+ });
+ // sessionList.value.splice(0, 5);
+ console.log(sessionList.value, '鐢ㄦ埛涔犳儻浼氳瘽鍒楄〃');
+ } else {
+ // Message.warning("鏌ヨ澶辫触");
+ }
+ };
+ // 鏂板浼氳瘽
+ const createNewSession = async (session) => {
+ console.log(session, 'session');
+ // 鏌ヨ鍘嗗彶璁板綍
+
+ if (session.app_type == '3') {
+ //楂樼骇agent
+ EventBus.emit('createSeniorAgent', session);
+ emit('changeAgentType', '5');
+ } else {
+ 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');
+ }
+ }
+ }
+ };
+
+ //鏍规嵁浼氳瘽id鍒犻櫎浼氳瘽
+ const deleteSession = async (session) => {
+ const { code } = await deleteAppUsage({
+ app_id: session.app_id,
+ });
+ if (code === 200) {
+ // Message.success('鍒犻櫎鎴愬姛');
+ 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("鏌ヨ澶辫触");
+ }
+ }
+ };
+
+ onBeforeMount(() => {
+ querySessionList('');
+ });
+
+ onMounted(() => {
+ EventBus.on('queryAppUsageList', (data) => {
+ querySessionList('');
+ });
+ });
+ onBeforeUnmount(() => {
+ EventBus.off('queryAppUsageList');
+ });
</script>
<style scoped lang="less">
- @import "@/views/sessionManager/style/layout.css";
+ @import '@/views/sessionManager/style/layout.css';
.layoutNavMoveCenter {
display: flex;
justify-content: center;
@@ -119,11 +282,9 @@
height: calc(100vh - 160px); /* 鎴栬�呮寚瀹氶珮搴� */
position: relative;
}
- .layoutNavMove___j5ets{
-
+ #myAgentBox {
+ //width: 100%;
+ //max-height: 220px;
+ //overflow: hidden;
}
-
-
-
-
</style>
--
Gitblit v1.8.0