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
This commit is contained in:
CaptainB 2025-08-04 17:28:25 +08:00
parent ab10ac9bc6
commit bbf321fc96

View File

@ -423,13 +423,14 @@ const uploadFile = async (file: any, fileList: any) => {
uploadOtherList.value.length
if (file_limit_once >= maxFiles) {
MsgWarning(t('chat.uploadFile.limitMessage1') + maxFiles + t('chat.uploadFile.limitMessage2'))
fileList.splice(0, fileList.length)
fileList.splice(0, fileList.length, ...fileList.slice(0, maxFiles))
return
}
if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) {
// MB
MsgWarning(t('chat.uploadFile.sizeLimit') + fileLimit + 'MB')
fileList.splice(0, fileList.length)
//
fileList.splice(0, fileList.length, ...fileList.filter((f: any) => f.size <= fileLimit * 1024 * 1024))
return
}
const inner = reactive(file)