From 432d47bd7fa2eac4f084f7f1dfdef452de760ae8 Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期一, 02 九月 2024 10:21:03 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/flow_web
---
src/views/sessionManager/index.vue | 123 +++++++++++++++++++++++++++++++++++------
1 files changed, 105 insertions(+), 18 deletions(-)
diff --git a/src/views/sessionManager/index.vue b/src/views/sessionManager/index.vue
index 4208bee..a7332b5 100644
--- a/src/views/sessionManager/index.vue
+++ b/src/views/sessionManager/index.vue
@@ -291,18 +291,20 @@
/>
</template>
<template #content>
- <a-textarea
- readonly
- auto-size
- v-model="displayedText"
- :class="{ chatItemAnswer: theme === 'light' }"
- :style="{
- backgroundColor:
- theme === 'light' ? '#ffffff' : '#000000',
- }"
- style="border: none"
- >
- </a-textarea>
+ <a-spin :loading="chartLoading" dot style="width: 100%">
+ <a-textarea
+ readonly
+ auto-size
+ v-model="displayedText"
+ :class="{ chatItemAnswer: theme === 'light' }"
+ :style="{
+ backgroundColor:
+ theme === 'light' ? '#ffffff' : '#000000',
+ }"
+ style="border: none"
+ >
+ </a-textarea>
+ </a-spin>
</template>
<template #actions>
@@ -382,9 +384,11 @@
></updataFile>
<!-- <uploadFile
ref="fileInput"
- :sessionId="activeSessionId"
+ :handleRemove="handleRemove"
+ :typeXLse="false"
@selectFileCallback="selectFileCallback"
></uploadFile> -->
+
<a-button
:disabled="chatDis"
@click="sentClick"
@@ -543,6 +547,9 @@
getSessionDetailsApi,
sessionListApi,
uploadWithoutKb,
+ uploadAndParse,
+ chatInfos,
+ chatRm,
} from '@/api/session';
import { getAuthorization } from '@/utils/auth';
import { queryCanvasList } from '@/api/Agent';
@@ -574,6 +581,7 @@
const modalObj = reactive({ add: false });
const dialogId = ref('');
const chatDis = ref(false);
+ const chartLoading = ref(false);
const loading = ref(false);
const agentType = ref('1');
const agentTitle = ref('鏈懡鍚嶄細璇�');
@@ -765,10 +773,76 @@
// formRef.value.resetFields();
};
- const selectFileCallback = (data) => {
- // debugger;
- // console.log(data, 'selectFileCallback');
+ const selectFileCallback = (data,conversation_id) => {
uploaditemList.value = [...uploaditemList.value, ...data];
+ activeSessionId.value = conversation_id;
+ };
+
+ //涓婁紶
+ // const selectFileCallback = async (resData, file) => {
+ // console.log(111);
+ // try {
+ // const formData = new FormData();
+ // uploaditemList.value = resData;
+ // uploaditemList.value.map((item) => {
+ // if (item.name == file[0].file.name) {
+ // item.onFileSelectedLoading = true;
+ // item.textName = '涓婁紶涓�';
+ // }
+ // return item;
+ // });
+ // debugger;
+ // if (!activeSessionId.value) {
+ // await createSession(resData);
+ // }
+
+ // // onFileSelectedLoading.value = true;
+ // // textName.value = '涓婁紶涓�';
+
+ // formData.append('files', file[0].file);
+ // formData.append('conversation_id', activeSessionId.value);
+
+ // console.log(formData, 'formData');
+ // const { data, code } = await uploadAndParse(formData);
+ // if (code === 200) {
+ // uploaditemList.value.map((item: any) => {
+ // item.onFileSelectedLoading = false;
+ // item.textName = '涓婁紶鎴愬姛';
+ // return item;
+ // });
+ // getInfo(data);
+ // // onFileSelectedLoading.value = false;
+ // // textName.value = '涓婁紶鎴愬姛';
+ // }
+ // } catch (err) {
+ // uploaditemList.value.map((item: any) => {
+ // item.onFileSelectedLoading = false;
+ // item.textName = '涓婁紶澶辫触';
+ // return item;
+ // });
+ // // onFileSelectedLoading.value = false;
+ // // textName.value = '涓婁紶澶辫触';
+ // Message.error('涓婁紶澶辫触');
+ // }
+ // };
+
+ //涓婁紶鎴愬姛瑙f瀽getinfo
+ const getInfo = async (id) => {
+ const { code, data } = await chatInfos({
+ doc_ids: activeSessionId.value,
+ });
+ if (code === 200) {
+ uploaditemList.value = data;
+ }
+ };
+ //鍒犻櫎涓婁紶鏂囨。
+ const deleteUpload = async (id) => {
+ const { code, data } = await chatRm({
+ doc_id: id,
+ });
+ if (code === 200) {
+ getInfo();
+ }
};
let onFileSelectedLoading = ref(false);
@@ -776,6 +850,7 @@
const deleteFile = (item) => {
console.log(uploaditemList.value);
uploaditemList.value.splice(item.index, 1);
+ // EventBus.emit('queryAgent', item);
};
const { toClipboard } = useClipboard();
@@ -845,7 +920,7 @@
console.log(name, '鏂板缓浼氳瘽鍚嶇О');
const res = await addSessionApi({
- dialog_id: id,
+ dialog_id: '',
conversation_desc: name,
});
// console.log(res, "res");
@@ -926,6 +1001,7 @@
const startChat = async (valMsg) => {
chatDis.value = true;
loading.value = true;
+ chartLoading.value = true;
toStop = false;
sessionDetailList.value.push({
content: valMsg,
@@ -969,6 +1045,7 @@
if (typeof d !== 'boolean') {
// console.info("data:", d);
streamStr.value = d.content;
+ chartLoading.value = false;
startDisplayStr();
}
} catch (e) {
@@ -977,6 +1054,7 @@
if (done) {
console.info('done');
displayedText.value = '';
+ chartLoading.value = false;
if (isStopChat.value) {
setChatDataMeg(chatDataMeg);
} else {
@@ -1119,9 +1197,10 @@
activeSessionId.value = '';
});
onMounted(() => {
+ document.getElementsByTagName;
let container = document.getElementById('container');
container.addEventListener('click', () => {
- fileInput.value.cancel();
+ // fileInput.value.cancel();
});
EventBus.on('newChat', () => {
agentType.value = '1';
@@ -1387,6 +1466,11 @@
}
}
}
+ .uploadFileDis {
+ :deep(.arco-upload-list-type-text) {
+ display: none;
+ }
+ }
.chat-item {
padding: 10px 0;
@@ -1428,6 +1512,9 @@
margin-left: 10px;
}
}
+ :deep(.arco-spin-loading .arco-spin-mask-icon) {
+ left: 10%;
+ }
}
.right {
--
Gitblit v1.8.0