feat(models): load chat model selector from server - #89
Open
nutshellfool wants to merge 3 commits into
Open
Conversation
…rationTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Open
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.
Summary
Replace the hardcoded
ModelPresets.listchat model selector with the full model list from the configured OpenCode server'sGET /config/providersAPI.AppState.selectedModel: Message.ModelInfo?is now the canonical selection state; the list index is derived for UI only, so server-side list reordering can never silently switch modelsavailableModels+providerModelsIndex) is built once per provider load viabuildModelCataloginstead of computed getters on every recompositionproviderId/modelIdglobally and per session; legacy index-based storage is read-only for migration (resolution order: session saved → message inference → global saved → server default → legacy → first model)configureRepositorychoke point that clears the catalog only when the effective target actually changes, so same-profile foreground health checks keep the loaded catalog; a request-generation guard drops late provider responses from a previous serverbuildSelectedModelvalidates the selection against the current catalog before sending, and omits the model (server default) while providers are loadingNotes
master@ v0.1.20260715: kept session deep links / AI usage quota / hostRuntimeScope intact;selectedAIUsageQuotanow readsselectedModel?.providerId; GPT-5.6 Sol Pro/Fast short labels ported to the dynamicmodelLabellogic;resetRuntimeForHostSwitchalso clears the new catalog fieldsdocs/dynamic-opencode-model-selector-plan.mdTest plan
./gradlew testDebugUnitTest— BUILD SUCCESSFUL after rebase🤖 Generated with Claude Code