|
|
@@ -32,15 +32,9 @@
|
|
|
<div class="historyTitle___F_iam">历史会话</div>
|
|
|
|
|
|
<div class="search">
|
|
|
- <!-- 查询框-->
|
|
|
- <div class="search-box">
|
|
|
- <icon-search />
|
|
|
- <a-input
|
|
|
- placeholder="搜索历史会话"
|
|
|
- v-model="searchValue"
|
|
|
- style="width: 90%"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <a-input-search @change="querySessionList('')" v-model="searchValue" class="search-box" placeholder="按下Enter键,搜索会话名称">
|
|
|
+
|
|
|
+ </a-input-search>
|
|
|
</div>
|
|
|
|
|
|
<div class="historyCenter">
|
|
|
@@ -82,41 +76,17 @@
|
|
|
</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,
|
|
|
- onBeforeMount,
|
|
|
- onBeforeUnmount,
|
|
|
- } from 'vue';
|
|
|
+import { IconClose, IconSearch } from "@arco-design/web-vue/es/icon";
|
|
|
+import { nextTick, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref } from "vue";
|
|
|
|
|
|
- import { Message, Modal } from '@arco-design/web-vue';
|
|
|
- import EventBus from '@/utils/EventBus';
|
|
|
- import moment from 'moment';
|
|
|
- import {
|
|
|
- addSessionApi,
|
|
|
- chatApi,
|
|
|
- getDialogListApi,
|
|
|
- getSessionDetailsApi,
|
|
|
- deleteSessionApi,
|
|
|
- sessionListApiPage,
|
|
|
- } from '@/api/session';
|
|
|
+import { Message, Modal } from "@arco-design/web-vue";
|
|
|
+import EventBus from "@/utils/EventBus";
|
|
|
+import moment from "moment";
|
|
|
+import { deleteSessionApi, sessionListApiPage } from "@/api/session";
|
|
|
+import logo from "@/assets/images/model.png";
|
|
|
|
|
|
- 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 emit = defineEmits(['querySessionDetail', 'changeAgentType']);
|
|
|
+const sessionList = ref([]); //会话列表
|
|
|
const activeSessionId = ref('');
|
|
|
const fieldNames = { value: 'id', label: 'name' };
|
|
|
const dialogs = ref([]);
|
|
|
@@ -138,54 +108,12 @@
|
|
|
let sessionScrollList = ref([]);
|
|
|
let isReached = ref(true);
|
|
|
|
|
|
- const DialogList = async () => {
|
|
|
- const { code, data } = await getDialogListApi();
|
|
|
- if (code === 200) {
|
|
|
- if (data) {
|
|
|
- selectValue.value = data[0].id;
|
|
|
- dialogs.value = data.map((item) => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- type: 1, //智能体
|
|
|
- };
|
|
|
- });
|
|
|
- // console.log(data, "dialogs");
|
|
|
- queryCanvas();
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const queryCanvas = async (params = {}) => {
|
|
|
- try {
|
|
|
- const { data } = await queryCanvasList(params);
|
|
|
- console.log(data, 'agent');
|
|
|
- agentList.value = data.map((item) => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- name: item.title,
|
|
|
- type: 2, //agent
|
|
|
- };
|
|
|
- });
|
|
|
- // 合并数组
|
|
|
- dialogs.value = dialogs.value.concat(agentList.value);
|
|
|
-
|
|
|
- // 判断当前是智能体或agent
|
|
|
- // console.log(val, 'val');
|
|
|
- // if (dialogs.value.length > 0) {
|
|
|
- // dialogChange(dialogs.value[0].id);
|
|
|
- // }
|
|
|
- //新建会话
|
|
|
- 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,
|
|
|
+ searchParam: searchValue.value,
|
|
|
...queryPage,
|
|
|
});
|
|
|
if (code === 200) {
|
|
|
@@ -281,6 +209,10 @@
|
|
|
...queryPage,
|
|
|
});
|
|
|
if (code === 200) {
|
|
|
+ if (data.length == 0) {
|
|
|
+ isReached.value = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
sessionScrollList.value = data.map((item) => {
|
|
|
return {
|
|
|
...item,
|
|
|
@@ -313,7 +245,6 @@
|
|
|
console.log(httpUrl, '当前地址');
|
|
|
EventBus.on('history', () => {
|
|
|
emit('changeAgentType', '3');
|
|
|
- // DialogList()
|
|
|
queryPage.page = 1;
|
|
|
querySessionList('');
|
|
|
});
|