isscope/.env.example
vee1e 14169225c3
feat: add local LLM provider (Ollama / LMStudio) support
Adds the ability to run AI analysis against a local model served by
Ollama or LMStudio (or any OpenAI-compatible local server), in addition
to the existing OpenRouter cloud provider.

How it works:
- New 'Local (Ollama / LMStudio)' option in the API configuration panel
  alongside the existing OpenRouter key field.
- User can override the local endpoint (default http://localhost:11434/v1
  — Ollama's default; LMStudio users set http://localhost:1234/v1),
  the model name (default 'llama3.2'), and an optional API key (LMStudio
  defaults to 'lm-studio' when auth is enabled).
- The selected provider, endpoint, model and local API key are persisted
  in localStorage alongside the existing GitHub / OpenRouter key
  remember-me flow.
- Concurrent requests are throttled to 2 for the local provider (vs 15
  for OpenRouter) to avoid overloading a local GPU.

Architecture:
- New 'src/lib/api/local.ts' client that hits an OpenAI-compatible
  /v1/chat/completions endpoint. Drops 'response_format: json_object'
  because not every local backend supports it; the prompt and the
  existing parseAnalysisResponse fallback already handle JSON
  extraction and partial recovery.
- New 'src/lib/api/provider.ts' module that exposes the
  analyzeIssue / analyzeAllIssues surface and dispatches to either
  openrouter or local based on the store's aiProvider value.
- openrouter.ts is now a thin client with explicit (apiKey, model,
  baseUrl) parameters — no implicit store reads.
- useIssueAnalysis now imports from ./api/provider and logs the active
  provider + endpoint/model instead of just the model name.

Other:
- New VITE_LOCAL_ENDPOINT / VITE_LOCAL_MODEL env vars (documented in
  .env.example) used to override the build-time defaults.
- New AIProvider / LocalProviderConfig types in src/lib/types.ts.
- 19 new unit tests covering the local client and the provider
  dispatch (170/170 pass).
2026-06-29 17:54:33 +05:30

8 lines
312 B
Text

VITE_GITHUB_TOKEN=
VITE_OPENROUTER_API_KEY=
VITE_MODEL_NAME=
# Optional overrides for the Local (Ollama / LMStudio) provider.
# When using the Local provider, set these in the UI — these build-time
# defaults are only used if the user has not configured anything in-app.
VITE_LOCAL_ENDPOINT=
VITE_LOCAL_MODEL=