From 00a3929fe7003715bb4d48f72a3ac2a0550f5588 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期二, 20 八月 2024 09:56:24 +0800
Subject: [PATCH] 历史记录请求加载
---
src/views/sessionManager/components/historySession.vue | 87 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 81 insertions(+), 6 deletions(-)
diff --git a/src/views/sessionManager/components/historySession.vue b/src/views/sessionManager/components/historySession.vue
index 23b3479..24ef4e3 100644
--- a/src/views/sessionManager/components/historySession.vue
+++ b/src/views/sessionManager/components/historySession.vue
@@ -18,9 +18,10 @@
</a-button>
<a-scrollbar
+ ref="scrollRef"
class="left-list"
style="
- height: calc(100vh - 100px);
+ height: calc(100vh - 160px);
overflow-y: auto;
overflow-x: hidden;
"
@@ -54,7 +55,7 @@
<img
:style="{ width: '16px' }"
alt="dessert"
- :src="session.avatar || imgSrc"
+ :src="session.icon ? httpUrl + session.icon : imgSrc"
/>
{{ session.name }}
</div>
@@ -94,13 +95,14 @@
getDialogListApi,
getSessionDetailsApi,
deleteSessionApi,
- sessionListApi
+ sessionListApiPage
} 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" };
@@ -111,6 +113,8 @@
const searchValue = ref("");
const selectValue = ref("");
const sectionList = ref({});
+const scrollRef = ref(null);
+const httpUrl = localStorage.getItem('httpUrl');
const imgSrc = ref(logo);
const DialogList = async () => {
const { code, data } = await getDialogListApi();
@@ -161,7 +165,11 @@
// 鏌ヨ浼氳瘽鍒楄〃
const querySessionList = async (id) => {
- const { code, data } = await sessionListApi(id);
+ const { code, data } = await sessionListApiPage({
+ dialog_id: id,
+ page: 1,
+ page_size: 100
+ });
if (code === 200) {
sessionList.value = data.map((item) => {
return {
@@ -198,8 +206,34 @@
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);
+ }
+
+
+
}
@@ -210,6 +244,30 @@
const handleMouseLeave = (session) => {
session.showtype = 1;
};
+
+
+const handleScroll = async (e: any) => {
+ // scrollTopVal.value = e.target.scrollTop
+ // let offsetHeight = e.target.offsetHeight
+ // let scrollHeight = e.target.scrollHeight
+ //
+ // if (scrollTopVal.value + offsetHeight >= scrollHeight) {
+ // //婊氬姩鏉″埌杈惧簳閮�
+ // if (cardData.value.length < total.value) {
+ // //鏁版嵁涓哄姞杞藉畬锛岀户缁祴鍊�
+ // serarchData.pageNum++
+ //
+ //
+ //
+ // }
+ // }
+}
+
+const loading: any = computed(() => {
+ // cardData.value.length >= total.value
+})
+
+
onBeforeMount(()=>{
// DialogList()
@@ -223,6 +281,23 @@
querySessionList('');
});
+
+// 缁欏厓绱犳坊鍔犳粴鍔ㄤ簨浠剁洃鍚�
+// if (scrollRef.value) {
+// // 缁欏厓绱犳坊鍔犳粴鍔ㄧ洃鍚櫒
+//
+// scrollRef.value.addEventListener('scroll', handleScroll, true)
+//
+// // 濡傛灉浣犻渶瑕佸湪缁勪欢鍗歌浇鏃剁Щ闄ょ洃鍚櫒锛屽彲浠ヨ繑鍥炰竴涓竻鐞嗗嚱鏁�
+// return () => {
+// scrollRef.value.removeEventListener('scroll', handleScroll, true)
+// }
+// }
+
+
+
+
+
})
onBeforeUnmount(() => {
EventBus.off("history");
--
Gitblit v1.8.0