aicommit2 icon indicating copy to clipboard operation
aicommit2 copied to clipboard

✘ [DeepSeek] Request failed with status code 400

Open hsu1943 opened this issue 1 year ago • 3 comments
trafficstars

Bug description

I have been using the DeepSeek API, and it works fine most of the time. However, when I attempt to modify a large number of files at once, sometimes I encounter an error message: ✘ [DeepSeek] Request failed with status code 400. According to the documentation error code: https://platform.deepseek.com/api-docs/zh-cn/quick_start/error_codes

This error is due to a format error in the request body. The logging=true configuration has been enabled, but no logs have been generated, and it is unclear what exactly is wrong with the request format.

aicommit2 config get DEEPSEEK:

DEEPSEEK {
  key: 'sk-***',
  model: 'deepseek-coder',
  topP: 0.9,
  systemPrompt: '',
  systemPromptPath: 'C:\\Users\\myname\\.aicommit2.conf\\prompt.txt',
  codeReviewPromptPath: '',
  timeout: 10000,
  temperature: 1,
  maxTokens: 10000,
  logging: true,
  locale: 'zh',
  generate: 1,
  type: 'conventional',
  maxLength: 50,
  includeBody: true,
  codeReview: false
}

aicommit2 version

2.1.2

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz
    Memory: 1.54 GB / 15.73 GB
Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.9.0 - C:\Program Files\nodejs\pnpm.CMD

Can you contribute a fix?

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

hsu1943 avatar Sep 29 '24 09:09 hsu1943

When the API response doesn't come through properly, no log is generated. I'll look into the issue you raised.

tak-bro avatar Oct 02 '24 06:10 tak-bro

When the API response doesn't come through properly, no log is generated. I'll look into the issue you raised.

Thank you for your response. The latest situation is that even if I only modify one line of code and directly use the aicommit2 command, I will encounter the error message ✘ [DeepSeek] Request failed with status code 400. To better troubleshoot the issue, is there anything I can do? For example, can I manually modify some code to get the request body content of the API request?

hsu1943 avatar Oct 11 '24 02:10 hsu1943

@hsu1943 I've changed the method for requesting the Deepseek API. Could you try it out? Please use version 2.1.5. And please reduce your maxTokens to 4096. The maximum value for maxTokens in Deepseek is 4096.

tak-bro avatar Oct 11 '24 06:10 tak-bro

@tak-bro Thank you for your excellent work and timely feedback. After upgrading to version 2.1.5 and setting maxTokens to 4096, it works fine. For another scenario: the commit after modifying a large number of files at once, I will keep an eye on it, but I haven't had the chance yet.

hsu1943 avatar Oct 16 '24 02:10 hsu1943