SimpleChat:Alert user if they provide sysprompt late or change it
This commit is contained in:
parent
884adfd739
commit
72151aa634
1 changed files with 11 additions and 1 deletions
|
@ -98,11 +98,21 @@ class SimpleChat {
|
||||||
*/
|
*/
|
||||||
async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
|
async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
|
||||||
|
|
||||||
if (gChat.xchat.length == 0) {
|
|
||||||
let sysPrompt = inputSystem.value;
|
let sysPrompt = inputSystem.value;
|
||||||
|
if (gChat.xchat.length == 0) {
|
||||||
if (sysPrompt.length > 0) {
|
if (sysPrompt.length > 0) {
|
||||||
gChat.add(Roles.System, sysPrompt);
|
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;
|
let content = inputUser?.value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue