kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
Merge pull request #506 from T-Damer/patch-1
commit
0984504154
|
@ -280,8 +280,11 @@ Note that we automatically handle appending the previous messages to the prompt
|
||||||
|
|
||||||
```js
|
```js
|
||||||
async function example() {
|
async function example() {
|
||||||
// To use ESM in CommonJS, you can use a dynamic import
|
// To use ESM in CommonJS, you can use a dynamic import like this:
|
||||||
const { ChatGPTAPI } = await import('chatgpt')
|
const { ChatGPTAPI } = await import('chatgpt')
|
||||||
|
// You can also try dynamic importing like this:
|
||||||
|
// const importDynamic = new Function('modulePath', 'return import(modulePath)')
|
||||||
|
// const { ChatGPTAPI } = await importDynamic('chatgpt')
|
||||||
|
|
||||||
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })
|
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue