Skip to content

Commit

Permalink
Added chatgpt.getChatBox() for textArea init in chatgpt.send()
Browse files Browse the repository at this point in the history
…for easier maintenance
  • Loading branch information
adamlui committed Aug 29, 2024
1 parent 866b408 commit 714c135
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
send(msg, method='') {
for (let i = 0; i < arguments.length; i++) if (typeof arguments[i] !== 'string')
return console.error(`Argument ${ i + 1 } must be a string!`);
const textArea = document.querySelector('form textarea');
const textArea = chatgpt.getChatBox();
if (!textArea) return console.error('Chatbar element not found!');
textArea.value = msg;
textArea.dispatchEvent(new Event('input', { bubbles: true })); // enable send button
Expand Down
2 changes: 1 addition & 1 deletion starters/chrome/extension/lib/chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
send(msg, method='') {
for (let i = 0; i < arguments.length; i++) if (typeof arguments[i] !== 'string')
return console.error(`Argument ${ i + 1 } must be a string!`);
const textArea = document.querySelector('form textarea');
const textArea = chatgpt.getChatBox();
if (!textArea) return console.error('Chatbar element not found!');
textArea.value = msg;
textArea.dispatchEvent(new Event('input', { bubbles: true })); // enable send button
Expand Down

0 comments on commit 714c135

Please sign in to comment.