SimpleChat: Move handling systemprompt into its own func
This commit is contained in:
parent
72151aa634
commit
601fedf8c1
1 changed files with 17 additions and 8 deletions
|
@ -89,15 +89,12 @@ class SimpleChat {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle submit request by user
|
|
||||||
* @param {HTMLInputElement} inputSystem
|
|
||||||
* @param {HTMLInputElement} inputUser
|
|
||||||
* @param {HTMLDivElement} divChat
|
|
||||||
* @param {string} apiEP
|
|
||||||
*/
|
|
||||||
async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle setting of system prompt.
|
||||||
|
* @param {HTMLInputElement} inputSystem
|
||||||
|
*/
|
||||||
|
function handle_systemprompt(inputSystem) {
|
||||||
let sysPrompt = inputSystem.value;
|
let sysPrompt = inputSystem.value;
|
||||||
if (gChat.xchat.length == 0) {
|
if (gChat.xchat.length == 0) {
|
||||||
if (sysPrompt.length > 0) {
|
if (sysPrompt.length > 0) {
|
||||||
|
@ -114,6 +111,18 @@ async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle submit request by user
|
||||||
|
* @param {HTMLInputElement} inputSystem
|
||||||
|
* @param {HTMLInputElement} inputUser
|
||||||
|
* @param {HTMLDivElement} divChat
|
||||||
|
* @param {string} apiEP
|
||||||
|
*/
|
||||||
|
async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
|
||||||
|
|
||||||
|
handle_systemprompt(inputSystem);
|
||||||
|
|
||||||
let content = inputUser?.value;
|
let content = inputUser?.value;
|
||||||
if (!gChat.add(Roles.User, content)) {
|
if (!gChat.add(Roles.User, content)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue