Use Esc to Stop the generation

This commit is contained in:
oobabooga 2023-08-03 08:13:17 -07:00
parent 3e70bce576
commit 1839dff763
2 changed files with 13 additions and 2 deletions

View file

@ -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();
}
}
});