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 0174c1612..d4524fde2 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 @@ -80,9 +80,7 @@ action="#" :auto-upload="false" :show-file-list="false" - :accept=" - [...imageExtensions, ...documentExtensions].map((ext) => '.' + ext).join(',') - " + :accept="getAcceptList()" :on-change="(file: any, fileList: any) => uploadFile(file, fileList)" > @@ -191,6 +189,24 @@ const documentExtensions = ['pdf', 'docx', 'txt', 'xls', 'xlsx', 'md', 'html', ' const videoExtensions = ['mp4', 'avi', 'mov', 'mkv', 'flv'] const audioExtensions = ['mp3', 'wav', 'aac', 'flac'] +const getAcceptList = () => { + const { image, document, audio, video } = props.applicationDetails.file_upload_setting + let accepts = '' + if (image) { + accepts += imageExtensions.map((ext) => '.' + ext).join(',') + } + if (document) { + accepts += documentExtensions.map((ext) => '.' + ext).join(',') + } + if (audio) { + accepts += audioExtensions.map((ext) => '.' + ext).join(',') + } + if (video) { + accepts += videoExtensions.map((ext) => '.' + ext).join(',') + } + return accepts +} + const uploadFile = async (file: any, fileList: any) => { const { maxFiles, fileLimit } = props.applicationDetails.file_upload_setting if (fileList.length > maxFiles) {