fix: select newly added model after saving in settings#594
Conversation
When a user adds a custom model (e.g. deepseek-chat) in settings, the global store's resolveLLMSelection may leave modelId empty if the provider has no credentials yet. This causes the landing page to show "Set up model" even after the API key is configured. Changes: - Add setModel hook import in SettingsDialog - After handleSaveModel writes models to the store, explicitly call setModel to select the newly added/edited model - This keeps the intent unambiguous regardless of credential state Impact: 1 file, components/settings/index.tsx (+2 lines)
|
Thanks @tongshu2023. Closing this. The reported #542 symptom (the "Please select a model" toast + forced settings reopen) was already fixed by #581 on 2026-05-18. Verified on main: after adding a custom DeepSeek model + API key, Enter Classroom is enabled and navigates to /generation-preview cleanly. The remaining behavior this PR addresses (picker not auto-switching to the newly-added model) is a deliberate UX choice on our side, not a bug. Adding a model is a configuration action; choosing which model to use is a separate explicit picker action. Auto-switching would also introduce a regression in the common case where another provider is still active and usable, and the user is just adding a model to a side provider for later. Sorry for the round-trip and thanks for the careful root-cause writeup. #542 is already closed. |
Summary
Fixes #542 — After configuring a new provider (e.g. DeepSeek) and adding a model, the landing page still shows "Set up model" and prevents entering the classroom.
Root Cause
When a user adds a custom model in settings via
handleSaveModel, thesetProviderConfigaction callsresolveLLMSelection. If the provider has models but no API key yet, it's classified as State A (not usable), leaving bothproviderIdandmodelIdempty. Subsequent API key configuration correctly resolves the provider but selects the first built-in model instead of the user's custom model. This can cause confusion and a perceived broken state.Changes
1 file:
components/settings/index.tsx(+2 lines of logic, +5 lines of comment)setModelhook import in SettingsDialoghandleSaveModel, after writing models to the store, explicitly callsetModel(providerId, modelId)to select the newly added/edited modelTest Plan
deepseek-chat) WITHOUT entering API key first