di-sukharev / opencommit

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

[Bug]: Unsupported config key `OCO_MODEL` error when using `oco` command #314

Closed watagori closed 1 month ago

watagori commented 6 months ago

Opencommit Version

v1.0.2 / latest

Node Version

18.17.0

NPM Version

10.5.0

What OS are you seeing the problem on?

Mac

What happened?

Unsupported config key OCO_MODEL error when using oco command

Description

When trying to use the oco command in my terminal, I encountered an error message stating that the config key OCO_MODEL is unsupported. The error persists even when I try to set the OCO_MODEL to one of the suggested values.

Steps to Reproduce

  1. Open the terminal

  2. Run oco --version

  3. Observe the following error message:

    oco --version
    │
    └ ✖ Unsupported config key OCO_MODEL: gpt-3.5-turbo-16k is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'
  4. Attempt to set the OCO_MODEL using oco config set OCO_MODEL=gpt-4-turbo-preview

    oco config set OCO_MODEL=gpt-4-turbo-preview
    │
    └  ✖ Unsupported config key OCO_MODEL: gpt-3.5-turbo-16k is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'

Environment

Expected Behavior

I expected the oco command to work without any errors, and the OCO_MODEL configuration to be set successfully when using one of the suggested values.

Current Behavior

The oco command consistently throws an error message about the unsupported OCO_MODEL config key, even when attempting to set it to one of the suggested values.

Possible Solution

No response

Steps to Reproduce

No response

Relevant log output

No response

br-programmer commented 6 months ago

Same bug here

br-programmer commented 6 months ago

I was able to solve it by opening the .opencommit file that is usually created in your user root directory. I opened it with VS Code and manually changed the model. Then I saved it, and it worked perfectly for me. The model I used was gpt-3.5-turbo; previously, I had gpt-3.5-turbo-16k.

watagori commented 6 months ago

@br-programmer Thanks! I opened the .opencommit and switched the OCO_MODEL manually and it worked.

watagori commented 6 months ago

Share the environment when it works.

node -v
v18.17.0
npm -v
10.5.0
oco --version
3.0.12
watagori commented 6 months ago

Not sure what caused this and if there is a solution other than manual editing.

di-sukharev commented 6 months ago

lets keep this opened please, this is not an expected behaviour @watagori you experienced this on version v1.0.2?

seanmccabe commented 6 months ago

Experienced the exact same issue. I was unable to execute any command, including getting the version, until the .opencommit file was manually edited.

oco --version
3.0.12
node -v
v20.11.1
npm -v
10.2.4
WMOH-DEV commented 6 months ago

i experienced the same issue once i updated the opencommit to the last version

oco --version
3.0.12
node -v
v20.11.0
npm -v
10.2.4

also tried this command but it doesnt work

oco config set OCO_MODEL=gpt-3.5-turbo
│
└  ✖ Unsupported config key OCO_MODEL: gpt-3.5-turbo-16k is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'

Edited manually and it works

di-sukharev commented 6 months ago

@WMOH-DEV do you know what version you were running before?

di-sukharev commented 6 months ago

@seanmccabe do you know what version you were running before?

WMOH-DEV commented 6 months ago

@WMOH-DEV do you know what version you were running before?

I think 3.0.11

Champkinz commented 6 months ago

Im getting the same error after updating to the latest version.

- oco config set OCO_MODEL=gpt-3.5-turbo
- Unsupported config key OCO_MODEL: gpt-3.5-turbo-16k is not supported yet, use 'gpt-4', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview'
Champkinz commented 6 months ago

I rolled back to v3.0.11 and it works fine.

di-sukharev commented 1 month ago

@Champkinz try 3.0.18 released today, it allows any string for OCO_MODEL — so we dont need to make a PR every time new model is released.

if it doesnt work — do this:

  1. run whereis opencommit (macos, idk for windows, sry)
  2. it should yield smth like /Users/you/.nvm/versions/node/v20.10.0/bin/opencommit
  3. this v20.10.0 has /node_modules
  4. opencommit should be installed there as a global package
  5. delete /opencommit
  6. install again npm run -g opencommit@latest
yasainet commented 1 month ago

Since updating to 3.0.18, I get the following error.

❯ oco --version                                                                                                                                                         
│
└ ✖ Unsupported model gpt-4o-mini. the model can be any string, but the current configuration is not supported.

As you suggest, I removed /opencommit and then installed the latest version.

npm install -g opencommit@latest

Does the following information help you fix it?

❯ cat .opencommit
OCO_OPENAI_API_KEY=***
OCO_ANTHROPIC_API_KEY=undefined
OCO_AZURE_API_KEY=undefined
OCO_GEMINI_API_KEY=undefined
OCO_TOKENS_MAX_INPUT=undefined
OCO_TOKENS_MAX_OUTPUT=undefined
OCO_OPENAI_BASE_PATH=undefined
OCO_GEMINI_BASE_PATH=undefined
OCO_DESCRIPTION=false
OCO_EMOJI=false
OCO_MODEL=gpt-4o-mini
OCO_LANGUAGE=en
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=$msg
OCO_PROMPT_MODULE=conventional-commit
OCO_AI_PROVIDER=openai
OCO_GITPUSH=true
OCO_ONE_LINE_COMMIT=false
OCO_AZURE_ENDPOINT=undefined
OCO_TEST_MOCK_TYPE=commit-message
OCO_FLOWISE_ENDPOINT=:.
OCO_FLOWISE_API_KEY=undefined
OCO_OLLAMA_API_URL=undefined
❯ node -v                         
v20.16.0
❯ npm -v                          
10.8.1

I depend on this app so much that I would not be able to do my daily development without it! Please keep up the good work.

di-sukharev commented 1 month ago

my bad. please update to 3.0.19 i released now.

Champkinz commented 1 month ago

Working as expected 🙌 Thank you for the release @di-sukharev 🚀

yasainet commented 1 month ago

I updated it and it works fine! Thank you 🙇‍♀️