Skip to content

Commit

Permalink
Updated .response.generate() to rely on .getRegenerateButton() + …
Browse files Browse the repository at this point in the history
…added error log
  • Loading branch information
adamlui committed May 9, 2024
1 parent 7b617d3 commit 0546a1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1468,10 +1468,10 @@ const chatgpt = { // eslint-disable-line no-redeclare
getLast: function() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },

regenerate: function() {
for (const formButton of document.querySelectorAll('form button')) {
if (formButton.textContent.toLowerCase().includes('regenerate')) {
formButton.click(); return;
}}},
const regenBtn = chatgpt.getRegenerateButton();
if (regenBtn) regenBtn.click();
else console.error('Regenerate button not found!');
},

stopGenerating: function() {
for (const svg of document.querySelectorAll('form button svg')) {
Expand Down

0 comments on commit 0546a1a

Please sign in to comment.