SimpleChat: Try keep input element in view

This commit is contained in:
HanishKVC 2024-05-17 21:55:43 +05:30
parent 564469e4f6
commit 7d772f6b9a

View file

@ -97,6 +97,7 @@ async function handle_submit(inputUser, divChat, urlApi, bMessages=true) {
} else { } else {
theBody = gChat.request_prompt_jsonstr(); theBody = gChat.request_prompt_jsonstr();
} }
inputUser.scrollIntoView(true);
inputUser.value = "working..."; inputUser.value = "working...";
inputUser.disabled = true; inputUser.disabled = true;
console.debug("DBUG:HandleSubmit:ReqBody:", theBody); console.debug("DBUG:HandleSubmit:ReqBody:", theBody);
@ -114,6 +115,7 @@ async function handle_submit(inputUser, divChat, urlApi, bMessages=true) {
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);
inputUser.scrollIntoView(true);
} }