Skip to content

Commit 36809b3

Browse files
authored
fix: When uploading files during application dialogue, there are special whitespace characters and file name parsing errors #2738 (#2746)
1 parent 165c271 commit 36809b3

File tree

1 file changed

+12
-4
lines changed
  • ui/src/components/ai-chat/component/chat-input-operate

1 file changed

+12
-4
lines changed

ui/src/components/ai-chat/component/chat-input-operate/index.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,28 +392,36 @@ const uploadFile = async (file: any, fileList: any) => {
392392
.then((response) => {
393393
fileList.splice(0, fileList.length)
394394
uploadImageList.value.forEach((file: any) => {
395-
const f = response.data.filter((f: any) => f.name === file.name)
395+
const f = response.data.filter(
396+
(f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '')
397+
)
396398
if (f.length > 0) {
397399
file.url = f[0].url
398400
file.file_id = f[0].file_id
399401
}
400402
})
401403
uploadDocumentList.value.forEach((file: any) => {
402-
const f = response.data.filter((f: any) => f.name === file.name)
404+
const f = response.data.filter(
405+
(f: any) => f.name.replaceAll(' ', '') == file.name.replaceAll(' ', '')
406+
)
403407
if (f.length > 0) {
404408
file.url = f[0].url
405409
file.file_id = f[0].file_id
406410
}
407411
})
408412
uploadAudioList.value.forEach((file: any) => {
409-
const f = response.data.filter((f: any) => f.name === file.name)
413+
const f = response.data.filter(
414+
(f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '')
415+
)
410416
if (f.length > 0) {
411417
file.url = f[0].url
412418
file.file_id = f[0].file_id
413419
}
414420
})
415421
uploadVideoList.value.forEach((file: any) => {
416-
const f = response.data.filter((f: any) => f.name === file.name)
422+
const f = response.data.filter(
423+
(f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '')
424+
)
417425
if (f.length > 0) {
418426
file.url = f[0].url
419427
file.file_id = f[0].file_id

0 commit comments

Comments
 (0)