Skip to content

Instantly share code, notes, and snippets.

@nahakiole
Created December 4, 2023 16:33
Show Gist options
  • Save nahakiole/6094062a75210268137ae1dc6e29316e to your computer and use it in GitHub Desktop.
Save nahakiole/6094062a75210268137ae1dc6e29316e to your computer and use it in GitHub Desktop.
Interrupt OpenAI ChatGPT
// function that presses aria-label="Stop generating" when pressing escape key
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
let stopGeneratingButton = document.querySelector('[aria-label="Stop generating"]');
if (stopGeneratingButton) {
// trigger click event
stopGeneratingButton.click();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment