feat: manual model filter for providers and filtered model dropdown#8287
feat: manual model filter for providers and filtered model dropdown#8287FedeCuci wants to merge 2 commits into
Conversation
- Add filter button in provider settings to show only manually-added models - Auto-fetched models hidden when user has pinned models - Model dropdown filters to pinned models when available - Add Model dialog upgrades existing models instead of rejecting duplicates - Backfill migration for existing users with customized models - One-time filter resets on refresh
PR Review: feat: manual model filter for providers and filtered model dropdownSummaryThis PR adds a "manual model filter" feature so that users who have explicitly added or customized models can filter out the auto-fetched catalog, keeping only their curated selection visible. The changes touch 6 files across the model dropdown, add/edit model dialogs, provider settings page, state migration, and tests. Code Quality & Correctness1. Pervasive use of The type Model = {
// ...existing fields...
/** Whether this model was explicitly added or customized by the user. */
manuallyAdded?: boolean
}This would eliminate all 2. Filter button is one-way -- no toggle off (fix needed) In onClick={() => setShowManualOnly((prev) => !prev)}
disabled={false}Or at least provide a separate "show all" button that does not trigger a network request. 3. Duplicated The definition of "manually added" is checked in three separate places with slightly different logic:
The provider settings page has a broader definition than the dropdown. This means a model with 4. Migration backfill uses The migration marks any model with a 5. The guard 6. Toast message not internationalized (improve needed) In 7. In const displayedChatModels = useMemo(
() => (showManualOnly ? chatModels.filter(isManuallyAdded) : chatModels),
[chatModels, showManualOnly]
)
Risks & Regressions
Missing Tests
Recommendation: fix neededThe feature concept is solid and the PR description is thorough, but the following should be addressed before merging:
|
Review feedback addressed1.
|
There was a problem hiding this comment.
Follow-up review (new commits detected since last review)
The second commit (982408b — "fix: address manual model filter PR review feedback") addresses all six concerns from our previous review:
Previously raised issues — now resolved
-
Model type definition:
manuallyAdded?: booleanand_userConfiguredCapabilities?: booleanare now declared inmodelProviders.d.ts, eliminating the need foras anycasts. -
Filter button toggle: The filter button now properly toggles via
setShowManualOnly((prev) => !prev)instead of being one-way/disabled. Refresh still resets the filter, which is sensible behavior. -
Unified
isManuallyAddedlogic: A singleisManuallyAddedutility in@/lib/models.tsis now shared by bothDropdownModelProvider.tsxand$providerName.tsx. The function checks only persisted flags (manuallyAdded === true || imported === true), keeping the heuristic-based logic confined to the one-time v17-to-v18 migration. This is a clean separation. -
Internationalized toast:
AddModel.tsxnow usest('providers:addModel.modelPinned')with the corresponding key added toproviders.json. -
Test coverage: Three new test files/suites were added:
DropdownModelProvider.manualFilter.test.tsx— 4 test cases covering pinned-model filtering, imported models, no-pinned-models fallback, and catalogdisplayNamefalse-positive avoidance.useModelProvider.test.ts— migration backfill test (v17 to v18) covering curated, renamed, echo-name, plain, already-flagged, and imported scenarios.models.test.ts— 5 test cases for theisManuallyAddedpredicate.
-
Migration heuristic tightened: The backfill now explicitly skips models where
displayName === nameordisplayName === id, preventing false positives from catalogs that echo the model identifier as the display name.
Remaining observations (non-blocking)
-
useMemoandisManuallyAddedreference:isManuallyAddedis imported as a module-level function (not defined inside the component), so it is a stable reference. TheuseMemodependency arrays in$providerName.tsxare correct as-is. -
Chat dropdown UX: When a provider has any pinned model, all non-pinned models are hidden from the chat dropdown with no in-dropdown indication. This is by design per the PR description ("Auto-fetched models stay in the background and are always one click away via the refresh button"), but it may surprise users who pin one model and see others vanish. Consider adding a brief indicator or count (e.g., "+47 more models") in a future iteration — not a blocker for this PR.
-
Empty-state UX in settings: The empty state when the manual filter is active and no models match is well-handled with a clear message and guidance to use the "Add Model" button or toggle the filter off.
Recommendation: can merge
Follow-up Review — All Prior Feedback AddressedReviewing commit: Point-by-Point Resolution
Code Quality
Minor Observations (Not Blocking)
Recommendation: can mergeAll six blocking issues from the previous review have been addressed correctly and thoroughly. The feature is ready to land. |
|
would be cool to have this! |
Describe Your Changes
Some providers like OpenRouter and Together.ai supply hundreds of models, which makes scrolling through them tedious, especially after you've already picked the few you actually want to use. This PR lets you pin your own selection so that only your chosen models appear in the model dropdown and provider settings list. Auto-fetched models stay in the background and are always one click away via the refresh button. More specifically:
$providerName.tsx)DropdownModelProvider.tsx)AddModel.tsx)EditModel.tsx)manuallyAddedflag for existing users with customized models (useModelProvider.ts)$providerName.test.tsx)Fixes Issues
N/A — quality of life improvement, no linked issue.
Self Checklist