Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
chore(ui): drop dead model manager exports and the unused picker search path
joshistoastfc5b03a3ac73
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex e672a2fa9c..393006b818 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -932,7 +932,6 @@"huggingFaceRejectedToken": "HuggingFace rejected this token. Check that it has read access.","huggingFaceToken": "HuggingFace token","install": "Install",- "installAll": "Install all","installAllCount": "Install all ({{count}})","installAllQueued": "Installs queued","installAllQueuedDescription_one": "{{count}} install queued.",diff --git a/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts b/invokeai/frontend/webv2/src/features/models/core/baseIdentity.tsindex 37124339d6..fc30aecb62 100644--- a/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts+++ b/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts@@ -140,8 +140,6 @@ export const getModelBaseLongLabel = (base: ModelBase): string => {export const getModelBaseColorPalette = (base: ModelBase): ModelBaseColorPalette => getModelBaseInfo(base).colorPalette;-export const isKnownModelBase = (base: ModelBase): base is KnownModelBase => base in MODEL_BASES;-export const isConvertibleToDiffusers = (model: Pick<ModelConfig, 'base' | 'format' | 'type'>): boolean =>model.format === 'checkpoint' &&model.type === 'main' &&diff --git a/invokeai/frontend/webv2/src/features/models/core/library.test.ts b/invokeai/frontend/webv2/src/features/models/core/library.test.tsindex 76bf5ef24a..6548b759c6 100644--- a/invokeai/frontend/webv2/src/features/models/core/library.test.ts+++ b/invokeai/frontend/webv2/src/features/models/core/library.test.ts@@ -95,17 +95,15 @@ describe('groupModelsByType', () => {});describe('getModelPickerGroups', () => {- it('filters by allowed type, exclusions, custom predicate, and multi-term search', () => {+ it('filters by allowed type, exclusions, and custom predicate', () => {const result = getModelPickerGroups(library, {excludeKeys: new Set(['b']),filter: (model) => model.base !== 'any',modelTypes: ['main', 'lora', 'vae'],- searchTerm: 'sd detail',});expect(result.candidates.map((m) => m.key)).toEqual(['a', 'c']);- expect(result.groups.map((group) => group.base)).toEqual(['sd-1']);- expect(result.groups[0]?.models.map((m) => m.key)).toEqual(['c']);+ expect(result.groups.map((group) => group.base)).toEqual(['sd-1', 'sdxl']);});// Type is not a grouping axis: a cross-type picker would otherwise repeat a@@ -113,7 +111,6 @@ describe('getModelPickerGroups', () => {it('groups by base alone, in base display order', () => {const result = getModelPickerGroups(library, {modelTypes: ['main', 'lora', 'vae'],- searchTerm: '',});expect(result.groups.map((group) => [group.key, group.models.map((m) => m.key)])).toEqual([@@ -129,7 +126,7 @@ describe('getModelPickerGroups', () => {createModel({ base: 'sdxl', key: 'lora-1', name: 'Alpha LoRA', type: 'lora' }),createModel({ base: 'sdxl', key: 'main-1', name: 'Zulu Main', type: 'main' }),];- const result = getModelPickerGroups(mixed, { modelTypes: ['main', 'lora'], searchTerm: '' });+ const result = getModelPickerGroups(mixed, { modelTypes: ['main', 'lora'] });expect(result.groups).toHaveLength(1);expect(result.groups[0]?.models.map((m) => m.key)).toEqual(['main-1', 'lora-1']);@@ -143,7 +140,6 @@ describe('getModelPickerGroups', () => {const result = getModelPickerGroups(related, {modelTypes: ['lora'],relatedKeys: new Set(['zzz']),- searchTerm: '',});expect(result.groups[0]?.models.map((m) => m.key)).toEqual(['zzz', 'aaa']);@@ -153,7 +149,6 @@ describe('getModelPickerGroups', () => {const onlySdxl = getModelPickerGroups(library, {baseFilter: new Set(['sdxl']),modelTypes: ['main', 'lora', 'vae'],- searchTerm: '',});expect(onlySdxl.groups.flatMap((group) => group.models.map((m) => m.key))).toEqual(['a']);@@ -161,26 +156,21 @@ describe('getModelPickerGroups', () => {const all = getModelPickerGroups(library, {baseFilter: new Set(),modelTypes: ['main', 'lora', 'vae'],- searchTerm: '',});// Base display order, matching `availableBases`: sd-1, sdxl, flux, any.expect(all.groups.flatMap((group) => group.models.map((m) => m.key))).toEqual(['c', 'a', 'b', 'd']);});- it('exposes availableBases that stay stable across search and base filtering', () => {+ it('exposes availableBases that stay stable across base filtering', () => {const expected = ['sd-1', 'sdxl', 'flux', 'any'];- const base = getModelPickerGroups(library, { modelTypes: ['main', 'lora', 'vae'], searchTerm: '' });+ const base = getModelPickerGroups(library, { modelTypes: ['main', 'lora', 'vae'] });expect(base.availableBases).toEqual(expected);- const searched = getModelPickerGroups(library, { modelTypes: ['main', 'lora', 'vae'], searchTerm: 'flux' });- expect(searched.availableBases).toEqual(expected);-const filtered = getModelPickerGroups(library, {baseFilter: new Set(['flux']),modelTypes: ['main', 'lora', 'vae'],- searchTerm: '',});expect(filtered.availableBases).toEqual(expected);});@@ -190,7 +180,6 @@ describe('getModelPickerGroups', () => {excludeKeys: new Set(['b']),filter: (model) => model.base !== 'any',modelTypes: ['main', 'lora', 'vae'],- searchTerm: '',});expect(result.availableBases).toEqual(['sd-1', 'sdxl']);diff --git a/invokeai/frontend/webv2/src/features/models/core/library.ts b/invokeai/frontend/webv2/src/features/models/core/library.tsindex d71828be2b..36895324c0 100644--- a/invokeai/frontend/webv2/src/features/models/core/library.ts+++ b/invokeai/frontend/webv2/src/features/models/core/library.ts@@ -47,7 +47,6 @@ export interface ModelPickerOptions {modelTypes: readonly ModelTaxonomyType[];/** Models linked to the current selection, floated to the top of their group. */relatedKeys?: ReadonlySet<string>;- searchTerm: string;}/**@@ -64,7 +63,7 @@ export interface ModelPickerGroup {export interface ModelPickerResult {/** Distinct bases among candidates (pre-search, pre-base-filter), for chips. */availableBases: string[];- /** Models available before text search, used for empty-state copy. */+ /** Models available before the base filter (text search is the Picker's own concern), used for empty-state copy. */candidates: ModelConfig[];groups: ModelPickerGroup[];}@@ -135,19 +134,7 @@ export const groupModelsByType = (models: ModelConfig[]): ModelGroup[] => {.map(([type, groupModels]) => ({ label: getModelTypePluralLabel(type), models: groupModels, type }));};-const matchesPickerSearch = (model: ModelConfig, searchTerm: string): boolean => {- const terms = searchTerm.trim().toLowerCase().split(/\s+/).filter(Boolean);-- if (terms.length === 0) {- return true;- }-- const haystack = `${model.name} ${model.base} ${model.type}`.toLowerCase();-- return terms.every((term) => haystack.includes(term));-};--/** Candidate, search, sort, and grouping rules shared by every model picker instance. */+/** Candidate, sort, and grouping rules shared by every model picker instance. */export const getModelPickerGroups = (models: ModelConfig[], options: ModelPickerOptions): ModelPickerResult => {const allowedTypes = new Set(options.modelTypes);const candidates = models.filter(@@ -156,19 +143,15 @@ export const getModelPickerGroups = (models: ModelConfig[], options: ModelPicker!options.excludeKeys?.has(model.key) &&(options.filter ? options.filter(model) : true));- // Chips are derived from candidates — before text search and the base filter —- // so the chip row stays stable while the user types or toggles chips.+ // Chips are derived from candidates — before the base filter — so the chip+ // row stays stable while the user toggles chips.const availableBases = collectBasesForDisplay(candidates);const { baseFilter } = options;const { relatedKeys } = options;// Bases order the groups; within a group, related models lead, then category// rank keeps main models above LoRAs in a cross-type picker, then name.const visibleModels = candidates- .filter(- (model) =>- matchesPickerSearch(model, options.searchTerm) &&- (!baseFilter || baseFilter.size === 0 || baseFilter.has(String(model.base)))- )+ .filter((model) => !baseFilter || baseFilter.size === 0 || baseFilter.has(String(model.base))).sort((a, b) =>getBaseDisplayRank(String(a.base)) - getBaseDisplayRank(String(b.base)) ||diff --git a/invokeai/frontend/webv2/src/features/models/data/modelsStore.ts b/invokeai/frontend/webv2/src/features/models/data/modelsStore.tsindex fe9842b8cd..6544f81c9d 100644--- a/invokeai/frontend/webv2/src/features/models/data/modelsStore.ts+++ b/invokeai/frontend/webv2/src/features/models/data/modelsStore.ts@@ -149,5 +149,3 @@ export const setModelsSnapshotForTests = (next: Partial<ModelsSnapshot>): void =};export const useModelsSelector = store.useSelector;--export const useModelsSnapshot = (): ModelsSnapshot => store.useSnapshot();diff --git a/invokeai/frontend/webv2/src/features/models/index.ts b/invokeai/frontend/webv2/src/features/models/index.tsindex 4699d02aa9..b95ca469ad 100644--- a/invokeai/frontend/webv2/src/features/models/index.ts+++ b/invokeai/frontend/webv2/src/features/models/index.ts@@ -13,7 +13,6 @@ export {refreshModels,subscribeModels,useModelsSelector,- useModelsSnapshot,type ModelsSnapshot,} from './data/modelsStore';export {diff --git a/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx b/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsxindex 01fd211a33..338ee36d17 100644--- a/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx@@ -149,7 +149,6 @@ export const ModelSelect = ({filter,modelTypes,relatedKeys,- searchTerm: '',}): { availableBases: [], candidates: [], groups: [] },[excludeKeys, filter, isOpen, modelTypes, models, relatedKeys, selectedBases]diff --git a/invokeai/frontend/webv2/src/features/models/ui/shared/ModelFilterMenu.tsx b/invokeai/frontend/webv2/src/features/models/ui/shared/ModelFilterMenu.tsxindex 73e294f18c..b5b26bd6c7 100644--- a/invokeai/frontend/webv2/src/features/models/ui/shared/ModelFilterMenu.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/shared/ModelFilterMenu.tsx@@ -44,7 +44,6 @@ export const ModelFilterMenu = <Field extends ModelSortField>({sortField,sortFields,typeAllChecked,- typeAllLabel,typeFilter,}: {ariaLabel: string;@@ -60,11 +59,9 @@ export const ModelFilterMenu = <Field extends ModelSortField>({sortField: Field;sortFields: readonly ModelFilterSortOption<Field>[];typeAllChecked?: boolean;- typeAllLabel?: string;typeFilter: ModelTaxonomyType | null;}) => {const { t } = useTranslation();- const resolvedTypeAllLabel = typeAllLabel ?? t('models.allModels');// Safe to widen: the menu only reports fields drawn from `sortFields`.const reportSort = onSortChange as (field: ModelSortField, direction: 'asc' | 'desc') => void;@@ -84,7 +81,7 @@ export const ModelFilterMenu = <Field extends ModelSortField>({</Menu.ItemGroupLabel><AllTypesFilterMenuItemisChecked={typeAllChecked ?? typeFilter === null}- label={resolvedTypeAllLabel}+ label={t('models.allModels')}onTypeFilterChange={onTypeFilterChange}/>{extraTypeItems}diff --git a/invokeai/frontend/webv2/src/features/models/ui/shared/ResultsListHeader.tsx b/invokeai/frontend/webv2/src/features/models/ui/shared/ResultsListHeader.tsxindex 474669bbaf..ee96297c65 100644--- a/invokeai/frontend/webv2/src/features/models/ui/shared/ResultsListHeader.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/shared/ResultsListHeader.tsx@@ -25,7 +25,7 @@ export const ResultsListHeader = ({}: {extra?: ReactNode;installAllDisabled: boolean;- installAllLabel?: string;+ installAllLabel: string;onClear: () => void;onInstallAll: () => void;onSearchChange: (value: string) => void;@@ -34,7 +34,6 @@ export const ResultsListHeader = ({summary: ReactNode;}) => {const { t } = useTranslation();- const resolvedInstallAllLabel = installAllLabel ?? t('models.installAll');const resolvedSearchPlaceholder = searchPlaceholder ?? t('models.filterResults');const handleSearchChange = useCallback((event: ChangeEvent<HTMLInputElement>) => onSearchChange(event.currentTarget.value),@@ -66,7 +65,7 @@ export const ResultsListHeader = ({</InputGroup><Button disabled={installAllDisabled} flexShrink={0} size="xs" variant="outline" onClick={onInstallAll}><Icon as={DownloadIcon} boxSize="3" />- {resolvedInstallAllLabel}+ {installAllLabel}</Button></HStack></Stack>diff --git a/invokeai/frontend/webv2/src/features/models/ui/uiStore.ts b/invokeai/frontend/webv2/src/features/models/ui/uiStore.tsindex 28628348a8..bc9651f528 100644--- a/invokeai/frontend/webv2/src/features/models/ui/uiStore.ts+++ b/invokeai/frontend/webv2/src/features/models/ui/uiStore.ts@@ -142,9 +142,6 @@ export const setPickerCompactView = (pickerId: string, isCompact: boolean): voidupdateModelsUi({ pickerCompactViews: { ...snapshot.pickerCompactViews, [pickerId]: isCompact } });};-export const getPickerCompactView = (pickerId: string): boolean =>- store.getSnapshot().pickerCompactViews[pickerId] ?? false;-export const getModelsUiSnapshotForTests = (): ModelsUiSnapshot => store.getSnapshot();export const useModelsUiSelector = store.useSelector;