mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Make send message validation more robust on web app
This commit is contained in:
@@ -180,13 +180,7 @@ export const ChatInputArea = forwardRef<HTMLTextAreaElement, ChatInputProps>((pr
|
||||
}, [props.isResearchModeEnabled]);
|
||||
|
||||
function onSendMessage() {
|
||||
if (imageUploaded) {
|
||||
setImageUploaded(false);
|
||||
setImagePaths([]);
|
||||
imageData.forEach((data) => props.sendImage(data));
|
||||
}
|
||||
if (!message.trim()) return;
|
||||
|
||||
if (!message.trim() && imageData.length === 0) return;
|
||||
if (!props.isLoggedIn) {
|
||||
setLoginRedirectMessage(
|
||||
"Hey there, you need to be signed in to send messages to Khoj AI",
|
||||
@@ -200,6 +194,12 @@ export const ChatInputArea = forwardRef<HTMLTextAreaElement, ChatInputProps>((pr
|
||||
props.setTriggeredAbort(true);
|
||||
}
|
||||
|
||||
if (imageUploaded) {
|
||||
setImageUploaded(false);
|
||||
setImagePaths([]);
|
||||
imageData.forEach((data) => props.sendImage(data));
|
||||
}
|
||||
|
||||
let messageToSend = message.trim();
|
||||
// Check if message starts with an explicit slash command
|
||||
const startsWithSlashCommand =
|
||||
|
||||
Reference in New Issue
Block a user