KudoAI / chatgpt.js

🤖 A powerful, open source client-side JavaScript library for ChatGPT
https://chatgpt.js.org
MIT License
1.86k stars 122 forks source link

ChatGPT Teams broke the script #173

Open gadelkareem opened 7 months ago

gadelkareem commented 7 months ago

Looks like the script is not working with the new ChatGPT Teams subscriptions. Getting Uncaught (in promise) 🤖 chatgpt.js >> No chat with id = xxxxx-xxxx-xxx found.

adamlui commented 7 months ago

hey @gadelkareem was it a false alarm?

adamlui commented 7 months ago

@gadelkareem also I don't have or know what a Teams subscription is to investigate :(

gadelkareem commented 7 months ago

First error was my code but indeed they changed something. The URL look like this https://chat.openai.com/g/mygptname/c/xxxxx-xxxx-xxx

No worries, I will update here if I get anywhere.

gadelkareem commented 7 months ago

@adamlui The chatgpt.getResponseFromAPI('last') method is timing out. Using chatgpt.getResponseFromDOM('last') worked as expected. I believe the issue is that most functions attempt to fetch data from the API before falling back to the DOM.

adamlui commented 4 months ago

hey @gadelkareem I don't know how to get to GPTs to see the URL structure you pasted, but you can probably easily fix it by editing the regex @ https://github.com/KudoAI/chatgpt.js/blob/v2.6.9/chatgpt.js#L745C1-L745C64

            const re_chatID = /\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/;

...by using | after \w{12} and inserting the pattern that matches the ID structure you pasted

adamlui commented 4 months ago

@gadelkareem if it's exactly what you pasted, can you update that line to

            const re_chatID = /\w{8}-\w{4}-\w{4}-\w{4}-\w{12}|\w{5}-\w{4}-\w{3}/;

...and see if it works?