mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 09:19:23 +01:00
Instruct style improvements (#4951)
This commit is contained in:
parent
41424907b1
commit
7a84d7b2da
@ -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 {
|
.message {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 60px 1fr;
|
grid-template-columns: 60px 1fr;
|
||||||
padding-bottom: 25px;
|
padding-bottom: 25px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-family: 'Noto Sans', Helvetica, Arial, sans-serif;
|
font-family: 'Noto Sans', Helvetica, Arial, sans-serif;
|
||||||
line-height: 22px;
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.username {
|
.username {
|
||||||
@ -13,11 +21,16 @@
|
|||||||
|
|
||||||
.message-body p, .message-body li {
|
.message-body p, .message-body li {
|
||||||
font-size: 15px !important;
|
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 {
|
.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 {
|
.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 {
|
.gradio-container .chat .assistant-message {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 20px;
|
background: var(--background-fill-secondary);
|
||||||
background-color: #0000000f;
|
margin-top: 12px !important;
|
||||||
margin-top: 9px !important;
|
margin-bottom: 24px !important;
|
||||||
margin-bottom: 18px !important;
|
margin-right: 16px;
|
||||||
|
border-radius: 22px;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border: 1px solid var(--border-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.gradio-container .chat .user-message {
|
.gradio-container .chat .user-message {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
background-color: var(--color-accent-soft);
|
||||||
border-radius: 20px;
|
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 {
|
.gradio-container .chat .assistant-message:last-child, .gradio-container .chat .user-message:last-child {
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .chat .assistant-message {
|
|
||||||
background-color: #1f2937;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .chat .user-message {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
code {
|
||||||
background-color: white !important;
|
background-color: #f3f4f6 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark code {
|
.dark code {
|
||||||
background-color: #0e1321 !important;
|
background-color: #1f2937 !important;
|
||||||
}
|
}
|
@ -332,7 +332,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
max-width: 880px;
|
max-width: 880px;
|
||||||
height: 100%;
|
min-height: var(--chat-height);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
14
js/main.js
14
js/main.js
@ -123,6 +123,8 @@ targetElement.addEventListener("scroll", function() {
|
|||||||
// Create a MutationObserver instance
|
// Create a MutationObserver instance
|
||||||
const observer = new MutationObserver(function(mutations) {
|
const observer = new MutationObserver(function(mutations) {
|
||||||
mutations.forEach(function(mutation) {
|
mutations.forEach(function(mutation) {
|
||||||
|
updateChatHeight();
|
||||||
|
|
||||||
if(!isScrolled) {
|
if(!isScrolled) {
|
||||||
targetElement.scrollTop = targetElement.scrollHeight;
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user