opencommit: [Bug]: Error: Request failed with status code 400

Opencommit Version

2.0.12

Node Version

14.21.2

NPM Version

9.6.6

What OS are you seeing the problem on?

No response

What happened?

A bug happened!When i try to generate a commit i hve this error Error: Request failed with status code 404 i tried with gpt-3.5-turbo and gpt-4

Expected Behavior

Generate a commit message

Current Behavior

Not gerating commit and trow an error oc

image

Possible Solution

No response

Steps to Reproduce

config openai api key

Relevant log output

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I suggest adjusting the MAX_TOKEN configuration to a lower value. In my case, I found that setting it to 1100 worked well. When the value was lower than that, I encountered 429 status, and when it was higher, I encountered 400 status. It seems there might be a logic issue related to the token limit, which is determined by the line

const MAX_REQ_TOKENS = 3000 - INIT_MESSAGES_PROMPT_LENGTH

Any solution / permanent fix yet? It is so annoying that 400 error and throws me out of my focus and workflow each time.

What about option for using GPT 3.5-16k token model? This one can easy handle larger tokens without using the way more expensive GPT 4.0 model. It’s only slighter more expensive but more convenient that it can handle larger tokens. I tried this but it raised an error that the config can not handle this model. It seems locked on either GPT3.5 or 4, nothing else?

Getting a 400 too.

And this:

│
◐  Generating the commit message   
│
└  ✖ {"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"You are to act as the author of a commit message in git. Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain WHAT were the changes and WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message.\nDo not preface the commit with anything.\nDon't add any descriptions to the commit, only commit message.\nUse the present tense. Lines must not be longer than 74 characters. Use english to answer."},{"role":"user","content":"diff --git a/src/server.ts b/src/server.ts\nindex ad4db42..f3b18a9 100644\n--- a/src/server.ts\n+++ b/src/server.ts\n@@ -10,7 +10,7 @@\nimport {\n  initWinstonLogger();\n  \n  const app = express();\n -const port = 7799;\n +const PORT = 7799;\n  \n  app.use(express.json());\n  \n@@ -34,6 +34,6 @@\napp.use((_, res, next) => {\n  // ROUTES\n  app.use(PROTECTED_ROUTER_URL, protectedRouter);\n  \n -app.listen(port, () => {\n -  console.log(`Server listening on port ${port}`);\n +app.listen(process.