Skip to content

Commit

Permalink
allow empty image uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHengZJ committed Sep 3, 2024
1 parent b1de82a commit a796fc6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 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.

2 changes: 0 additions & 2 deletions src/components/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,9 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
// Handle form submission
const handleSubmit = async (value: string, action?: IAction | undefined | null) => {
setUserInput(value);
console.log('handleSubmit =', value);
if (value.trim() === '') {
const containsFile = previews().filter((item) => !item.mime.startsWith('image') && item.type !== 'audio').length > 0;
if (!previews().length || (previews().length && containsFile)) {
console.log('No message to send');
return;
}
}
Expand Down

0 comments on commit a796fc6

Please sign in to comment.