aicommits icon indicating copy to clipboard operation
aicommits copied to clipboard

aicommits uses first the envVar instead of the env in .aicommits file

Open kud opened this issue 1 year ago • 1 comments

Bug description

Imagine you've already defined an envVar called OPENAI_KEY, it will use it instead of the one defined in .aicommits. It's confusing. I would like to use the one in .aicommits.

aicommits version

1.11.0

Environment

OS: macOS 13.5
Shell: zsh 5.9 (arm-apple-darwin21.3.0)
node: v20.5.1

Can you contribute a fix?

  • [ ] I’m interested in opening a pull request for this issue.

kud avatar Aug 29 '23 15:08 kud

I can add some more information, I kept getting a reponse like this :

{
    "error": {
        "message": "Incorrect API key provided: sk-dEQi4***************************************uraT. You can find your API key at https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": "invalid_api_key"
    }
}

But the key I had in ~/.aicommits wasn't starting with DEQi, it was an entirely different key. After runnning printenv | grep OPEN I found that I had no env var named "OPENAI_KEY" but I had an OPENAI_API_KEY, and this was what was picked up by aicommits instead of the correct OPENAI_KEY

ajoliveau avatar Nov 16 '23 17:11 ajoliveau