fix(byok): decouple chat model picker from config.models#642
Merged
Conversation
testAndSaveActiveProvider persisted the provider's full fetched catalog into config.models. That field is the user's curated assistant-model list (rendered as one row per entry in Settings > Models), so every available model showed up as a separate assistant-model dropdown. Seed it with just the selected model; users add more from Settings.
BYOK config.models was doing double duty: it both seeded the in-chat model picker AND was rendered as a per-entry dropdown stack in Settings. That coupling forced a tradeoff between a clean Settings UI and full model choice in chat, and baked a stale catalog snapshot into config. Decouple them so BYOK matches the signed-in experience: - Chat picker (signed-out) now lists the full live provider catalog from models:list, filtered to providers the user has a key/baseURL for, with the saved default model leading. No longer limited to config.models, so newly released models appear without re-saving. - Settings assistant model collapses to a single default-model dropdown (removed the .map() stack + add/remove). config.models is now just the one default; save/load/delete logic is unchanged.
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.
Problem
After BYOK onboarding, Settings → Models showed a stack of separate assistant-model dropdowns — one per model in the provider catalog — and an "Add assistant model" button. Root cause:
config.modelsserved double duty for BYOK (signed-out):chat-input-with-mentions.tsx).Onboarding persisted the provider's entire fetched catalog into
config.models, so every model became a Settings row. Trimming it to one model would've fixed Settings but removed multi-model choice in chat — the coupling forced a bad tradeoff, and also baked a stale catalog snapshot into config.Fix — decouple the two, so BYOK matches the signed-in experience
use-onboarding-state.ts): seedconfig.modelswith just the selected default model, not the whole catalog.chat-input-with-mentions.tsx): signed-out branch now lists the full live provider catalog viamodels:list, filtered to providers the user has a key/baseURL for, with the saved default model leading. No longer limited toconfig.models, so newly released models appear without re-saving.settings-dialog.tsx): ASSISTANT MODEL collapses to a single default-model dropdown (removed the.map()stack + add/remove). Underlyingmodels: string[]data model is unchanged, so save/load/delete logic is untouched;config.modelsis now effectively[defaultModel].Migration
Configs written by the old code keep a bloated
modelsarray. Opening Settings → Models and saving collapses it to the single selected model. The chat picker ignoresconfig.modelsentirely now, so old configs already behave correctly there.Test plan
Checks
tsc --noEmitclean across the renderernpm run lint: only pre-existing errors (none in the changed files)