SimpleChat:Alert user if they provide sysprompt late or change it

This commit is contained in:
HanishKVC 2024-05-18 03:16:30 +05:30
parent 884adfd739
commit 72151aa634

View file

@ -98,11 +98,21 @@ class SimpleChat {
*/
async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
if (gChat.xchat.length == 0) {
let sysPrompt = inputSystem.value;
if (gChat.xchat.length == 0) {
if (sysPrompt.length > 0) {
gChat.add(Roles.System, sysPrompt);
}
} else {
if (sysPrompt.length > 0) {
if (gChat.xchat[0].role !== Roles.System) {
console.error("ERRR:HandleSubmit:You need to specify system prompt before any user query, ignoring...");
} else {
if (gChat.xchat[0].content !== sysPrompt) {
console.error("ERRR:HandleSubmit:You cant change system prompt, mid way through, ignoring...");
}
}
}
}
let content = inputUser?.value;