Skip to content

Commit bbf321f

Browse files
committed
fix: improve file list management by limiting to max files and filtering oversized files
--bug=1059967 --user=刘瑞斌 【应用】高级编排上传文件最大数量设置为100,上传101个文件,不显示上传的文件,对话时上传文件为空 https://www.tapd.cn/62980211/s/1748567
1 parent ab10ac9 commit bbf321f

File tree

1 file changed

+3
-2
lines changed
  • ui/src/components/ai-chat/component/chat-input-operate

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,14 @@ const uploadFile = async (file: any, fileList: any) => {
423423
uploadOtherList.value.length
424424
if (file_limit_once >= maxFiles) {
425425
MsgWarning(t('chat.uploadFile.limitMessage1') + maxFiles + t('chat.uploadFile.limitMessage2'))
426-
fileList.splice(0, fileList.length)
426+
fileList.splice(0, fileList.length, ...fileList.slice(0, maxFiles))
427427
return
428428
}
429429
if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) {
430430
// MB
431431
MsgWarning(t('chat.uploadFile.sizeLimit') + fileLimit + 'MB')
432-
fileList.splice(0, fileList.length)
432+
// 只保留未超出大小限制的文件
433+
fileList.splice(0, fileList.length, ...fileList.filter((f: any) => f.size <= fileLimit * 1024 * 1024))
433434
return
434435
}
435436
const inner = reactive(file)

0 commit comments

Comments
 (0)