mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
UI: Expand chat vertically and handle header wrapping
This commit is contained in:
parent
a098c7eee3
commit
e3e053ab99
14
css/main.css
14
css/main.css
@ -325,14 +325,6 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.chat-parent {
|
||||
height: calc(100dvh - 179px) !important;
|
||||
}
|
||||
|
||||
.old-ui .chat-parent {
|
||||
height: calc(100dvh - 310px) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.chat {
|
||||
@ -349,16 +341,16 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
||||
}
|
||||
|
||||
.chat-parent {
|
||||
height: calc(100dvh - 181px);
|
||||
height: calc(100dvh - 113px - var(--chat-input-offset));
|
||||
overflow: auto !important;
|
||||
}
|
||||
|
||||
.old-ui .chat-parent {
|
||||
height: calc(100dvh - 270px);
|
||||
height: calc(100dvh - 207px - var(--chat-input-offset));
|
||||
}
|
||||
|
||||
.chat-parent.bigchat {
|
||||
height: calc(100dvh - 181px) !important;
|
||||
height: calc(100dvh - 113px - var(--chat-input-offset)) !important;
|
||||
}
|
||||
|
||||
.chat > .messages {
|
||||
|
15
js/main.js
15
js/main.js
@ -126,7 +126,7 @@ targetElement.addEventListener("scroll", function() {
|
||||
// Create a MutationObserver instance
|
||||
const observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
updateChatHeight();
|
||||
updateCssProperties();
|
||||
|
||||
if(!isScrolled) {
|
||||
targetElement.scrollTop = targetElement.scrollHeight;
|
||||
@ -329,14 +329,17 @@ function toggleBigPicture() {
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// Define the --chat-height global CSS variable to
|
||||
// the height of the chat parent
|
||||
// Define global CSS properties for resizing and
|
||||
// positioning certain elements
|
||||
//------------------------------------------------
|
||||
function updateChatHeight() {
|
||||
function updateCssProperties() {
|
||||
const chatContainer = document.getElementById('chat').parentNode.parentNode.parentNode;
|
||||
const newChatHeight = `${chatContainer.clientHeight}px`;
|
||||
|
||||
document.documentElement.style.setProperty('--chat-height', newChatHeight);
|
||||
|
||||
const header = document.querySelector('.header_bar');
|
||||
const chatInputOffset = `${header.clientHeight}px`;
|
||||
document.documentElement.style.setProperty('--chat-input-offset', chatInputOffset);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', updateChatHeight);
|
||||
window.addEventListener('resize', updateCssProperties);
|
||||
|
Loading…
Reference in New Issue
Block a user