Use Esc to Stop the generation
This commit is contained in:
parent
3e70bce576
commit
1839dff763
2 changed files with 13 additions and 2 deletions
11
css/main.js
11
css/main.js
|
@ -24,3 +24,14 @@ for(i = 0; i < textareaElements.length; i++) {
|
|||
textareaElements[i].classList.add('pretty_scrollbar');
|
||||
textareaElements[i].style.resize = "none";
|
||||
}
|
||||
|
||||
// Stop generation on Esc pressed
|
||||
document.addEventListener("keydown", function(event) {
|
||||
if (event.key === "Escape") {
|
||||
// Find the element with id 'stop' and click it
|
||||
var stopButton = document.getElementById("stop");
|
||||
if (stopButton) {
|
||||
stopButton.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue