feat: standardize model selectors across all providers #10294
+505
−265
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
Replaces various model selection UI patterns with a consistent search-style ModelPicker component across all providers, giving users a unified experience as outlined in
plans/standardize-model-selector.md.Changes
New Files
webview-ui/src/components/settings/utils/providerModelConfig.ts- Helper utilities including:PROVIDER_SERVICE_CONFIG- Maps providers to service names/URLsgetDefaultModelIdForProvider(),getStaticModelsForProvider()shouldUseGenericModelPicker()- Determines which providers use generic ModelPickerwebview-ui/src/components/settings/utils/__tests__/providerModelConfig.spec.ts- 20 unit testsModified Files
ModelPicker.tsx- Added new props:label,valueTransform,displayTransform,onModelChange; added new ModelIdKey types for Ollama, LMStudio, VSCodeLMApiOptions.tsx- Replaced Select-based generic picker with ModelPicker usingshouldUseGenericModelPicker()Ollama.tsx- Replaced VSCodeTextField + VSCodeRadioGroup with ModelPickerLMStudio.tsx- Replaced text + radio with ModelPicker; added second ModelPicker for draft modelVSCodeLM.tsx- Replaced Select with ModelPicker using transform functions for vendor/family objectApiOptions.provider-filtering.spec.tsx- Added Popover/Command component mocksImplementation Details
ModelPickerviashouldUseGenericModelPicker()valueTransform/displayTransformto handle{ vendor, family }object formatgetStaticModelsForProvider()errorMessagepropTest Results
All tests pass (356 test files, 4957 tests passed, 48 skipped).
Important
Standardizes model selection UI with a unified
ModelPickercomponent across all providers, enhancing consistency and user experience.ModelPickercomponent across all providers.shouldUseGenericModelPicker()to determine providers using the generic picker.ApiOptions.tsx.ModelPicker.tsx: Added props for label, value/display transform, and model change callback.ApiOptions.tsx: Replaced Select-based pickers withModelPickerfor static providers.Ollama.tsx,LMStudio.tsx,VSCodeLM.tsx: Replaced existing UI withModelPicker.providerModelConfig.ts: Added utilities for provider service config and model handling.providerModelConfig.spec.tswith 20 unit tests for new utilities.ApiOptions.provider-filtering.spec.tsxto mock new components and utilities.This description was created by
for 9a5e70b. You can customize this summary. It will automatically update as commits are pushed.