feat(app): add abbreviation matching to model selector search - #39355
Open
DevDengChao wants to merge 1 commit into
Open
feat(app): add abbreviation matching to model selector search#39355DevDengChao wants to merge 1 commit into
DevDengChao wants to merge 1 commit into
Conversation
Supports word-prefix and word-initial abbreviation matching in the model selector search. Users can now type shorthand like 'deepff' to find 'Deepseek V4 Flash Free' or 'deepp' for 'Deepseek V4 Pro'. The matching algorithm walks through model name words trying each possible prefix length, allowing queries to mix full word prefixes and single-letter initials with skipped words in between. Closes anomalyco#39346
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #39346
Type of change
What does this PR do?
The model selector search only supported exact substring matching and compact (no-separator) matching. When the model list contains similar names like Deepseek V4 Flash Free, Deepseek V4 Flash, and Deepseek V4 Pro, users had to type the full name or enough unique characters to disambiguate.
This adds abbreviation matching as a fallback: the query is walked against model name words, where each segment of the query can be a prefix of a word or just the word's initial letter. Skipped words are allowed.
Examples:
deepff→ Deepseek V4 Flash Free (deep→Deepseek + f→Flash + f→Free)deepp→ Deepseek V4 Pro (deep→Deepseek + p→Pro)dvff→ Deepseek V4 Flash Free (d→Deepseek + v→V4 + f→Flash + f→Free)The algorithm is a recursive walk: for each word, try matching 1 to N characters as a prefix of that word, then recurse on the remaining query and next word. Words can also be skipped. This is tried after existing spaced-normalized and compact substring matching, so all current search behavior is preserved.
How did you verify your code works?
bun test dialog-select-model-search— all 5 tests pass (2 new abbreviation tests added)bun typecheck— passesScreenshots / recordings
This is not a UI change.
Checklist