fix: 优化上传图片对话提示

This commit is contained in:
wangdan-fit2cloud 2024-12-10 11:01:35 +08:00
parent aa94f66492
commit cacdfbcb62
2 changed files with 20 additions and 6 deletions

View File

@ -6,7 +6,12 @@
<div <div
class="p-8-12" class="p-8-12"
v-loading="localLoading" v-loading="localLoading"
v-if="uploadDocumentList.length || uploadImageList.length || uploadAudioList.length || uploadVideoList.length" v-if="
uploadDocumentList.length ||
uploadImageList.length ||
uploadAudioList.length ||
uploadVideoList.length
"
> >
<el-space wrap> <el-space wrap>
<template v-for="(item, index) in uploadDocumentList" :key="index"> <template v-for="(item, index) in uploadDocumentList" :key="index">
@ -248,14 +253,21 @@ const getAcceptList = () => {
const checkMaxFilesLimit = () => { const checkMaxFilesLimit = () => {
return ( return (
props.applicationDetails.file_upload_setting.maxFiles <= props.applicationDetails.file_upload_setting.maxFiles <=
uploadImageList.value.length + uploadDocumentList.value.length + uploadAudioList.value.length + uploadVideoList.value.length uploadImageList.value.length +
uploadDocumentList.value.length +
uploadAudioList.value.length +
uploadVideoList.value.length
) )
} }
const uploadFile = async (file: any, fileList: any) => { const uploadFile = async (file: any, fileList: any) => {
const { maxFiles, fileLimit } = props.applicationDetails.file_upload_setting const { maxFiles, fileLimit } = props.applicationDetails.file_upload_setting
// //
const file_limit_once = uploadImageList.value.length + uploadDocumentList.value.length + uploadAudioList.value.length + uploadVideoList.value.length const file_limit_once =
uploadImageList.value.length +
uploadDocumentList.value.length +
uploadAudioList.value.length +
uploadVideoList.value.length
if (file_limit_once >= maxFiles) { if (file_limit_once >= maxFiles) {
MsgWarning('最多上传' + maxFiles + '个文件') MsgWarning('最多上传' + maxFiles + '个文件')
fileList.splice(0, fileList.length) fileList.splice(0, fileList.length)
@ -283,7 +295,6 @@ const uploadFile = async (file: any, fileList: any) => {
uploadAudioList.value.push(file) uploadAudioList.value.push(file)
} }
if (!chatId_context.value) { if (!chatId_context.value) {
const res = await props.openChatId() const res = await props.openChatId()
chatId_context.value = res chatId_context.value = res
@ -332,6 +343,9 @@ const uploadFile = async (file: any, fileList: any) => {
file.file_id = f[0].file_id file.file_id = f[0].file_id
} }
}) })
if (!inputValue.value && uploadImageList.value.length > 0) {
inputValue.value = '请解析图片内容'
}
}) })
} }
const recorderTime = ref(0) const recorderTime = ref(0)
@ -471,7 +485,7 @@ function sendChatHandle(event: any) {
image_list: uploadImageList.value, image_list: uploadImageList.value,
document_list: uploadDocumentList.value, document_list: uploadDocumentList.value,
audio_list: uploadAudioList.value, audio_list: uploadAudioList.value,
video_list: uploadVideoList.value, video_list: uploadVideoList.value
}) })
inputValue.value = '' inputValue.value = ''
uploadImageList.value = [] uploadImageList.value = []

View File

@ -171,7 +171,7 @@ const applicationList = ref<any[]>([])
const paginationConfig = reactive({ const paginationConfig = reactive({
current_page: 1, current_page: 1,
page_size: 20, page_size: 30,
total: 0 total: 0
}) })
interface UserOption { interface UserOption {