PawanOsman / ChatGPT-Official

ChatGPT Client using official OpenAI API
MIT License
100 stars 22 forks source link

No keys available #10

Open mrahmadt opened 12 months ago

mrahmadt commented 12 months ago

Hello

I'm just using the example code in README, and I keep getting this error, I added the key and I'm 100% sure about it, seems the database is not created/saved and I don't know what to do

    let bot = new ChatGPT(openAIAPIKeys, options);
    let conversationId = "conversation name";
    let response1 = await bot.ask("What is my first name?", conversationId);
    console.log(response1);
/node_modules/chatgpt-official/dist/classes/chatgpt.js:64
            throw new Error("No keys available.");
                  ^

Error: No keys available.
    at ChatGPT.getOpenAIKey (/node_modules/chatgpt-official/src/classes/chatgpt.ts:65:4)
    at ChatGPT.askStream (/node_modules/chatgpt-official/src/classes/chatgpt.ts:150:19)
    at ChatGPT.ask (/node_modules/chatgpt-official/src/classes/chatgpt.ts:146:3)
    at example (/test.ts:53:31)
    at /test.ts:87:5
    at /test.ts:88:1
    at ViteNodeRunner.directRequest (file:///node_modules/vite-node/dist/client.mjs:328:5)
    at ViteNodeRunner.cachedRequest (file:///node_modules/vite-node/dist/client.mjs:186:14)
    at ViteNodeRunner.executeFile (file:///node_modules/vite-node/dist/client.mjs:154:12)
    at CAC.run (file:///node_modules/vite-node/dist/cli.mjs:70:5)

Node.js v19.8.1
seanconrad1 commented 8 months ago

also getting the above error message