From 36809b3314be5d1e7be2def8c77a17fbcb67bfef Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Mon, 31 Mar 2025 14:59:32 +0800 Subject: [PATCH] fix: When uploading files during application dialogue, there are special whitespace characters and file name parsing errors #2738 (#2746) --- .../component/chat-input-operate/index.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ui/src/components/ai-chat/component/chat-input-operate/index.vue b/ui/src/components/ai-chat/component/chat-input-operate/index.vue index 73faae080..497fbc98b 100644 --- a/ui/src/components/ai-chat/component/chat-input-operate/index.vue +++ b/ui/src/components/ai-chat/component/chat-input-operate/index.vue @@ -392,28 +392,36 @@ const uploadFile = async (file: any, fileList: any) => { .then((response) => { fileList.splice(0, fileList.length) uploadImageList.value.forEach((file: any) => { - const f = response.data.filter((f: any) => f.name === file.name) + const f = response.data.filter( + (f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '') + ) if (f.length > 0) { file.url = f[0].url file.file_id = f[0].file_id } }) uploadDocumentList.value.forEach((file: any) => { - const f = response.data.filter((f: any) => f.name === file.name) + const f = response.data.filter( + (f: any) => f.name.replaceAll(' ', '') == file.name.replaceAll(' ', '') + ) if (f.length > 0) { file.url = f[0].url file.file_id = f[0].file_id } }) uploadAudioList.value.forEach((file: any) => { - const f = response.data.filter((f: any) => f.name === file.name) + const f = response.data.filter( + (f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '') + ) if (f.length > 0) { file.url = f[0].url file.file_id = f[0].file_id } }) uploadVideoList.value.forEach((file: any) => { - const f = response.data.filter((f: any) => f.name === file.name) + const f = response.data.filter( + (f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '') + ) if (f.length > 0) { file.url = f[0].url file.file_id = f[0].file_id