Skip to content

Model switch#413

Merged
arkml merged 4 commits intodevfrom
model_switch
Mar 2, 2026
Merged

Model switch#413
arkml merged 4 commits intodevfrom
model_switch

Conversation

@arkml
Copy link
Contributor

@arkml arkml commented Feb 27, 2026

Summary of Changes: Model Selector & Multi-Model Support

  1. packages/shared/src/models.ts (+1 line)

Schema change: Added models: z.array(z.string()).optional() to LlmModelConfig. This allows storing a
list of configured models per provider alongside the single active model field. The field is optional
for backward compatibility.

  1. packages/core/src/models/repo.ts (+22/-5 lines)

Persistence change:

  • setConfig() now saves the models array into the provider entry in the providers map
  • Spreads existing provider fields (...existingProviders[flavor]) before overwriting, so unknown fields
    aren't lost when saving
  1. apps/renderer/src/components/settings-dialog.tsx (+324/-88 lines)

Multi-model support in Settings:

  • State changed from single model: string to models: string[] per provider
  • Added updateModelAt(), addModel(), removeModel() helpers for managing the array
  • UI shows a list of model inputs/selects with an X button (overlay on hover) to remove each, and an +
    Add assistant model button to add more
  • Assistant model and Knowledge graph model displayed as equal-width side-by-side columns
  • "Test & Save" sends the full models array; tests against the first (default) model

Default provider management:

  • Added defaultProvider state, set from disk on load and updated on save
  • Provider cards show a "Default" pill badge on the current default
  • Non-default configured providers show "Set as default" link (calls models:saveConfig with that
    provider's config)
  • "Set as default" link appears alongside a "Remove" link

Provider deletion:

  • "Remove" link on non-default configured provider cards
  • handleDeleteProvider() reads models.json, deletes the provider from the providers map, and if the
    deleted provider was the top-level active one, rewrites the top-level config to point to the current
    default provider
  • Load logic no longer re-hydrates a provider from top-level config if it was deleted from the providers
    map

Cross-component sync:

  • All config-modifying actions (handleTestAndSave, handleSetDefault, handleDeleteProvider) dispatch a
    models-config-changed custom window event
  1. apps/renderer/src/components/chat-input-with-mentions.tsx (+190/-12 lines)

Model selector dropdown in chat input:

  • New imports: ChevronDown icon, DropdownMenu components
  • providerDisplayNames map and ConfiguredModel interface
  • On mount/activation, reads config/models.json and builds a flat list of all configured models across
    all providers (reading models array, falling back to single model)
  • Dropdown uses DropdownMenuRadioGroup showing each model with its provider name

Layout:

  • Two-row layout: textarea on top, toolbar below
  • Toolbar: [+ attach] on left, [Model ▾] and [send] on right (matching the design screenshot)

Default model ordering:

  • Models are sorted so the default provider's default model appears first in the dropdown

Model switching:

  • handleModelChange calls models:saveConfig with the selected model AND preserves the full models array
    for that provider (preventing the array from being wiped)

Live sync with Settings:

  • Listens for models-config-changed window event to reload the model list immediately when settings
    change (add/remove/default)

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rowboat Ready Ready Preview, Comment Feb 27, 2026 6:42pm

Request Review

@arkml arkml merged commit 5a72ee0 into dev Mar 2, 2026
5 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