diff --git a/README.md b/README.md index d35ebe04aa..4b65254d83 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Its goal is to become the [AUTOMATIC1111/stable-diffusion-webui](https://github. * Dropdown menu for quickly switching between different models. * Large number of extensions (built-in and user-contributed), including Coqui TTS for realistic voice outputs, Whisper STT for voice inputs, translation, [multimodal pipelines](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/multimodal), vector databases, Stable Diffusion integration, and a lot more. See [the wiki](https://github.com/oobabooga/text-generation-webui/wiki/07-%E2%80%90-Extensions) and [the extensions directory](https://github.com/oobabooga/text-generation-webui-extensions) for details. * [Chat with custom characters](https://github.com/oobabooga/text-generation-webui/wiki/03-%E2%80%90-Parameters-Tab#character). -* Precise chat templates for instruction-following models, including Llama-2-chat, Alpaca, Vicuna, Mistral, and many others. +* Precise chat templates for instruction-following models, including Llama-2-chat, Alpaca, Vicuna, Mistral. * LoRA: train new LoRAs with your own data, load/unload LoRAs on the fly for generation. * Transformers library integration: load models in 4-bit or 8-bit precision through bitsandbytes, use llama.cpp with transformers samplers (`llamacpp_HF` loader), CPU inference in 32-bit precision using PyTorch. * OpenAI-compatible API server with Chat and Completions endpoints -- see the [examples](https://github.com/oobabooga/text-generation-webui/wiki/12-%E2%80%90-OpenAI-API#examples). diff --git a/css/html_instruct_style.css b/css/html_instruct_style.css index 1908f879f7..acff04f196 100644 --- a/css/html_instruct_style.css +++ b/css/html_instruct_style.css @@ -1,10 +1,18 @@ +.chat { + background: var(--block-background-fill); + padding: 24px 19px; + padding-right: 19px !important; + border: 1px solid var(--block-border-color); + border-radius: 8px; +} + .message { display: grid; grid-template-columns: 60px 1fr; padding-bottom: 25px; font-size: 15px; font-family: 'Noto Sans', Helvetica, Arial, sans-serif; - line-height: 22px; + line-height: 24px; } .username { @@ -13,11 +21,16 @@ .message-body p, .message-body li { font-size: 15px !important; - line-height: 22.5px !important; + line-height: 24px !important; + list-style-position: outside; } .message-body p, .chat .message-body ul, .chat .message-body ol { - margin-bottom: 23.4375px !important; + margin-bottom: 16px !important; +} + +.chat .message-body ul, .chat .message-body ol { + padding-inline-start: 2em; } .message-body p:last-child, .chat .message-body ul:last-child, .chat .message-body ol:last-child { @@ -34,34 +47,34 @@ .gradio-container .chat .assistant-message { padding: 20px; - border-radius: 20px; - background-color: #0000000f; - margin-top: 9px !important; - margin-bottom: 18px !important; + background: var(--background-fill-secondary); + margin-top: 12px !important; + margin-bottom: 24px !important; + margin-right: 16px; + border-radius: 22px; + border-bottom-left-radius: 0; + border: 1px solid var(--border-color-primary); } .gradio-container .chat .user-message { padding: 20px; + background-color: var(--color-accent-soft); border-radius: 20px; - margin-bottom: 9px !important; + margin-bottom: 12px !important; + margin-left: 16px; + border-radius: 22px; + border-bottom-right-radius: 0; + border: 1px solid var(--border-color-accent-subdued); } .gradio-container .chat .assistant-message:last-child, .gradio-container .chat .user-message:last-child { margin-bottom: 0 !important; } -.dark .chat .assistant-message { - background-color: #1f2937; -} - -.dark .chat .user-message { - background-color: transparent; -} - code { - background-color: white !important; + background-color: #f3f4f6 !important; } .dark code { - background-color: #0e1321 !important; + background-color: #1f2937 !important; } \ No newline at end of file diff --git a/css/main.css b/css/main.css index a3480fe034..a53f99d025 100644 --- a/css/main.css +++ b/css/main.css @@ -332,7 +332,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* { margin-left: auto; margin-right: auto; max-width: 880px; - height: 100%; + min-height: var(--chat-height); overflow-y: auto; padding-right: 15px; display: flex; diff --git a/js/main.js b/js/main.js index 1e50e14742..5c05b394c8 100644 --- a/js/main.js +++ b/js/main.js @@ -123,6 +123,8 @@ targetElement.addEventListener("scroll", function() { // Create a MutationObserver instance const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { + updateChatHeight(); + if(!isScrolled) { targetElement.scrollTop = targetElement.scrollHeight; } @@ -373,3 +375,15 @@ function toggleBigPicture() { } } +//------------------------------------------------ +// Define the --chat-height global CSS variable to +// the height of the chat parent +//------------------------------------------------ +function updateChatHeight() { + const chatContainer = document.getElementById('chat').parentNode.parentNode.parentNode; + const newChatHeight = `${chatContainer.clientHeight}px`; + + document.documentElement.style.setProperty('--chat-height', newChatHeight); +} + +window.addEventListener('resize', updateChatHeight);