feat(settings): choose the model provider in the app, not the environment - #35
Merged
Merged
Conversation
…ment Provider and model are picked in a new /settings page and stored in the `config` table, replacing localStorage and the env-derived defaults. Nothing is inferred: with no provider stored the app is unconfigured and says so instead of guessing. API keys stay in the environment — settings names the variable each provider needs and never reads it. The rows are deliberately absent from the agent's config catalog, so `set_config` cannot reach them and Cameron cannot change its own model. Adds `openai-compatible` for any OpenAI chat-completions endpoint (Ollama, vLLM, Groq, OpenRouter, DeepSeek); its base URL is a setting. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Provider and model are now chosen in a new /settings page and stored in the
configtable. This replaces localStorage and the env-derived defaults, which is why configuringOPENAI_COMPATIBLE_*previously left the UI still showing Anthropic — the client's hardcoded pair always won.Nothing is inferred. With no provider stored the app is unconfigured: the composer is replaced by a notice linking to Settings, and threads stay readable. A bad key surfaces as a failed message, not a pre-flight check.
Keys stay in the environment. Settings names the variable each provider needs and never reads, stores, or displays it.
GET /api/agent/configreturns no secrets.The agent can't change its own model. The rows are deliberately absent from
src/lib/config/catalog.ts, the allowlist gatingset_config, so they're invisible and unwritable to Cameron.Also adds
openai-compatiblefor any OpenAI chat-completions endpoint (Ollama, vLLM, Groq, OpenRouter, DeepSeek). Its base URL is a setting;apiKeyis always passed explicitly soOPENAI_API_KEYcan never leak to a third-party host.Verified
pnpm test(266),tsc --noEmit,typecheck:eval,next build,format:checkall pass.End-to-end against the dev stack: unconfigured → clean SSE error naming the fix; each validation path returns a field-specific 400; save round-trips and persists; a real message works with no query params;
set_configstill rejects the model keys.Notes
eval/edits are stale-reference fixes: a comment pointing at the oldutil.ts, and atsconfiginclude that meanttypecheck:evalwasn't coveringmodels.ts.approvalGate.test.tsscanned the deletedUISettingsContext; it now scans the settings UI that replaced it. Same invariant.🤖 Generated with Claude Code