From ff0ae974a1c561eaf2915988dac63cd066af189f Mon Sep 17 00:00:00 2001
From: yinbangzhong <zhongbangyin@126.com>
Date: 星期四, 12 九月 2024 09:23:44 +0800
Subject: [PATCH] bug fix
---
src/api/session.ts | 12 +++-
src/views/sessionManager/index.vue | 26 ++++++++
src/views/sessionManager/components/historySession.vue | 103 +++++----------------------------
src/views/sessionManager/components/updataFile.vue | 17 ++++-
4 files changed, 62 insertions(+), 96 deletions(-)
diff --git a/src/api/session.ts b/src/api/session.ts
index ccdf1e5..031daf1 100644
--- a/src/api/session.ts
+++ b/src/api/session.ts
@@ -13,9 +13,15 @@
}
// 浼氳瘽鍒楄〃鍒嗛〉
export function sessionListApiPage(data) {
- return axios.get<ISessionListResult>(
- `/api/conversation/list?modeltype=localragflow&dialogid=&page=${data.page}&per_page=${data.page_size}`,
- );
+ if (data?.searchParam) {
+ return axios.get<ISessionListResult>(
+ `/api/conversation/list?modeltype=localragflow&search=${data.searchParam}&dialogid=&page=${data.page}&per_page=${data.page_size}`
+ );
+ } else {
+ return axios.get<ISessionListResult>(
+ `/api/conversation/list?modeltype=localragflow&dialogid=&page=${data.page}&per_page=${data.page_size}`
+ );
+ }
}
// 鍒犻櫎浼氳瘽
export function deleteSessionApi(conversation_ids: string[]) {
diff --git a/src/views/sessionManager/components/historySession.vue b/src/views/sessionManager/components/historySession.vue
index 243d7dc..a7b9018 100644
--- a/src/views/sessionManager/components/historySession.vue
+++ b/src/views/sessionManager/components/historySession.vue
@@ -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);
-
- // 鍒ゆ柇褰撳墠鏄櫤鑳戒綋鎴朼gent
- // 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('');
});
diff --git a/src/views/sessionManager/components/updataFile.vue b/src/views/sessionManager/components/updataFile.vue
index 6e5f47b..12c54d6 100644
--- a/src/views/sessionManager/components/updataFile.vue
+++ b/src/views/sessionManager/components/updataFile.vue
@@ -196,7 +196,7 @@
]);
const parser_idsArr = ref([]);
const uploadList = ref([]);
- const props = defineProps(['sessionId']);
+ const props = defineProps(['sessionId','hide']);
const emit = defineEmits(['selectFileCallback']);
const uploadRef = ref();
const files = ref([]);
@@ -365,13 +365,20 @@
});
onMounted(() => {});
+ //鐩戞帶澶氫釜灞炴�у彉鍖�
watch(
- () => props.sessionId,
- (value) => {
-
- activeSessionId.value = value;
+ () => [props.sessionId, props.hide],
+ ([in_sessionId, in_hide]) => {
+ if (visible.value != in_hide) {
+ visible.value = false;
+ }
+ if (activeSessionId.value != in_sessionId) {
+ activeSessionId.value = in_sessionId;
+ }
}
);
+
+
</script>
<style>
.upload-wrap .arco-select-view-inner {
diff --git a/src/views/sessionManager/index.vue b/src/views/sessionManager/index.vue
index 5a681db..6dfc3d0 100644
--- a/src/views/sessionManager/index.vue
+++ b/src/views/sessionManager/index.vue
@@ -363,6 +363,7 @@
<updataFile
ref="fileInput"
:sessionId="activeSessionId"
+ :hide="hide_upload"
@selectFileCallback="selectFileCallback"
></updataFile>
@@ -574,6 +575,7 @@
const streamStr = ref('');
const inputMsg = ref('');
const activeSessionId = ref('');
+ const hide_upload=ref(2);
const fieldNames = { value: 'id', label: 'name' };
const dialogs = ref([]);
const dialogObj = reactive({});
@@ -610,13 +612,16 @@
if (errors) return;
let chatData = {
id: chatObj.id,
- conversation_id: chatObj.id,
- name: from.name,
+ dialog_id: chatObj.dialog_id,
+ conversation_desc: from.name,
};
const { code, data } = await addSessionApi(chatData);
if (data) {
Message.success('淇敼鎴愬姛');
handleCancel();
+ if (data?.id) {
+ activeSessionId.value = data.id;
+ }
queryNewSessionDetail(activeSessionId.value);
}
};
@@ -664,6 +669,12 @@
if (isExistTip(message)) {
if (role == 'assistant' && index) {
let i = index / 2 - 1 > 0 ? index / 2 - 1 : 0;
+ if (data.length == 1) {
+ i = 0;
+ }
+ if (data.length == i) {
+ i = data.length-1;
+ }
dataItem = data[i].doc_aggs;
}
} else {
@@ -676,6 +687,12 @@
const getTipContent = (data, index): string => {
let maxSimilarityContent = '';
let i = index / 2 - 1 > 0 ? index / 2 - 1 : 0;
+ if (data.length == 1) {
+ i = 0;
+ }
+ if (data.length == i) {
+ i = data.length-1;
+ }
let maxSimilarity = 0;
data[i].chunks.forEach((chunk) => {
if (chunk.similarity > maxSimilarity) {
@@ -1073,6 +1090,8 @@
};
const changeAgentType = (val, session) => {
+ hide_upload.value = hide_upload.value+1;
+ uploaditemList.value=[];
agentType.value = val;
console.log(val, 'val');
};
@@ -1083,6 +1102,7 @@
from.name = session.name;
const { code, data } = await getSessionDetailsApi(session.id);
if (code === 200) {
+ Object.assign(chatObj, data);
sessionDetailList.value = data.message;
messagenList.value = data;
refreshScroll(); //鍒锋柊婊氬姩鏉′綅缃�
@@ -1142,6 +1162,8 @@
EventBus.on('newChat', () => {
uploaditemList.value = [];
agentType.value = '1';
+ chatObj = {};
+ hide_upload.value = hide_upload.value+1;
// createSession('');
activeSessionId.value = '';
sessionDetailList.value = [
--
Gitblit v1.8.0