diff --git a/client/src/components/Chat/Input/SendButton.tsx b/client/src/components/Chat/Input/SendButton.tsx index 14c21f0586..a07e574928 100644 --- a/client/src/components/Chat/Input/SendButton.tsx +++ b/client/src/components/Chat/Input/SendButton.tsx @@ -41,7 +41,8 @@ const SubmitButton = React.memo( const SendButton = React.memo( forwardRef((props: SendButtonProps, ref: React.ForwardedRef) => { const data = useWatch({ control: props.control }); - return ; + const content = data?.text?.trim(); + return ; }), ); diff --git a/client/src/hooks/Chat/useChatFunctions.ts b/client/src/hooks/Chat/useChatFunctions.ts index 30465fc2e5..7cf8c6bf25 100644 --- a/client/src/hooks/Chat/useChatFunctions.ts +++ b/client/src/hooks/Chat/useChatFunctions.ts @@ -97,6 +97,8 @@ export default function useChatFunctions({ ) => { setShowStopButton(false); resetLatestMultiMessage(); + + text = text.trim(); if (!!isSubmitting || text === '') { return; } @@ -134,7 +136,6 @@ export default function useChatFunctions({ // construct the query message // this is not a real messageId, it is used as placeholder before real messageId returned - text = text.trim(); const intermediateId = overrideUserMessageId ?? v4(); parentMessageId = parentMessageId ?? latestMessage?.messageId ?? Constants.NO_PARENT;