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 7560e549f..dcdb8aa9f 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 @@ -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)