diff --git a/src/commands/model-picker.e2e.test.ts b/src/commands/model-picker.e2e.test.ts index 241f477077..375ae994b5 100644 --- a/src/commands/model-picker.e2e.test.ts +++ b/src/commands/model-picker.e2e.test.ts @@ -142,8 +142,10 @@ describe("promptModelAllowlist", () => { await promptModelAllowlist({ config, prompter }); - const options = multiselect.mock.calls[0]?.[0]?.options ?? []; + const call = multiselect.mock.calls[0]?.[0]; + const options = call?.options ?? []; expectRouterModelFiltering(options as Array<{ value: string }>); + expect(call?.searchable).toBe(true); }); it("filters to allowed keys when provided", async () => { diff --git a/src/commands/model-picker.ts b/src/commands/model-picker.ts index 7a9ac18abf..c5ed31339b 100644 --- a/src/commands/model-picker.ts +++ b/src/commands/model-picker.ts @@ -424,6 +424,7 @@ export async function promptModelAllowlist(params: { message: params.message ?? "Models in /model picker (multi-select)", options, initialValues: initialKeys.length > 0 ? initialKeys : undefined, + searchable: true, }); const selected = normalizeModelKeys(selection.map((value) => String(value))); if (selected.length > 0) { diff --git a/src/wizard/clack-prompter.ts b/src/wizard/clack-prompter.ts index 469d80311a..7fe691d11d 100644 --- a/src/wizard/clack-prompter.ts +++ b/src/wizard/clack-prompter.ts @@ -1,4 +1,5 @@ import { + autocompleteMultiselect, cancel, confirm, intro, @@ -47,9 +48,10 @@ export function createClackPrompter(): WizardPrompter { initialValue: params.initialValue, }), ), - multiselect: async (params) => - guardCancel( - await multiselect({ + multiselect: async (params) => { + const prompt = params.searchable ? autocompleteMultiselect : multiselect; + return guardCancel( + await prompt({ message: stylePromptMessage(params.message), options: params.options.map((opt) => { const base = { value: opt.value, label: opt.label }; @@ -57,7 +59,8 @@ export function createClackPrompter(): WizardPrompter { }) as Option<(typeof params.options)[number]["value"]>[], initialValues: params.initialValues, }), - ), + ); + }, text: async (params) => { const validate = params.validate; return guardCancel( diff --git a/src/wizard/prompts.ts b/src/wizard/prompts.ts index 7aa496b76f..9d90a6f23d 100644 --- a/src/wizard/prompts.ts +++ b/src/wizard/prompts.ts @@ -14,6 +14,7 @@ export type WizardMultiSelectParams = { message: string; options: Array>; initialValues?: T[]; + searchable?: boolean; }; export type WizardTextParams = {