Skip to content

fix(byok): decouple chat model picker from config.models#642

Merged
Gagancreates merged 2 commits into
devfrom
fix/byok-decouple-chat-models
Jun 24, 2026
Merged

fix(byok): decouple chat model picker from config.models#642
Gagancreates merged 2 commits into
devfrom
fix/byok-decouple-chat-models

Conversation

@Gagancreates

Copy link
Copy Markdown
Collaborator

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.models served double duty for BYOK (signed-out):

  1. It seeded the in-chat model picker (chat-input-with-mentions.tsx).
  2. It was rendered as a per-entry dropdown stack in Settings.

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

  • Onboarding (use-onboarding-state.ts): seed config.models with just the selected default model, not the whole catalog.
  • Chat picker (chat-input-with-mentions.tsx): signed-out branch now lists the full live provider catalog via 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 (settings-dialog.tsx): ASSISTANT MODEL collapses to a single default-model dropdown (removed the .map() stack + add/remove). Underlying models: string[] data model is unchanged, so save/load/delete logic is untouched; config.models is now effectively [defaultModel].

Migration

Configs written by the old code keep a bloated models array. Opening Settings → Models and saving collapses it to the single selected model. The chat picker ignores config.models entirely now, so old configs already behave correctly there.

Test plan

  • Fresh BYOK onboarding (Anthropic key)
  • Settings → Models: ASSISTANT MODEL is a single dropdown (no stack / no "Add assistant model")
  • Chat model picker: lists the full provider catalog, default model first, switchable
  • Signed-in path unchanged (still uses the gateway list)

Checks

  • tsc --noEmit clean across the renderer
  • npm run lint: only pre-existing errors (none in the changed files)

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.
@Gagancreates Gagancreates merged commit 8b76c54 into dev Jun 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant