send() isn't working anymore
madkarmaa opened this issue · comments
I tried using both chatgpt.send()
and creating my own logic, but none of them worked. it was working before, but the ChatGPT website got a UI update in which somehow it won't send the message automatically anymore (you have to manually modify the text first)
my own logic:
const sendButton = document.querySelector('form button[class*="bottom"]');
const chatInput = document.querySelector("form textarea");
if (chatInput) chatInput.value = "some text";
if (sendButton) {
sendButton.removeAttribute("disabled");
sendButton.click();
}
@madkarmaa thank you for reporting this, it is fixed! Can you replace your import w/
https://cdn.jsdelivr.net/gh/chatgptjs/chatgpt.js@f8b2faf2b52d72459dac9bb29281630b6471d66d/dist/chatgpt-1.7.4.min.js
(or if you're using https://code.chatgptjs.org/chatgpt-latest.min.js
it should work now)
@madkarmaa sure, I added an input
dispatch to trigger OpenAI's new event listener to remove disabled
attribute from send button, then a timer function waits for the removal before sending (within ms)
@madkarmaa could I check out the project you made?
@adamlui nice, I think there could be an addition to the send()
method. you could add a parameter to the function where you can choose between using the keyboard event or clicking the send button.
the project I'm creating is the following: https://github.com/madkarmaa/automatic-chatgpt-dan
but in the currently published version I'm not using your library. if you want to see the pre-release version I'm working on (with your library), here it is: https://dl.dropboxusercontent.com/s/rb9xz1icekshfev/test.user.js
nice, I think there could be an addition to the send() method. you could add a parameter to the function where you can choose between using the keyboard event or clicking the send button
@madkarmaa What are some situations where one would be preferred over the other?
the project I'm creating is the following: https://github.com/madkarmaa/automatic-chatgpt-dan
but in the currently published version I'm not using your library
Looks cool, what's a DAN prompt and its relation to jailbreaking? (Incidentally, my next script was going to remove moderation)
if you want to see the pre-release version I'm working on (with your library), here it is: https://dl.dropboxusercontent.com/s/rb9xz1icekshfev/test.user.js
When you finish, I'd like to add it to the showcase projects section of docs/website (if you want)
What are some situations where one would be preferred over the other?
mobile devices maybe? I'm unsure keyboard events work the same way they do on PCs
When you finish, I'd like to add it to the showcase projects section of docs/website (if you want)
sure why not, I'm also adding attributions to your library in the README.md file of my project
@madkarmaa Good point, I added an optional 2nd arg for method: 'click' clicks, while any other value uses the keyboard event
The new jsDelivr url is: https://cdn.jsdelivr.net/gh/chatgptjs/chatgpt.js@821a4afaedc308160425b0ec91454af0d3af996e/dist/chatgpt-1.7.5.min.js
@madkarmaa what's a short sentence to describe the script?
@madkarmaa it's added, check it out