SimpleChat: Dont submit if already submitted and waiting
Also make chat the default selection wrt mode
This commit is contained in:
parent
9feb58eaa5
commit
3e5edbacd6
2 changed files with 6 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
<head>
|
<head>
|
||||||
<title>Simple LlamaCPP Chat</title>
|
<title>Simple LlamaCPP Chat</title>
|
||||||
<meta name="message" content="Save Nature Save Earth" />
|
<meta name="message" content="Save Nature Save Earth" />
|
||||||
<meta name="description" content="Simple chat / test LLM web service endpoints /completions and /chat/completions" />
|
<meta name="description" content="SimpleChat: trigger LLM web service endpoints /chat/completions and /completions, also try chat" />
|
||||||
<meta name="author" content="by Humans for All" />
|
<meta name="author" content="by Humans for All" />
|
||||||
<script src="simplechat.js"></script>
|
<script src="simplechat.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<label for="api-ep">Mode:</label>
|
<label for="api-ep">Mode:</label>
|
||||||
<select name="api-ep" id="api-ep">
|
<select name="api-ep" id="api-ep">
|
||||||
<option value="chat">Chat</option>
|
<option value="chat" selected>Chat</option>
|
||||||
<option value="completion">Completion</option>
|
<option value="completion">Completion</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ async function handle_submit(inputUser, divChat, apiEP) {
|
||||||
inputUser.value = "";
|
inputUser.value = "";
|
||||||
inputUser.disabled = false;
|
inputUser.disabled = false;
|
||||||
let respBody = await resp.json();
|
let respBody = await resp.json();
|
||||||
console.log("DBUG:HandleSubmit:RespBody:", respBody);
|
console.debug("DBUG:HandleSubmit:RespBody:", respBody);
|
||||||
let assistantMsg = respBody["choices"][0]["message"]["content"];
|
let assistantMsg = respBody["choices"][0]["message"]["content"];
|
||||||
gChat.add(Roles.Assistant, assistantMsg);
|
gChat.add(Roles.Assistant, assistantMsg);
|
||||||
gChat.show(divChat);
|
gChat.show(divChat);
|
||||||
|
@ -152,6 +152,9 @@ function startme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
btnSubmit?.addEventListener("click", (ev)=>{
|
btnSubmit?.addEventListener("click", (ev)=>{
|
||||||
|
if (inputUser.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
handle_submit(inputUser, divChat, selectApiEP.value);
|
handle_submit(inputUser, divChat, selectApiEP.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue