-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat(opencode): add ollama init cli command to generate opencode.json config dynamically #4183
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
tobocop2
wants to merge
10
commits into
anomalyco:dev
Choose a base branch
from
tobocop2:add-ollama-command
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+538
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eae5c72 to
857f6e0
Compare
747523f to
837b42e
Compare
837b42e to
1ab4fd0
Compare
1ab4fd0 to
0b8160a
Compare
f1dc981 to
3e15a39
Compare
f8ee907 to
6a9856d
Compare
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Setting up opencode with ollama requires manually creating a config file and copying model names from
ollama list. Unlike cloud providers that auto-configure throughauth login, local providers like Ollama have no automated setup.This is an alternative to #3726 but it is run conditionally by the user. I don't think opencode should look for ollama unless the user explicitly wants the support. My solution is an implementation of that and it's still configuration file driven. It is also thoroughly tested, cross platform and doesn't rely on an the arbitrary ollama base url and port but rather the ollama executable being found in the
$PATHinstead. I have been using a bash function to generate the opencode.json for me but I figured it would be helpful to others if this was just part of the opencode cli.Run tests via
Solution
Adds
opencode ollama initto automatically generate config from installed models.Key features:
Changes