@jopqior/pi-subagents-model-selector 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/selection-form.ts +4 -8
package/package.json
CHANGED
package/src/selection-form.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
8
8
|
import { modelsAreEqual } from "@earendil-works/pi-ai";
|
|
9
|
+
import { fuzzyFilter } from "@earendil-works/pi-tui";
|
|
9
10
|
import type { SpawnSelection } from "@jopqior/pi-subagents";
|
|
10
11
|
import { getModelSelectorSearchText } from "./model-search-text";
|
|
11
12
|
|
|
@@ -353,14 +354,9 @@ function filterModels(
|
|
|
353
354
|
if (!query) {
|
|
354
355
|
return models;
|
|
355
356
|
}
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
.filter((token) => token.length > 0);
|
|
360
|
-
const filtered = models.filter((model) => {
|
|
361
|
-
const text = modelHaystack(model, input).toLowerCase();
|
|
362
|
-
return tokens.every((token) => text.includes(token.toLowerCase()));
|
|
363
|
-
});
|
|
357
|
+
const filtered = fuzzyFilter([...models], query, (model) =>
|
|
358
|
+
modelHaystack(model, input),
|
|
359
|
+
);
|
|
364
360
|
if (!isDefaultSearch(query)) {
|
|
365
361
|
return filtered;
|
|
366
362
|
}
|