| | |
| | | left: -40px; |
| | | font-size: 30px; |
| | | z-index: 99; |
| | | cursor: pointer" |
| | | cursor: pointer; |
| | | " |
| | | @click="emit('changeAgentType','1')" |
| | | > |
| | | <template #icon> |
| | |
| | | > |
| | | <div class="historyTitle___F_iam">历史会话</div> |
| | | |
| | | |
| | | <div class="search"> |
| | | <!-- 查询框--> |
| | | <div class="search-box"> |
| | |
| | | <a-input |
| | | placeholder="搜索历史会话" |
| | | v-model="searchValue" |
| | | style="width: 90%;" |
| | | style="width: 90%" |
| | | /> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div class="historyCenter"> |
| | | <div |
| | |
| | | /> |
| | | {{ session.name }} |
| | | </div> |
| | | <div class="time" |
| | | > |
| | | <div class="time"> |
| | | <span v-show="session.showtype == 1" style="font-size: 14px"> |
| | | {{ |
| | | moment(new Date(session.create_time)).format( |
| | |
| | | }} |
| | | </span> |
| | | </div> |
| | | <a-button type="text" @click.stop="deleteSession(session)" style="color: red;position: absolute;right: 10px;top: 10px;" v-show="session.showtype == 2"> |
| | | <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> |
| | |
| | | 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"; |
| | | 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 { Message, Modal } from "@arco-design/web-vue"; |
| | | import { Message, Modal } from '@arco-design/web-vue'; |
| | | import EventBus from '@/utils/EventBus'; |
| | | import moment from "moment"; |
| | | import moment from 'moment'; |
| | | import { |
| | | addSessionApi, |
| | | chatApi, |
| | | getDialogListApi, |
| | | getSessionDetailsApi, |
| | | deleteSessionApi, |
| | | sessionListApiPage |
| | | } from "@/api/session"; |
| | | 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"; |
| | | 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" }; |
| | | 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 searchValue = ref(''); |
| | | const selectValue = ref(''); |
| | | const sectionList = ref({}); |
| | | const scrollRef = ref(null); |
| | | const httpUrl = localStorage.getItem('httpUrl'); |
| | |
| | | let scrollTopVal = ref(0); |
| | | let queryPage = reactive({ |
| | | page: 1, |
| | | page_size: 50 |
| | | }) |
| | | page_size: 50, |
| | | }); |
| | | let total = ref(0); |
| | | let sessionScrollList = ref([]); |
| | | let isReached = ref(true); |
| | |
| | | dialogs.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | type: 1 //智能体 |
| | | type: 1, //智能体 |
| | | }; |
| | | }); |
| | | // console.log(data, "dialogs"); |
| | |
| | | const queryCanvas = async (params = {}) => { |
| | | try { |
| | | const { data } = await queryCanvasList(params); |
| | | console.log(data, "agent"); |
| | | console.log(data, 'agent'); |
| | | agentList.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | name: item.title, |
| | | type: 2 //agent |
| | | type: 2, //agent |
| | | }; |
| | | }); |
| | | // 合并数组 |
| | |
| | | // } |
| | | //新建会话 |
| | | querySessionList(dialogs.value[0].id); |
| | | |
| | | |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | | } finally { |
| | | } |
| | | }; |
| | | |
| | | |
| | | // 查询会话列表 |
| | | const querySessionList = async (id) => { |
| | | const { code, data } = await sessionListApiPage({ |
| | | dialog_id: id, |
| | | ...queryPage |
| | | ...queryPage, |
| | | }); |
| | | if (code === 200) { |
| | | sessionList.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | showtype: 1 |
| | | } |
| | | showtype: 1, |
| | | }; |
| | | }); |
| | | isReached.value = false; |
| | | setTimeout(()=>{ |
| | | isReached.value = true; |
| | | },100) |
| | | }, 100); |
| | | // total.value = sessionList.value.length; |
| | | |
| | | |
| | | } else { |
| | | Message.warning("查询失败"); |
| | | Message.warning('查询失败'); |
| | | } |
| | | }; |
| | | |
| | |
| | | // // title: session.name, |
| | | // // } |
| | | // } |
| | | EventBus.emit("queryAgentSessionDetail",session); |
| | | EventBus.emit('queryAgentSessionDetail', session); |
| | | emit('changeAgentType','2'); |
| | | } else if (session.base == 'advanced-agent') { |
| | | EventBus.emit('queryAgentSessionDetails', session); |
| | | emit('changeAgentType', '5'); |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | const handleMouseEnter = (session) => { |
| | | session.showtype = 2; |
| | |
| | | const handleMouseLeave = (session) => { |
| | | session.showtype = 1; |
| | | }; |
| | | |
| | | |
| | | const handleScroll = async (e: any) => { |
| | | scrollTopVal.value = e.target.scrollTop; |
| | |
| | | // |
| | | // |
| | | // } |
| | | queryPage.page++ |
| | | queryPage.page++; |
| | | const { code, data } = await sessionListApiPage({ |
| | | dialog_id: '', |
| | | ...queryPage |
| | | ...queryPage, |
| | | }); |
| | | if (code === 200) { |
| | | sessionScrollList.value = data.map((item) => { |
| | | return { |
| | | ...item, |
| | | showtype: 1 |
| | | } |
| | | showtype: 1, |
| | | }; |
| | | }); |
| | | // total.value = sessionList.value.length; |
| | | sessionList.value = [...sessionList.value,...sessionScrollList.value]; |
| | |
| | | scrollRef.value.scrollTop(scrollTopVal.value); |
| | | // console.log(scrollRef.value.$el.scrollTop,'scrollTopVal'); |
| | | // console.log(scrollTopVal.value,'scrollTopVal'); |
| | | }) |
| | | },100) |
| | | |
| | | |
| | | }); |
| | | }, 100); |
| | | } else { |
| | | Message.warning("查询失败"); |
| | | } |
| | | |
| | | Message.warning('查询失败'); |
| | | } |
| | | } |
| | | |
| | | |
| | | }; |
| | | |
| | | onBeforeMount(()=>{ |
| | | // DialogList() |
| | | querySessionList(''); |
| | | }) |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | console.log(httpUrl,'当前地址'); |
| | | EventBus.on("history", () => { |
| | | EventBus.on('history', () => { |
| | | emit('changeAgentType','3'); |
| | | // DialogList() |
| | | queryPage.page = 1; |
| | | querySessionList(''); |
| | | |
| | | }); |
| | | // 添加滚动事件监听器 |
| | | scrollRef.value.$el.addEventListener('scroll', handleScroll); |
| | |
| | | return () => { |
| | | scrollRef.value.$el.removeEventListener('scroll', handleScroll); |
| | | }; |
| | | |
| | | |
| | | |
| | | }) |
| | | onBeforeUnmount(() => { |
| | | EventBus.off("history"); |
| | | }); |
| | | |
| | | |
| | | onBeforeUnmount(() => { |
| | | EventBus.off('history'); |
| | | }); |
| | | </script> |
| | | <style scoped lang="less"> |
| | | .layoutHisCenter{ |
| | |
| | | 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); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | </style> |