|
@@ -37,11 +37,9 @@ export function DialogModel(props: { providerID?: string }) {
|
|
|
const recents = local.model.recent()
|
|
const recents = local.model.recent()
|
|
|
|
|
|
|
|
const recentList = showExtra()
|
|
const recentList = showExtra()
|
|
|
- ? recents
|
|
|
|
|
- .filter(
|
|
|
|
|
- (item) => !favorites.some((fav) => fav.providerID === item.providerID && fav.modelID === item.modelID),
|
|
|
|
|
- )
|
|
|
|
|
- .slice(0, 5)
|
|
|
|
|
|
|
+ ? recents.filter(
|
|
|
|
|
+ (item) => !favorites.some((fav) => fav.providerID === item.providerID && fav.modelID === item.modelID),
|
|
|
|
|
+ )
|
|
|
: []
|
|
: []
|
|
|
|
|
|
|
|
const favoriteOptions = favorites.flatMap((item) => {
|
|
const favoriteOptions = favorites.flatMap((item) => {
|
|
@@ -182,7 +180,10 @@ export function DialogModel(props: { providerID?: string }) {
|
|
|
// Apply fuzzy filtering to each section separately, maintaining section order
|
|
// Apply fuzzy filtering to each section separately, maintaining section order
|
|
|
if (q) {
|
|
if (q) {
|
|
|
const filteredFavorites = fuzzysort.go(q, favoriteOptions, { keys: ["title"] }).map((x) => x.obj)
|
|
const filteredFavorites = fuzzysort.go(q, favoriteOptions, { keys: ["title"] }).map((x) => x.obj)
|
|
|
- const filteredRecents = fuzzysort.go(q, recentOptions, { keys: ["title"] }).map((x) => x.obj)
|
|
|
|
|
|
|
+ const filteredRecents = fuzzysort
|
|
|
|
|
+ .go(q, recentOptions, { keys: ["title"] })
|
|
|
|
|
+ .map((x) => x.obj)
|
|
|
|
|
+ .slice(0, 5)
|
|
|
const filteredProviders = fuzzysort.go(q, providerOptions, { keys: ["title", "category"] }).map((x) => x.obj)
|
|
const filteredProviders = fuzzysort.go(q, providerOptions, { keys: ["title", "category"] }).map((x) => x.obj)
|
|
|
const filteredPopular = fuzzysort.go(q, popularProviders, { keys: ["title"] }).map((x) => x.obj)
|
|
const filteredPopular = fuzzysort.go(q, popularProviders, { keys: ["title"] }).map((x) => x.obj)
|
|
|
return [...filteredFavorites, ...filteredRecents, ...filteredProviders, ...filteredPopular]
|
|
return [...filteredFavorites, ...filteredRecents, ...filteredProviders, ...filteredPopular]
|