Skip to content

Add support for Ollama #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 188 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
84b0eca
Bump version
oleander Jul 17, 2024
af1a7a2
Bump version
oleander Jul 17, 2024
30ffe7f
Add debug logging to hook.rs and commit.rs. Update model.rs to handle…
oleander Jul 17, 2024
3a469ed
Add debug logging to commit.rs.
oleander Jul 17, 2024
f5e51e0
Update model logic in src/model.rs
oleander Jul 17, 2024
5ba9f27
Add whitespace and heuristic settings to hook.rs configuration.
oleander Jul 17, 2024
294e2ce
Add debug logging to hook.rs
oleander Jul 17, 2024
cf09636
Add minimal option to patch repository in hook.rs
oleander Jul 17, 2024
9fa4fc9
Build and deploy prebuilt binaries (#19)
oleander Nov 16, 2024
83180c5
Attach binary to crate (#20)
oleander Nov 16, 2024
e699da5
Update git-ai to version 0.2.14 and modify bump workflow
oleander Nov 16, 2024
5405434
0.2.15
oleander Nov 16, 2024
3780522
Fix tar command path in GitHub Actions workflow
oleander Nov 16, 2024
1cfba83
Bump git-ai version to 0.2.15 and fix workflow commands
oleander Nov 16, 2024
5d09ea8
0.2.16
oleander Nov 16, 2024
5c49c95
Update artifact files in CI for different architectures
oleander Nov 16, 2024
d05f308
Update git-ai version to 0.2.16 and simplify CD workflow paths
oleander Nov 16, 2024
f907e07
0.2.17
oleander Nov 16, 2024
dd51079
Add packaging steps for additional architectures in CD workflow
oleander Nov 16, 2024
0d98211
Bump version to 0.2.17 and fix workflow tar paths
oleander Nov 16, 2024
2e881a5
0.2.18
oleander Nov 16, 2024
5b9c76e
Add compression-level to deploy job config
oleander Nov 16, 2024
7f84bee
Update git-ai version in Cargo.lock to 0.2.18
oleander Nov 16, 2024
be9ce96
0.2.19
oleander Nov 16, 2024
68cf254
Integrate version bump into CD workflow, remove bump.yml
oleander Nov 16, 2024
fec8265
Update git-ai version to 0.2.19 in Cargo.lock
oleander Nov 16, 2024
5dde85b
0.2.20
oleander Nov 16, 2024
33ebd39
Update Cargo.lock and fix GitHub Actions workflow syntax
oleander Nov 16, 2024
5949221
0.2.21
oleander Nov 16, 2024
1febf55
Bump git-ai version to 0.2.21 in Cargo.lock
oleander Nov 16, 2024
f21978a
0.2.22
oleander Nov 16, 2024
423b1eb
Update git-ai version to 0.2.22 in Cargo.lock
oleander Nov 16, 2024
e616d09
0.2.23
oleander Nov 16, 2024
d2ff9ce
Update `git-ai` crate version to 0.2.23 in Cargo.lock
oleander Nov 16, 2024
9a7b2cc
Add git stash to CD workflow for clean state
oleander Nov 16, 2024
a280aa7
Remove duplicate GitHub push command in CD workflow
oleander Nov 16, 2024
4863ca8
Fix git push URL syntax in CD workflow file
oleander Nov 16, 2024
b4daa3a
Remove duplicate git push command
oleander Nov 16, 2024
1a76f6c
0.2.24
oleander Nov 16, 2024
689c9cd
Remove unused tag_name assignment in CD workflow
oleander Nov 16, 2024
b83df70
Bump git-ai to version 0.2.24 in Cargo.lock
oleander Nov 16, 2024
5a858d3
0.2.25
oleander Nov 16, 2024
cdfbe93
Update git-ai version and tag name in workflow
oleander Nov 16, 2024
82a0484
0.2.26
oleander Nov 16, 2024
61b4314
Add `rust-build` action to dependencies and update metadata in `Cargo…
oleander Nov 16, 2024
b663607
oleander Nov 16, 2024
085f90a
chore: update rust-build version and binstall targets
oleander Feb 8, 2025
0fa140b
Remove the `rust-build` dependency from `Cargo.toml`
oleander Nov 16, 2024
9220969
Upgrade `git-ai` to version 0.2.26, update CD workflow.
oleander Nov 16, 2024
cc71b02
Update actions checkout and rust-build versions in cd workflow
oleander Nov 16, 2024
c074c6c
Update build targets and configuration in workflows and Cargo.toml
oleander Nov 16, 2024
9922fa6
Set STATIC_LINKING to false in CD workflow
oleander Nov 16, 2024
a8aebb9
Update version to 0.2.29 and streamline CD workflow
oleander Nov 16, 2024
505f413
Update Cargo.toml with new targets; enhance CI workflow steps
oleander Nov 16, 2024
d1d4472
Fix multiline path syntax in workflow configuration
oleander Nov 16, 2024
637278f
Update TARGET to x86_64 in cd workflow file
oleander Nov 16, 2024
0f03643
Add ACTIONS_RUNTIME_TOKEN to env in cd.yml
oleander Nov 16, 2024
78ff9a8
Add toolchain config to GitHub Actions workflow
oleander Nov 16, 2024
e98392f
Uncomment cache step in CD workflow for build efficiency
oleander Nov 16, 2024
e3fb3bb
Remove unused cache configuration in CD workflow
oleander Nov 16, 2024
9f3aa0e
Fix concurrency config and enable build-std for cargo build
oleander Nov 16, 2024
438402c
Update CD workflow to use 'minimal' profile
oleander Nov 16, 2024
c366b0a
Update build profile from 'dev' to 'minimal' in cd workflow
oleander Nov 16, 2024
2d43859
Remove redundant options from cargo build command
oleander Nov 16, 2024
0e1e361
Update 'runs-on' to 'ubuntu-latest' in cd workflow
oleander Nov 16, 2024
4320a1b
0.2.30
oleander Nov 16, 2024
bf67106
Specify target in cargo publish command
oleander Nov 16, 2024
b331d29
Bump git-ai version to 0.2.30 in Cargo.lock
oleander Nov 16, 2024
c9b17b7
0.2.31
oleander Nov 16, 2024
a9deac7
Update package URL format placeholder in Cargo.toml
oleander Nov 16, 2024
591d374
Update workflow to add macOS target build
oleander Nov 16, 2024
0a4dfab
Bump git-ai version to 0.2.31 in Cargo.lock
oleander Nov 16, 2024
280fda7
0.2.32
oleander Nov 16, 2024
4c7705e
Remove dry-run from cargo publish in CD workflow
oleander Nov 16, 2024
13b7867
Update git-ai crate to version 0.2.32 in Cargo.lock
oleander Nov 16, 2024
47abd02
0.2.33
oleander Nov 16, 2024
5ad39f6
Remove duplicate version bump commit step
oleander Nov 16, 2024
4f45dd2
Bump git-ai version to 0.2.33 and update target platforms
oleander Nov 16, 2024
322c7f1
Simplify CD workflow by consolidating target matrix elements
oleander Nov 16, 2024
3c3e8dc
Update CD workflow to manage git tags during commit amend
oleander Nov 16, 2024
8a75ebe
Simplify Git commit for tag creation in CI workflow
oleander Nov 16, 2024
4172e29
0.2.34
oleander Nov 16, 2024
99515de
Uncomment Ubuntu Linux build target in CD workflow
oleander Nov 16, 2024
5fcf1e2
Refactor CD workflow; move 'release' job below existing jobs
oleander Nov 16, 2024
15da4fe
0.2.35
oleander Nov 16, 2024
ed86a67
Add '--tags' to git push in workflow steps
oleander Nov 16, 2024
c05fb75
Fix indentation in version bump steps
oleander Nov 16, 2024
3497f1b
Update git-ai version to 0.2.40 in Cargo files
oleander Nov 16, 2024
dc9c9f7
Remove duplicate cargo-bump installation step
oleander Nov 16, 2024
2faf881
Bump version to 0.2.42 in Cargo files
oleander Nov 16, 2024
fd17b04
Refactor Git setup in GitHub Actions workflow
oleander Nov 16, 2024
881cbb8
0.2.43
oleander Nov 16, 2024
f28d6b5
Add macOS aarch64 target to CI workflow
oleander Nov 16, 2024
1de5e5a
0.2.44
oleander Nov 16, 2024
3cb9d1e
Add support for x86 64 alpine linux musl (#22)
oleander Jan 25, 2025
b3fc23e
0.2.45
oleander Jan 25, 2025
6147aff
Update CD workflow; remove step and adjust if condition (#23)
oleander Jan 25, 2025
d869a7a
0.2.46
oleander Jan 25, 2025
511aba3
Fix conditional logic for base_ref checks in CD workflow
oleander Jan 25, 2025
cdbb6ec
Better tag matcher
oleander Jan 25, 2025
9857bb1
0.2.47
oleander Jan 25, 2025
ebf817b
Enhance CD workflow with manual trigger option
oleander Jan 25, 2025
b5ec8bf
Remove commented-out publish job in CI config
oleander Jan 25, 2025
8532171
0.2.48
oleander Jan 25, 2025
0dd63b6
Add GH_TOKEN to environment in CD workflow
oleander Jan 25, 2025
87981e5
0.2.49
oleander Jan 25, 2025
1973766
Simplify CD workflow; remove unused steps and tags config
oleander Jan 25, 2025
80100b2
0.2.50
oleander Jan 25, 2025
a55ebae
Simplify CI jobs by removing redundant conditions
oleander Jan 25, 2025
3b05306
Refactor tag management in CD workflow comments
oleander Jan 25, 2025
5a3d934
Update git-ai to v0.2.50; un-comment tagging steps in cd.yml
oleander Jan 25, 2025
6adebc9
Refactor commented-out tag management steps
oleander Jan 25, 2025
7c35afe
Refactor Git config and update cargo publish comment
oleander Jan 25, 2025
0985d3e
Fix syntax error by removing misplaced comment line
oleander Jan 25, 2025
0d021a5
Fix git describe command by removing HEAD argument
oleander Jan 25, 2025
a355581
Add workflow_dispatch and update permissions in CD workflow
oleander Jan 25, 2025
10f3442
Remove redundant commented publish step in cd.yml
oleander Jan 25, 2025
5e40403
0.2.51
oleander Jan 25, 2025
42b07e8
Remove commented-out build targets in cd.yml
oleander Jan 25, 2025
837bd99
Update CD workflow for tag handling and cleanup comments
oleander Jan 25, 2025
ca2e4c6
Update version of 'git-ai' to 0.2.51 in Cargo.lock
oleander Jan 25, 2025
985410d
0.2.52
oleander Jan 25, 2025
2188f9c
Refactor CD workflow; consolidate tag handling logic
oleander Jan 25, 2025
c7dd696
Update git-ai to version 0.2.52 in Cargo.lock
oleander Jan 25, 2025
2faac49
0.2.53
oleander Jan 25, 2025
c698b9d
Uncomment crates.io publish step in CD workflow
oleander Jan 25, 2025
3ee0199
Bump git-ai version to 0.2.53 in Cargo.lock
oleander Jan 25, 2025
cf955f9
0.2.54
oleander Jan 25, 2025
18e020a
Improve AI prompt (#26)
oleander Feb 5, 2025
fd487f4
0.2.57
oleander Feb 5, 2025
a76a860
<think>
Feb 8, 2025
25930af
feat: improve prompt handling with json output support
Feb 8, 2025
6a59185
feat: Add Comprehensive Testing Infrastructure (#31)
oleander Feb 8, 2025
edba3dd
feat: Enhance File System Operations (#33)
oleander Feb 8, 2025
508d053
feat: Update Core Dependencies (#29)
oleander Feb 8, 2025
044baf0
feat: Update Configuration and Core Components (#35)
oleander Feb 8, 2025
be19fde
Improve OpenAI Integration (#34)
oleander Feb 8, 2025
a6edfe3
Update hook.rs to not ignore whitespace changes in PatchRepository im…
oleander Feb 8, 2025
6c6677b
feat: Optimize Hook System Performance (#32)
oleander Feb 8, 2025
cce64c5
Update git-ai version from 0.2.57 to 0.2.60 in Cargo.lock and Cargo.t…
oleander Feb 8, 2025
361053c
Speed up hook diff processing (#27)
oleander Feb 8, 2025
f998d35
Add dirrc
oleander Feb 8, 2025
dd4ce4f
I've added the following line to extract a JSON string from the respo…
oleander Feb 8, 2025
9cf1acb
Add user authentication feature
oleander Feb 8, 2025
f44877c
Configure direnv
oleander Feb 8, 2025
3a50cab
{
oleander Feb 8, 2025
d3a5acc
{
oleander Feb 8, 2025
f6cd096
{
oleander Feb 8, 2025
85492c7
Add new feature to handle user authentication
oleander Feb 8, 2025
845878e
Update client and ollama modules for improved functionality
oleander Feb 8, 2025
713625b
Update model handling and availability
oleander Feb 8, 2025
31fe59d
Add CI workflow for Ollama integration
oleander Feb 8, 2025
0e55cdf
Merge tag 'main' into feature/ollama
oleander Feb 8, 2025
ba22a2f
Merge remote-tracking branch 'origin/main' into feature/ollama
oleander Feb 8, 2025
3e2e5a1
Update GitHub workflow to remove Ollama setup and model pull on push …
oleander Feb 8, 2025
fac5f88
Update comprehensive tests to use latest image versions.
oleander Feb 8, 2025
abeaff7
Update Cargo.toml with new dependencies and add integration tests for…
oleander Feb 8, 2025
3931d5d
Update CI workflow to run integration tests on Linux and refactor hoo…
oleander Feb 8, 2025
ab76308
Update comprehensive tests for AI config and commit handling
oleander Feb 8, 2025
bd1f526
Refactor patch diff printing and add file status information in hook.…
oleander Feb 8, 2025
c7ad72b
Update merge strategy to respect squash commits in comprehensive-test…
oleander Feb 8, 2025
8d81a7b
Add new Ollama integration test and update Diff hook to handle added …
oleander Feb 8, 2025
95de57f
Update CI workflow to install ollama on Linux.
oleander Feb 8, 2025
9f763da
Update GitHub workflow to target Ubuntu instead of Linux.
oleander Feb 8, 2025
bb489a6
Update scripts to use environment variable TEST_MODEL for model selec…
oleander Feb 8, 2025
f2a9f90
Set model in integration tests and update configuration settings.
oleander Feb 8, 2025
04e8a6d
Allow the OpenAI URL to be configurable using an env var
oleander Feb 8, 2025
578e84d
Refactor OpenAI configuration and model handling in client and config…
oleander Feb 9, 2025
808c2ff
Update OpenAI configuration to use API URL instead of deprecated OPEN…
oleander Feb 9, 2025
e3b863c
Configure direnv
oleander Feb 9, 2025
c4054e8
I'm doing great! How can I assist you today?
oleander Feb 9, 2025
06f058a
--no-edit
oleander Feb 9, 2025
df82535
Configure direnv
oleander Feb 9, 2025
8856911
Configure direnv
oleander Feb 9, 2025
9e86699
This is a mock response
oleander Feb 9, 2025
cfb9bc1
This is a mock response
oleander Feb 9, 2025
2f3cb46
This is a mock response
oleander Feb 9, 2025
c409d62
This is a mock response
oleander Feb 9, 2025
3fa03a7
This is a mock response
oleander Feb 9, 2025
397c610
This is a mock response
oleander Feb 9, 2025
cde8f33
This is a mock response
oleander Feb 9, 2025
d477c11
This is a mock response
oleander Feb 9, 2025
dd72fd5
This is a mock response
oleander Feb 9, 2025
98c7b99
This is a mock response
oleander Feb 9, 2025
6e8462d
This is a mock response
oleander Feb 9, 2025
991ba0a
This is a mock response
oleander Feb 9, 2025
68f7720
Fix linting errors
oleander Feb 9, 2025
a96c2ad
Fix linting errors
oleander Feb 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env

This file was deleted.

27 changes: 25 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ concurrency:

env:
CARGO_TERM_COLOR: always
TEST_MODEL: SlyOtis/git-auto-message:latest
OPENAI_API_URL: http://localhost:4010/v1

jobs:
lint:
Expand Down Expand Up @@ -58,6 +60,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Start test services
if: startsWith(matrix.os, 'ubuntu')
uses: hoverkraft-tech/compose-action@v2.2.0
with:
services: prism

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
Expand All @@ -84,10 +92,25 @@ jobs:
if: startsWith(matrix.os, 'macos')
run: brew install fish

- name: Run integration tests
- name: Install ollama
if: startsWith(matrix.os, 'ubuntu')
run: curl -fsSL https://ollama.com/install.sh | sh

- name: Run ollama
if: startsWith(matrix.os, 'ubuntu')
run: |
ollama serve &
ollama pull SlyOtis/git-auto-message:latest

- name: Run comprehensive tests
run: |
./scripts/integration-tests
cargo build --release
cargo test --release
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

- name: Run integration tests (ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: ./scripts/integration-tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ http-cacache/*
.secrets
.env.local
${env:TMPDIR}
bin/
tmp/
finetune_verify.jsonl
finetune_train.jsonl
132 changes: 130 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
description = "Git AI: Automates commit messages using ChatGPT. Stage your files, and Git AI generates the messages."
license = "MIT"
repository = "https://github.com/oleander/git-ai"
readme = "README.md"
keywords = ["git", "ai", "commit", "message", "generator"]
categories = ["development-tools", "command-line-utilities"]

# https://github.com/oleander/git-ai/actions/runs/11872246630/artifacts/2196924470
[package.metadata.binstall]
Expand All @@ -31,7 +34,9 @@ thiserror = "2.0.11"
tokio = { version = "1.43", features = ["full"] }
futures = "0.3"
parking_lot = "0.12.3"
async-trait = "0.1"
tracing = "0.1"
url = "2.5.0"

# CLI and UI

Expand All @@ -53,6 +58,8 @@ serde_ini = "0.2.0"
serde_json = "1.0"

# OpenAI integration

ollama-rs = { version = "0.2.5", features = ["stream"] }
async-openai = { version = "0.27.2", default-features = false }
tiktoken-rs = "0.6.0"
reqwest = { version = "0.12.12", default-features = true }
Expand All @@ -78,6 +85,10 @@ structopt = "0.3.26"
mustache = "0.9.0"
maplit = "1.0.2"

# New dependencies
once_cell = "1.19.0"
xxhash-rust = { version = "0.8.10", features = ["xxh3"] }

[dev-dependencies]
tempfile = "3.16.0"

Expand All @@ -90,3 +101,7 @@ lto = true
[profile.release.package."*"]
codegen-units = 1
opt-level = 3

[features]
default = []
integration_tests = []
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Customize Git AI's behavior with these commands:
- `git-ai config set max-tokens <tokens>` (default: 512): Set the maximum number of tokens for the assistant.
- `git-ai config set model <model>` (default: "gpt-3.5-turbo"): Set the OpenAI model to use.
- `git-ai config set openai-api-key <api-key>`: Set your OpenAI API key.
- `git-ai config set url <url>` (default: "https://api.openai.com/v1"): Set the OpenAI API URL. Useful for using alternative OpenAI-compatible APIs or proxies.

## Contributing

Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
prism:
image: stoplight/prism:latest
platform: linux/amd64
command: ["mock", "-h", "0.0.0.0", "--cors", "/app/openapi-mock.yaml"]
ports:
- "4010:4010"
volumes:
- ./openapi-mock.yaml:/app/openapi-mock.yaml
restart: unless-stopped
stop_grace_period: 1s
develop:
watch:
- action: sync+restart
path: ./openapi-mock.yaml
target: /app/openapi-mock.yaml
Loading
Loading