From 724a9fec2338aaf5cc4c4d222b6ea0974703132e Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期五, 30 八月 2024 19:29:03 +0800 Subject: [PATCH] fix: 修改bug --- src/views/sessionManager/index.vue | 85 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 82 insertions(+), 3 deletions(-) diff --git a/src/views/sessionManager/index.vue b/src/views/sessionManager/index.vue index 03de01b..331cb15 100644 --- a/src/views/sessionManager/index.vue +++ b/src/views/sessionManager/index.vue @@ -384,9 +384,11 @@ ></updataFile> <!-- <uploadFile ref="fileInput" - :sessionId="activeSessionId" + :handleRemove="handleRemove" + :typeXLse="false" @selectFileCallback="selectFileCallback" ></uploadFile> --> + <a-button :disabled="chatDis" @click="sentClick" @@ -545,6 +547,9 @@ getSessionDetailsApi, sessionListApi, uploadWithoutKb, + uploadAndParse, + chatInfos, + chatRm, } from '@/api/session'; import { getAuthorization } from '@/utils/auth'; import { queryCanvasList } from '@/api/Agent'; @@ -772,11 +777,79 @@ uploaditemList.value = [...uploaditemList.value, ...data]; }; + //涓婁紶 + // 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); const deleteFile = (item) => { console.log(uploaditemList.value); uploaditemList.value.splice(item.index, 1); + // EventBus.emit('queryAgent', item); }; const { toClipboard } = useClipboard(); @@ -846,7 +919,7 @@ console.log(name, '鏂板缓浼氳瘽鍚嶇О'); const res = await addSessionApi({ - dialog_id: id, + dialog_id: '', conversation_desc: name, }); // console.log(res, "res"); @@ -1123,9 +1196,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'; @@ -1391,6 +1465,11 @@ } } } + .uploadFileDis { + :deep(.arco-upload-list-type-text) { + display: none; + } + } .chat-item { padding: 10px 0; -- Gitblit v1.8.0