SimpleChat:JS: bottom of element visible, Set focus to user input

As the generated text could be multiple lines and occupy more space
that the full scrollable div's vertical space, make the bottom of
the last element (which can be such a generated text) in the div
visible by scrolling.

Ensure that the user input box has focus
This commit is contained in:
HanishKVC 2024-05-18 22:59:21 +05:30
parent a944ce7cbe
commit 6eb1e0fbde

View file

@ -54,7 +54,7 @@ class SimpleChat {
last = entry; last = entry;
} }
if (last !== undefined) { if (last !== undefined) {
last.scrollIntoView(true); last.scrollIntoView(false);
} }
} }
@ -178,6 +178,7 @@ async function handle_submit(inputSystem, inputUser, divChat, apiEP) {
if ((apiEP == ApiEP.Completion) && (gbCompletionFreshChatAlways)) { if ((apiEP == ApiEP.Completion) && (gbCompletionFreshChatAlways)) {
gChat.xchat.length = 0; gChat.xchat.length = 0;
} }
inputUser.focus();
} }