mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-26 01:30:20 +01:00
Ctrl+S to show/hide chat controls
This commit is contained in:
parent
a965a36803
commit
b2296dcda0
@ -329,7 +329,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% - 130px);
|
left: calc(100% - 180px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat > .messages {
|
.chat > .messages {
|
||||||
|
15
js/main.js
15
js/main.js
@ -40,9 +40,11 @@ for(i = 0; i < textareaElements.length; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
// Stop generation on Esc pressed
|
// Keyboard shortcuts
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
document.addEventListener("keydown", function(event) {
|
document.addEventListener("keydown", function(event) {
|
||||||
|
|
||||||
|
// Stop generation on Esc pressed
|
||||||
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
|
||||||
var stopButton = document.getElementById("stop");
|
var stopButton = document.getElementById("stop");
|
||||||
@ -50,6 +52,17 @@ document.addEventListener("keydown", function(event) {
|
|||||||
stopButton.click();
|
stopButton.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show chat controls on Ctrl+S pressed
|
||||||
|
else if (event.ctrlKey && event.key == "s") {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
var showControlsElement = document.getElementById('show-controls');
|
||||||
|
if (showControlsElement && showControlsElement.childNodes.length >= 4) {
|
||||||
|
showControlsElement.childNodes[3].click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
|
@ -23,7 +23,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='', placeholder='Send a message', 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 (Ctrl+S)', elem_id='show-controls')
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
shared.gradio['Stop'] = gr.Button('Stop', elem_id='stop')
|
shared.gradio['Stop'] = gr.Button('Stop', elem_id='stop')
|
||||||
|
Loading…
Reference in New Issue
Block a user