Add Ollama provider for local model support#217
Open
tusharadi25 wants to merge 1 commit into
Open
Conversation
Introduce an opt-in Ollama provider so AI features can run against locally hosted models. The provider is enabled by setting OLLAMA_BASE_URL; available models are discovered automatically via the native /api/tags endpoint and served through an OpenAI-compatible client. Includes docs, env example, and unit tests.
|
@tusharadi25 is attempting to deploy a commit to the Frank Chen's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
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.
Summary
OLLAMA_BASE_URL. OptionalOLLAMA_API_KEYsupports deployments where Ollama sits behind an auth proxy.GET /api/tagsendpoint and surfaced as system-backed models; chat/completions go through an OpenAI-compatible client (/v1).http://localhost:11434) or the OpenAI-compatible base (.../v1); discovery failures degrade gracefully (empty list, never throws) so the rest of the model catalog keeps loading.createModel..env.exampleentry, and README/docs mentions.Changes
src/lib/ai/llm/ollama-models.ts— host normalization, config detection,/api/tagsdiscovery, model normalization.src/lib/ai/llm/llm-provider-factory.ts— registerOllamaprovider (OpenAI-compatible), system key gated onOLLAMA_BASE_URL, skip catalog verification.src/lib/ai/llm/provider-ids.ts— addPROVIDER_OLLAMA.src/app/api/ai/models/available/route.ts— append discovered Ollama models to system models (fetched in parallel with GitHub models).src/components/settings/models/models-edit.tsx— provider link for Ollama.public/provider-logos/ollama.svg,.env.example,README.md,docs/index.md.Test plan
npm run test— unit tests for Ollama discovery/normalization (ollama-models.test.ts), provider registration and dynamic model resolution (llm-provider-factory.test.ts), and the available-models route (route.test.ts).npm run build/npm run typecheck— verify build and types.OLLAMA_BASE_URL=http://localhost:11434and a pulled model, confirm the model appears in settings and chat works; with the env unset, confirm Ollama does not appear.