mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Restyle the chat input box + several CSS improvements
- Remove extra spacing below the last chat message - Change the background color of code blocks in dark mode - Remove border radius from selected header bar elements - Make the chat scrollbar more discrete
This commit is contained in:
parent
cebe07f29c
commit
bdb6eb5734
@ -43,6 +43,10 @@
|
|||||||
margin-bottom: 9px !important;
|
margin-bottom: 9px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gradio-container .chat .assistant-message:last-child, .gradio-container .chat .user-message:last-child {
|
||||||
|
margin-bottom: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.dark .chat .assistant-message {
|
.dark .chat .assistant-message {
|
||||||
background-color: #3741519e;
|
background-color: #3741519e;
|
||||||
border: 1px solid #4b5563;
|
border: 1px solid #4b5563;
|
||||||
@ -58,5 +62,5 @@ code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dark code {
|
.dark code {
|
||||||
background-color: #1a212f !important;
|
background-color: #0e1321 !important;
|
||||||
}
|
}
|
32
css/main.css
32
css/main.css
@ -100,6 +100,10 @@ div.svelte-15lo0d8 > *, div.svelte-15lo0d8 > .form > * {
|
|||||||
background-color: #8080802b;
|
background-color: #8080802b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header_bar button.selected {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.textbox_default textarea {
|
.textbox_default textarea {
|
||||||
height: calc(100dvh - 310px);
|
height: calc(100dvh - 310px);
|
||||||
}
|
}
|
||||||
@ -166,7 +170,7 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pretty_scrollbar::-webkit-scrollbar {
|
.pretty_scrollbar::-webkit-scrollbar {
|
||||||
width: 10px;
|
width: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pretty_scrollbar::-webkit-scrollbar-track {
|
.pretty_scrollbar::-webkit-scrollbar-track {
|
||||||
@ -176,13 +180,11 @@ button {
|
|||||||
.pretty_scrollbar::-webkit-scrollbar-thumb,
|
.pretty_scrollbar::-webkit-scrollbar-thumb,
|
||||||
.pretty_scrollbar::-webkit-scrollbar-thumb:hover {
|
.pretty_scrollbar::-webkit-scrollbar-thumb:hover {
|
||||||
background: #c5c5d2;
|
background: #c5c5d2;
|
||||||
border-radius: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .pretty_scrollbar::-webkit-scrollbar-thumb,
|
.dark .pretty_scrollbar::-webkit-scrollbar-thumb,
|
||||||
.dark .pretty_scrollbar::-webkit-scrollbar-thumb:hover {
|
.dark .pretty_scrollbar::-webkit-scrollbar-thumb:hover {
|
||||||
background: #374151;
|
background: #374151;
|
||||||
border-radius: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pretty_scrollbar::-webkit-resizer {
|
.pretty_scrollbar::-webkit-resizer {
|
||||||
@ -247,7 +249,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#chat {
|
#chat {
|
||||||
height: calc(100dvh - 272px) !important;
|
height: calc(100dvh - 262px) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bigchat #chat {
|
.bigchat #chat {
|
||||||
@ -265,7 +267,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-right: 20px;
|
padding-right: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
@ -274,7 +276,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#chat {
|
#chat {
|
||||||
height: calc(100dvh - 284px);
|
height: calc(100dvh - 272px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bigchat #chat {
|
.bigchat #chat {
|
||||||
@ -284,7 +286,7 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
#show-controls {
|
#show-controls {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
left: calc(100% - 140px);
|
left: calc(100% - 130px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat > .messages {
|
.chat > .messages {
|
||||||
@ -292,6 +294,11 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat .message:last-child {
|
||||||
|
margin-bottom: 0px !important;
|
||||||
|
padding-bottom: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.message-body li {
|
.message-body li {
|
||||||
margin-top: 0.5em !important;
|
margin-top: 0.5em !important;
|
||||||
margin-bottom: 0.5em !important;
|
margin-bottom: 0.5em !important;
|
||||||
@ -322,6 +329,17 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* {
|
|||||||
white-space: normal !important;
|
white-space: normal !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#chat-input {
|
||||||
|
padding: 0;
|
||||||
|
padding-top: 18px;
|
||||||
|
background: var(--background-fill-primary);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat-input textarea:focus {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
body {
|
body {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
|
12
js/main.js
12
js/main.js
@ -30,7 +30,9 @@ main_parent.addEventListener('click', function(e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//------------------------------------------------
|
||||||
// Add some scrollbars
|
// Add some scrollbars
|
||||||
|
//------------------------------------------------
|
||||||
const textareaElements = document.querySelectorAll('.add_scrollbar textarea');
|
const textareaElements = document.querySelectorAll('.add_scrollbar textarea');
|
||||||
for(i = 0; i < textareaElements.length; i++) {
|
for(i = 0; i < textareaElements.length; i++) {
|
||||||
textareaElements[i].classList.remove('scroll-hide');
|
textareaElements[i].classList.remove('scroll-hide');
|
||||||
@ -38,7 +40,9 @@ for(i = 0; i < textareaElements.length; i++) {
|
|||||||
textareaElements[i].style.resize = "none";
|
textareaElements[i].style.resize = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------
|
||||||
// Stop generation on Esc pressed
|
// Stop generation on Esc pressed
|
||||||
|
//------------------------------------------------
|
||||||
document.addEventListener("keydown", function(event) {
|
document.addEventListener("keydown", function(event) {
|
||||||
if (event.key === "Escape") {
|
if (event.key === "Escape") {
|
||||||
// Find the element with id 'stop' and click it
|
// Find the element with id 'stop' and click it
|
||||||
@ -49,7 +53,9 @@ document.addEventListener("keydown", function(event) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//------------------------------------------------
|
||||||
// Chat scrolling
|
// Chat scrolling
|
||||||
|
//------------------------------------------------
|
||||||
const targetElement = document.getElementById('chat').parentNode.parentNode.parentNode;
|
const targetElement = document.getElementById('chat').parentNode.parentNode.parentNode;
|
||||||
|
|
||||||
// Create a MutationObserver instance
|
// Create a MutationObserver instance
|
||||||
@ -71,3 +77,9 @@ const config = {
|
|||||||
|
|
||||||
// Start observing the target element
|
// Start observing the target element
|
||||||
observer.observe(targetElement, config);
|
observer.observe(targetElement, config);
|
||||||
|
|
||||||
|
//------------------------------------------------
|
||||||
|
// Improve the looks of the chat input field
|
||||||
|
//------------------------------------------------
|
||||||
|
document.getElementById('chat-input').parentNode.style.background = 'transparent';
|
||||||
|
document.getElementById('chat-input').parentNode.style.border = 'none';
|
||||||
|
@ -22,7 +22,7 @@ def create_ui():
|
|||||||
|
|
||||||
with gr.Tab('Chat', elem_id='chat-tab'):
|
with gr.Tab('Chat', elem_id='chat-tab'):
|
||||||
shared.gradio['display'] = gr.HTML(value=chat_html_wrapper({'internal': [], 'visible': []}, shared.settings['name1'], shared.settings['name2'], 'chat', 'cai-chat'))
|
shared.gradio['display'] = gr.HTML(value=chat_html_wrapper({'internal': [], 'visible': []}, shared.settings['name1'], shared.settings['name2'], 'chat', 'cai-chat'))
|
||||||
shared.gradio['textbox'] = gr.Textbox(label='Input', elem_id='chat-input')
|
shared.gradio['textbox'] = gr.Textbox(label='', placeholder='Send a message', elem_id='chat-input')
|
||||||
shared.gradio['show_controls'] = gr.Checkbox(value=shared.settings['show_controls'], label='Show controls', elem_id='show-controls')
|
shared.gradio['show_controls'] = gr.Checkbox(value=shared.settings['show_controls'], label='Show controls', elem_id='show-controls')
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
|
Loading…
Reference in New Issue
Block a user