di-sukharev / opencommit

Generate conventional git commit messages with AI in 1 second 🤯🔫
https://www.npmjs.com/package/opencommit
MIT License
6.15k stars 328 forks source link

[Bug]: cannot set OCO_OPENAI_API_KEY with length different from 51 characters #287

Open bureyburey opened 10 months ago

bureyburey commented 10 months ago

Opencommit Version

3.0.4

Node Version

16.18.0

NPM Version

8.9.2

What OS are you seeing the problem on?

Mac

What happened?

A bug happened!

I am unable to set an OpenAI API key with length different than 51 characters due to the validation that checks it. I am using a key which is 65 characters long.

Expected Behavior

Allow setting OpenAI API key with length different from 51 characters.

Current Behavior

The validation prevents setting/using OpenAI API key with length different from 51 characters.

image

Possible Solution

I've tested it by manually changing the validation rule to accept key that is equal or longer than 51 characters and the OpenAI API did not reject it.

Steps to Reproduce

No response

Relevant log output

No response

github-actions[bot] commented 9 months ago

Stale issue message

di-sukharev commented 8 months ago

reopening, will take a look at this

alberhander commented 6 months ago

Experiencing the same issue here, not sure if my OpenAI api key is not valid for a specific reason, I have a free account at the moment:

$ oco config set OCO_OPENAI_API_KEY="sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
┌  opencommit — config
│
└  ✖ Unsupported config key OCO_OPENAI_API_KEY: Must be 51 characters long

If there's a workaround for this, I'd be happy to apply it