aicommits icon indicating copy to clipboard operation
aicommits copied to clipboard

Request timeout after 10 seconds

Open CasperEngl opened this issue 1 year ago • 5 comments

Bug description

After updating to the latest version, the API is timing out for a lot of my commits.

Some of the larger ones used to take maybe 15-20 seconds to complete.

A timeout of 10 seconds was added in v1.3.0 https://github.com/Nutlope/aicommits/blame/v1.3.0/src/utils/openai.ts

Is there a reason this has been added?

aicommits version

1.5.1

Environment

System:
  OS: macOS 12.3
  CPU: (10) arm64 Apple M1 Max
  Memory: 99.98 MB / 32.00 GB
  Shell: 5.8 - /bin/zsh
Binaries:
  Node: 18.14.0 - /usr/local/bin/node
  Yarn: 1.22.19 - /opt/homebrew/bin/yarn
  npm: 9.3.1 - /usr/local/bin/npm

Can you contribute a fix?

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

CasperEngl avatar Mar 15 '23 14:03 CasperEngl

There's no bug here as this is the intended experience.

10s is more than long for something like this, and you'll lose the benefits of this tool if it's taking longer (you could type your own message in that time). It also probably means there's something wrong with OpenAI's API.

Given the timing of this report, you were probably affected by the outage: https://status.openai.com

As an action item, it's probably worth linking to that page when the request times out.

privatenumber avatar Mar 16 '23 02:03 privatenumber

The timing was unfortunate, however, my point still stands.

I found the limit within the dist file and increased it to 100 seconds, and now my commits are running perfectly fine.

15-20 seconds is probably long enough to write the commit message myself, given I know what's happening in that file. This is fine when doing atomic commits, but after working in a flow state for a few hours, I often start committing files as I'm getting more tired. I've completely lost the context at this point, and having the AI tell me what's going on I can just confirm whatever it's telling me is correct.

In the end, isn't it up to me as a user if the AI is taking too long to answer? Why should the client between me and the AI limit the amount of time taken to generate a response, assuming it's still generating my response?

CasperEngl avatar Mar 16 '23 14:03 CasperEngl

The timing was unfortunate, however, my point still stands.

I found the limit within the dist file and increased it to 100 seconds, and now my commits are running perfectly fine.

Where can I find the dist file? I've tried all over.

SamuelMTDavies avatar Mar 16 '23 20:03 SamuelMTDavies

@CasperEngl

I was just answering your question. But it seems you're actually requesting a feature.

If you started with a feature request to add a timeout config property containing milliseconds, that would be reasonable to me—PR welcome.

privatenumber avatar Mar 17 '23 03:03 privatenumber

My bad for adding the wrong label.

CasperEngl avatar Mar 17 '23 07:03 CasperEngl