Skip to content

Commit b35b57f

Browse files
committed
refactor: 上传文件支持多选
1 parent 6b4cee1 commit b35b57f

File tree

1 file changed

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

1 file changed

+14
-14
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575

7676
<div class="operate flex align-center">
7777
<span v-if="props.applicationDetails.file_upload_enable" class="flex align-center">
78-
<!-- accept="image/jpeg, image/png, image/gif"-->
7978
<el-upload
8079
action="#"
80+
multiple
8181
:auto-upload="false"
8282
:show-file-list="false"
8383
:accept="getAcceptList()"
@@ -246,23 +246,23 @@ const uploadFile = async (file: any, fileList: any) => {
246246
fileList.splice(0, fileList.length)
247247
return
248248
}
249+
249250
const formData = new FormData()
250-
for (const file of fileList) {
251-
formData.append('file', file.raw, file.name)
252-
//
253-
const extension = file.name.split('.').pop().toLowerCase() // 获取文件后缀名并转为小写
251+
formData.append('file', file.raw, file.name)
252+
//
253+
const extension = file.name.split('.').pop().toLowerCase() // 获取文件后缀名并转为小写
254254
255-
if (imageExtensions.includes(extension)) {
256-
uploadImageList.value.push(file)
257-
} else if (documentExtensions.includes(extension)) {
258-
uploadDocumentList.value.push(file)
259-
} else if (videoExtensions.includes(extension)) {
260-
// videos.push(file)
261-
} else if (audioExtensions.includes(extension)) {
262-
// audios.push(file)
263-
}
255+
if (imageExtensions.includes(extension)) {
256+
uploadImageList.value.push(file)
257+
} else if (documentExtensions.includes(extension)) {
258+
uploadDocumentList.value.push(file)
259+
} else if (videoExtensions.includes(extension)) {
260+
// videos.push(file)
261+
} else if (audioExtensions.includes(extension)) {
262+
// audios.push(file)
264263
}
265264
265+
266266
if (!chatId_context.value) {
267267
const res = await props.openChatId()
268268
chatId_context.value = res

0 commit comments

Comments
 (0)