Closed cuongdnv2307 closed 4 months ago
same issue, chatgpt@5.2.5 on chrome
workaround:
const api = new ChatGPTAPI({
apiKey,
// workaround for https://github.com/transitive-bullshit/chatgpt-api/issues/592
fetch: self.fetch.bind(self),
})
solution for macOS
const api = new ChatGPTAPI({
apiKey,
fetch: window.fetch.bind(window),
})
same issue on Chrome version 122.0.6261.112 macOS (arm64)
workaround:
const api = new ChatGPTAPI({ apiKey, // workaround for https://github.com/transitive-bullshit/chatgpt-api/issues/592 fetch: self.fetch.bind(self), })
I did solve the fetch problem in the above way, but there were new problems.
chatgpt.js?v=4d2c40ad:386 Uncaught (in promise) ReferenceError: Buffer is not defined
at Object.stringify [as serialize] (chatgpt.js?v=4d2c40ad:386:16)
at chatgpt.js?v=4d2c40ad:589:28
at async ChatGPTAPI._defaultUpsertMessage (chatgpt.js?v=4d2c40ad:2158:5)
at async Promise.all (:5173/index 0)
await in (匿名)(异步)
This project is undergoing a major revamp; closing out old issues as part of the prep process.
The chatgpt
package is pretty outdated at this point. I recommend that you use the openai package or the openai-fetch package instead.
Verify latest release
chatgpt
releaseVerify webapp is working
Environment details
Node version : v18.16.1 Windows 11
Describe the Bug
I got the below error
Uncaught (in promise) TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation at ChatGPTAPI.fetchCallImpl (main.js?attr=NWlR-sncM9PvO9IsjgmYJYLNIizg-ac57kqKv5nTKmfgLQ2njijxl0idxUoSQhvA:2923:25) at window.fetch [as _fetch] (main.js?attr=NWlR-sncM9PvO9IsjgmYJYLNIizg-ac57kqKv5nTKmfgLQ2njijxl0idxUoSQhvA:2925:55) at Promise.then.promptTokens (chatgpt-api.ts:251:1) at new Promise ()
at ChatGPTAPI.sendMessage (chatgpt-api.ts:182:1)
at async example (App.js:12:1)