Bugfix/prevent upsert when images are uploaded (#3102)
prevent upsert when images are uploaded
This commit is contained in:
parent
690d04309b
commit
61e721fee7
|
|
@ -264,7 +264,10 @@ export const ChatMessage = ({ open, chatflowid, isAgentCanvas, isDialog, preview
|
||||||
}
|
}
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
const { name } = file
|
const { name } = file
|
||||||
|
// Only add files
|
||||||
|
if (!imageUploadAllowedTypes.includes(file.type)) {
|
||||||
uploadedFiles.push(file)
|
uploadedFiles.push(file)
|
||||||
|
}
|
||||||
files.push(
|
files.push(
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
reader.onload = (evt) => {
|
reader.onload = (evt) => {
|
||||||
|
|
@ -340,7 +343,10 @@ export const ChatMessage = ({ open, chatflowid, isAgentCanvas, isDialog, preview
|
||||||
if (isFileAllowedForUpload(file) === false) {
|
if (isFileAllowedForUpload(file) === false) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Only add files
|
||||||
|
if (!imageUploadAllowedTypes.includes(file.type)) {
|
||||||
uploadedFiles.push(file)
|
uploadedFiles.push(file)
|
||||||
|
}
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
const { name } = file
|
const { name } = file
|
||||||
files.push(
|
files.push(
|
||||||
|
|
@ -1197,14 +1203,11 @@ export const ChatMessage = ({ open, chatflowid, isAgentCanvas, isDialog, preview
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isDragActive &&
|
{isDragActive && (getAllowChatFlowUploads.data?.isImageUploadAllowed || getAllowChatFlowUploads.data?.isFileUploadAllowed) && (
|
||||||
(getAllowChatFlowUploads.data?.isImageUploadAllowed || getAllowChatFlowUploads.data?.isFileAllowedForUpload) && (
|
|
||||||
<Box className='drop-overlay'>
|
<Box className='drop-overlay'>
|
||||||
<Typography variant='h2'>Drop here to upload</Typography>
|
<Typography variant='h2'>Drop here to upload</Typography>
|
||||||
{[
|
{[...getAllowChatFlowUploads.data.imgUploadSizeAndTypes, ...getAllowChatFlowUploads.data.fileUploadSizeAndTypes].map(
|
||||||
...getAllowChatFlowUploads.data.imgUploadSizeAndTypes,
|
(allowed) => {
|
||||||
...getAllowChatFlowUploads.data.fileUploadSizeAndTypes
|
|
||||||
].map((allowed) => {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Typography variant='subtitle1'>{allowed.fileTypes?.join(', ')}</Typography>
|
<Typography variant='subtitle1'>{allowed.fileTypes?.join(', ')}</Typography>
|
||||||
|
|
@ -1213,7 +1216,8 @@ export const ChatMessage = ({ open, chatflowid, isAgentCanvas, isDialog, preview
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})}
|
}
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<div ref={ps} className={`${isDialog ? 'cloud-dialog' : 'cloud'}`}>
|
<div ref={ps} className={`${isDialog ? 'cloud-dialog' : 'cloud'}`}>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue