diff --git a/public/script.js b/public/script.js index 88f850eed..9ca6ada19 100644 --- a/public/script.js +++ b/public/script.js @@ -1378,8 +1378,18 @@ function formatGenerationTimer(gen_started, gen_finished) { function scrollChatToBottom() { if (power_user.auto_scroll_chat_to_bottom) { - var $textchat = $("#chat"); - $textchat.scrollTop(($textchat[0].scrollHeight)); + const chatElement = $("#chat"); + let position = chatElement[0].scrollHeight; + + if (power_user.waifuMode) { + const lastMessage = chatElement.find('.mes').last(); + if (lastMessage.length) { + const lastMessagePosition = lastMessage.position().top; + position = chatElement.scrollTop() + lastMessagePosition; + } + } + + chatElement.scrollTop(position); } }