Giter Club home page Giter Club logo

Comments (8)

ivorpad avatar ivorpad commented on August 28, 2024 5

@Nutlope The error appears to be insufficient_quota. I had to console.log the json response from const json = yield response.json(); and got this:

{
  json: {
    error: {
      message: 'You exceeded your current quota, please check your plan and billing details.',
      type: 'insufficient_quota',
      param: null,
      code: null
    }
  }
}

But you need to handle this (or any other) error(s).

Stack trace:

/usr/local/lib/node_modules/aicommits/bin/aicommits.js:99
        const aiCommit = json.choices[0].text;
                                     ^

TypeError: Cannot read properties of undefined (reading '0')
    at /usr/local/lib/node_modules/aicommits/bin/aicommits.js:99:38
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/aicommits/bin/aicommits.js:6:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I tried with another OpenAI account where I have billing setup and got a server_error

{
  json: {
    error: {
      message: 'The server had an error while processing your request. Sorry about that!',
      type: 'server_error',
      param: null,
      code: null
    }
  }
}

I tried several times until I got a successful response, so it could be the OpenAI API having issues right now.

from aicommits.

alexduros avatar alexduros commented on August 28, 2024 4

In my case, I had to set up a payment method in my OpenAI account, and regenerate an new API Key. It worked right after.

from aicommits.

Nutlope avatar Nutlope commented on August 28, 2024

Hey @graup, thanks for opening this issue! This error typically happens when you don't have the correct value for the OpenAI env variable. I recommend you do a printenv OPENAI_API_KEY to see what value you have it set to and verify that it matches an API key that's on your OpenAI API dashboard that you linked.

The API key should have no whitespaces and should be in the shape of sk-xxxxxxxxxxxxxxx. Could you verify you have the correct value for the env variable, open a brand new terminal, try it out again, then let me know if the problem is still there?

from aicommits.

graup avatar graup commented on August 28, 2024

Thanks for your reply! I tried that, same problem. If you have no idea, I'll try checking out your repo and digging into the API response.

from aicommits.

Nutlope avatar Nutlope commented on August 28, 2024

@graup I may try to add a debugging flag to the CLI soon that shows detailed console messages so folks can debug in situations like this. In the meantime, mind trying one more thing for me?

I have a feeling it may be extra whitespace so could you do a unset OPENAI_API_KEY to remove the env var, go directly to your .zshrc by going to your root cd ~ then code .zshrc to open it up, and add export OPENAI_API_KEY="sk---" to the .zshrc somewhere.

After all of that, open up a fresh terminal and try it one more time. If it works, then it was whitespace and I should just trim extra whitespace.

from aicommits.

iamshabell avatar iamshabell commented on August 28, 2024

Hi, I understand that you're facing the same issue that I did before. But I was able to fix it by simply restarting my terminal. Sometimes, when the terminal has been running for a while, it can start to experience some glitches or issues with its processes. So, try restarting your terminal and see if that resolves the problem for you too.

from aicommits.

privatenumber avatar privatenumber commented on August 28, 2024

The latest release should log the specific error from OpenAI

from aicommits.

kejianlin avatar kejianlin commented on August 28, 2024

OCO_OPENAI_BASE_PATH=https://api.aikey.one/v1,
Add /v1 after the API.
Source code:

...
createChatCompletion: (createChatCompletionRequest, options = {}) => __awaiter(this, void 0, void 0, function* () {
          const localVarPath = `/chat/completions`;
          const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
        }),
...

from aicommits.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.