Skip to content

Commit

Permalink
Merge pull request FlowiseAI#237 from FlowiseAI/bugfix/Allow-Empty-Im…
Browse files Browse the repository at this point in the history
…age-Upload

Bugfix/Allow empty image uploads
  • Loading branch information
HenryHengZJ authored Sep 3, 2024
2 parents dee4963 + a796fc6 commit 970488c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/components/Bot.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/web.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/components/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,9 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
// Handle form submission
const handleSubmit = async (value: string, action?: IAction | undefined | null) => {
setUserInput(value);

if (value.trim() === '') {
const containsAudio = previews().filter((item) => item.type === 'audio').length > 0;
if (!(previews().length >= 1 && containsAudio)) {
const containsFile = previews().filter((item) => !item.mime.startsWith('image') && item.type !== 'audio').length > 0;
if (!previews().length || (previews().length && containsFile)) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/textInput/components/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const TextInput = (props: Props) => {
setIsSendButtonDisabled(false);
};

const checkIfInputIsValid = () => inputValue() !== '' && warningMessage() === '' && inputRef?.reportValidity();
const checkIfInputIsValid = () => warningMessage() === '' && inputRef?.reportValidity();

const submit = () => {
if (checkIfInputIsValid()) {
Expand Down

0 comments on commit 970488c

Please sign in to comment.