Skip to content

Commit a60a59b

Browse files
committed
Add support for local Ollama models (#39) - resolves #37
Resolves issue #37 - Added dual provider support with a new `diffCommit.provider` configuration option - Implemented Ollama integration with model selection and server configuration - Added new commands for Ollama setup and model switching: - `DiffCommit: Configure Ollama Model` - `DiffCommit: Change Ollama Model` - Added new configuration settings: - `diffCommit.ollamaHostname` for server connection - `diffCommit.ollamaModel` for model selection - Updated documentation with Ollama requirements and setup instructions - Enhanced error handling for Ollama-specific scenarios - Updated workflow documentation to include provider selection
1 parent 7528a09 commit a60a59b

17 files changed

+1988
-133
lines changed

README.md

Lines changed: 118 additions & 28 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "diff-commit",
33
"displayName": "Diff Commit",
44
"version": "0.3.9",
5-
"description": "Generate detailed Git commit messages following the conventional commit specification using Anthropic's AI models like Claude 4 Sonnet.",
5+
"description": "Generate detailed Git commit messages following the conventional commit specification using AI models. Choose between Anthropic's cloud-based models like Claude 4 Sonnet or local Ollama models for offline usage.",
66
"categories": [
77
"AI",
88
"SCM Providers"
@@ -15,6 +15,9 @@
1515
"Anthropic",
1616
"Claude Sonnet",
1717
"Sonnet",
18+
"Ollama",
19+
"Local AI",
20+
"Offline AI",
1821
"Diff Commit",
1922
"tpsTech",
2023
"tsdevau"
@@ -55,11 +58,34 @@
5558
"command": "diffCommit.deleteAPIKey",
5659
"title": "DiffCommit: Delete stored API Key",
5760
"icon": "$(trash)"
61+
},
62+
{
63+
"command": "diffCommit.configureOllamaModel",
64+
"title": "DiffCommit: Configure Ollama Model",
65+
"icon": "$(server-environment)"
66+
},
67+
{
68+
"command": "diffCommit.changeOllamaModel",
69+
"title": "DiffCommit: Change Ollama Model",
70+
"icon": "$(settings-gear)"
5871
}
5972
],
6073
"configuration": {
6174
"title": "Diff Commit",
6275
"properties": {
76+
"diffCommit.provider": {
77+
"type": "string",
78+
"default": "anthropic",
79+
"enum": [
80+
"anthropic",
81+
"ollama"
82+
],
83+
"enumDescriptions": [
84+
"Use Anthropic's Claude models (requires API key)",
85+
"Use local Ollama models (requires Ollama server to be running)"
86+
],
87+
"description": "Choose the AI provider for generating commit messages."
88+
},
6389
"diffCommit.model": {
6490
"type": "string",
6591
"default": "claude-sonnet-4-0",
@@ -71,7 +97,17 @@
7197
"claude-opus-4-0",
7298
"claude-3-opus-latest"
7399
],
74-
"description": "The Anthropic AI model to use for generating commit messages."
100+
"description": "The Anthropic AI model to use for generating commit messages. This value is only used when provider is set as 'anthropic'."
101+
},
102+
"diffCommit.ollamaHostname": {
103+
"type": "string",
104+
"default": "http://localhost:11434",
105+
"description": "The URL of the local Ollama server (eg http://localhost:11434). This value is only used when provider is set as 'ollama'."
106+
},
107+
"diffCommit.ollamaModel": {
108+
"type": "string",
109+
"default": "",
110+
"description": "The Ollama model to use for generating commit messages. Use the 'Configure Ollama Model' command to configure this. This value is only used when provider is set as 'ollama'."
75111
},
76112
"diffCommit.maxTokens": {
77113
"type": "number",
@@ -98,15 +134,15 @@
98134
"type": "string"
99135
},
100136
"default": [
137+
"chore",
138+
"ci",
139+
"docs",
101140
"feat",
102141
"fix",
142+
"perf",
103143
"refactor",
104-
"chore",
105-
"docs",
106144
"style",
107-
"test",
108-
"perf",
109-
"ci"
145+
"test"
110146
],
111147
"description": "List of allowed commit types. If provided, this replaces the default options. So you need to ensure all required commit types are included in the list."
112148
}
@@ -141,7 +177,8 @@
141177
}
142178
},
143179
"dependencies": {
144-
"@anthropic-ai/sdk": "^0.39.0"
180+
"@anthropic-ai/sdk": "^0.39.0",
181+
"ollama": "^0.5.16"
145182
},
146183
"devDependencies": {
147184
"@types/jest": "^29.5.14",

0 commit comments

Comments
 (0)