feat(ai): add cloud providers and local model selection

Add OpenAI-compatible, Anthropic, and custom endpoint support while
keeping the local model path intact. The UI now lets users choose the
provider and local model, and staged diffs are prepared more carefully
so generated commit messages stay focused and usable.

- src-tauri/crates/commit_ai/*
  - Add HTTP-based generators for OpenAI, Anthropic, and custom APIs.
  - Introduce shared request/response handling and message sanitizing.
  - Expand prompt building to require a body and trim long diffs safely.
  - Expose selectable local model metadata and loading by model ID.
- src-tauri/src/git.rs
  - Add commands for listing local models and loading them in background.
  - Route generation by provider and include staged file lists in prompts.
  - Exclude noisy lockfiles from detailed staged diffs.
- src-tauri/src/main.rs
  - Wire the new AI commands into the Tauri app setup.
- src/lib/components/*
  - Add an AI settings dialog and update the commit panel for provider
    and model selection.
- src/lib/git.ts, src/lib/types.ts, src/App.svelte, src/app.css
  - Extend frontend state, types, and styling for AI provider settings.
- src-tauri/Cargo.lock, src-tauri/crates/commit_ai/Cargo.toml
  - Add reqwest and serde_json for cloud API requests.
This commit is contained in:
Christoph Brandau
2026-07-02 21:19:16 +02:00
parent d415cbd3a1
commit 6b7186d040
13 changed files with 924 additions and 80 deletions
+2
View File
@@ -1028,7 +1028,9 @@ name = "commit_ai"
version = "0.1.0"
dependencies = [
"mistralrs",
"reqwest 0.12.28",
"serde",
"serde_json",
"tokio",
]