Zhengqbbb / cz-git

cz-git | czg 🛠️ DX first and more engineered, lightweight, customizable, standard output format Commitizen adapter and CLI
https://cz-git.qbb.sh
MIT License
1.05k stars 39 forks source link

[Feature Request] Ollama integration #156

Open mtompkins opened 7 months ago

mtompkins commented 7 months ago

💭 Describe the feature

In addition to OpenAI and its associated cost it would be great if we might be able to use Ollama

💡 Proposed Solution

Extend the AI integration to use Ollama which allows running various LLM models locally without a fee.

gandli commented 6 months ago

最近,ollama 已实现对 OpenAI 的兼容性。czg 支持 Ollama 一个可行办法是利用 ‘ollama cp’ 命令,将现有模型名复制到一个临时名。在命令行中具体执行像下面这样的命令:

ollama cp gemma gpt-3.5-turbo

接下来,修改 .czrc 文件内容,仿如下所示:

{
  "openAIToken": " ",
  "apiEndpoint": "http://localhost:11434/v1"
}
Zhengqbbb commented 5 months ago

最近,ollama 已实现对 OpenAI 的兼容性。czg 支持 Ollama 一个可行办法是利用 ‘ollama cp’ 命令,将现有模型名复制到一个临时名。在命令行中具体执行像下面这样的命令:

感谢! 我会在最近开始这方面的开发 🫠


# ollama cp
ollama pull gemma
ollama ls
ollama cp <target-module> gpt-3.5-turbo
ollama ls # check cp success

CleanShot 2024-06-03 at 20 30 31@2x

It is recommended to use commands for configuration here. The loading path of AI configuration is different from that of other configurations.

npx czg --api-key=" " --api-endpoint="http://localhost:11434/v1"
terranc commented 1 month ago

But every first request fails