appleboy / CodeGPT

A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI (gpt-4o, gpt-4-turbo, gpt-3.5-turbo model) and automatically installs a git prepare-commit-msg hook.
MIT License
1.15k stars 100 forks source link

Support self-hosted Ollama3 Model #161

Closed ysicing closed 1 month ago

ysicing commented 2 months ago

https://github.com/ollama/ollama/blob/main/docs/openai.md

appleboy commented 1 month ago

@ysicing Could you try the following section?

https://github.com/ollama/ollama/blob/main/docs/openai.md#default-model-names

For tooling that relies on default OpenAI model names such as gpt-3.5-turbo, use ollama cp to copy an existing model name to a temporary name:

ollama cp llama3 gpt-3.5-turbo

Afterwards, this new model name can be specified the model field:

curl http://localhost:11434/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "gpt-3.5-turbo",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ]
    }'
appleboy commented 1 month ago

See https://github.com/appleboy/CodeGPT#how-to-change-to-ollama-api-service