on main help sign in
fix: keep original order when filtering models (#2416)
c9efb20Andrey Nering
internal/ui/dialog/models_list.go+3−1
@@ -216,8 +216,10 @@ func (f *ModelsList) VisibleItems() []list.Item {
216 }
216 }
217
217
218 matches := fuzzy.Find(query, names)
218 matches := fuzzy.Find(query, names)
219+
220+ // Sort by original index to preserve order within the group
219 sort.SliceStable(matches, func(i, j int) bool {
221 sort.SliceStable(matches, func(i, j int) bool {
220− return matches[i].Score > matches[j].Score
222+ return matches[i].Index < matches[j].Index
221 })
223 })
222
224
223 for _, match := range matches {
225 for _, match := range matches {