SimpleChat: Ignore empty user input, without trimming

This commit is contained in:
HanishKVC 2024-05-18 03:07:40 +05:30
parent ae52ad1675
commit 884adfd739

View file

@ -30,9 +30,10 @@ class SimpleChat {
*/
add(role, content) {
if ((content == undefined) || (content == null) || (content == "")) {
return;
return false;
}
this.xchat.push( {role: role, content: content} );
return true;
}
/**
@ -105,7 +106,10 @@ async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
}
let content = inputUser?.value;
gChat.add(Roles.User, content);
if (!gChat.add(Roles.User, content)) {
console.debug("WARN:HandleSubmit:Ignoring empty user input...");
return;
}
gChat.show(divChat);
let theBody;