Skip to content

Commit e27533a

Browse files
committed
fix: simplify file size checks in upload logic
--bug=1071413@tapd-62980211 --user=刘瑞斌 【智能体】对话开始前批量上传文件,会错误过滤掉大小合规的文件而保留大小超限的文件 https://www.tapd.cn/62980211/s/1970046
1 parent ad7a33c commit e27533a

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

  • ui/src/components/ai-chat/component/chat-input-operate

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,17 +530,14 @@ const uploadFile = async (file: any, fileList: any) => {
530530
fileList.splice(0, fileList.length, ...fileList.slice(0, maxFiles))
531531
return
532532
}
533-
if (fileList.filter((f: any) => f.size == 0).length > 0) {
534-
// MB
533+
if (file.size == 0) {
535534
MsgWarning(t('aiChat.uploadFile.sizeLimit2'))
536-
// 空文件上传过滤
537535
fileList.splice(0, fileList.length, ...fileList.filter((f: any) => f.size > 0))
538536
return
539537
}
540-
if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) {
538+
if (file.size > fileLimit * 1024 * 1024) {
541539
// MB
542540
MsgWarning(t('aiChat.uploadFile.sizeLimit') + fileLimit + 'MB')
543-
// 只保留未超出大小限制的文件
544541
fileList.splice(
545542
0,
546543
fileList.length,

0 commit comments

Comments
 (0)