Skip to content

Commit

Permalink
Fix error handling in BotForm and prevent empty
Browse files Browse the repository at this point in the history
messages in useMessage
  • Loading branch information
n4ze3m committed Nov 18, 2023
1 parent 32bbbd4 commit 7cb6659
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 0 additions & 7 deletions app/widget/src/components/BotForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ export default function BotForm({
onSuccess: () => {
form.setFieldValue("message", "");
},
onError: (error) => {
console.error(error);
// setMessages([
// ...messages,
// { isBot: true, message: "Unable to send message" },
// ]);
},
}
);
return (
Expand Down
3 changes: 3 additions & 0 deletions app/widget/src/hooks/useMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ export const useMessage = () => {
};

const onSubmit = async (message: string) => {
if (message.trim().length === 0) {
return;
}
if (streaming) {
await streamingRequest(message);
} else {
Expand Down

0 comments on commit 7cb6659

Please sign in to comment.