tak-bro / aicommit2

A Reactive CLI that generates git commit messages with Ollama, ChatGPT, Gemini, Claude, Mistral and other AI
https://www.npmjs.com/package/aicommit2
MIT License
134 stars 10 forks source link

Can't work with DashsSope's OpenAI compatible mode API. #66

Closed zybzzc closed 2 months ago

zybzzc commented 2 months ago

Bug description

There were two principal issues:

  1. The DashScope API URL is https://dashscope.aliyuncs.com/compatible-mode. Simply replacing the OpenAI URL with this can cause the path to be lost. As a temporary fix, update both the base URL and the path:

    url=https://dashscope.aliyuncs.com/
    path=/compatible-mode/v1/chat/completions
  2. The DashsSope's OpenAI compatible mode API is not fully compatible with the OpenAI API; its top_b parameter requires a value within the range (0.0, 1.0), whereas aicommit2 uses 1 as the default value.

aicommit2 version

v2.0.1

Environment

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 91.25 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.local/share/mise/installs/node/20/bin/node
    npm: 10.5.0 - ~/.local/share/mise/installs/node/20/bin/npm
    pnpm: 9.7.0 - ~/.local/share/mise/installs/node/20/bin/pnpm
    bun: 1.1.12 - /opt/homebrew/bin/bun

Can you contribute a fix?

tak-bro commented 2 months ago

@zybzzc Regarding the first issue, the behavior you're observing is intentional. That's the right way to set it up.

For the second issue, I've added the OPENAI.topP option. Please see this.

aicommit2 config set OPENAI.topP=0.1

Please update v2.0.3

zybzzc commented 2 months ago

@tak-bro Thank you! It works fine.