diff --git a/invokeai/frontend/web/src/features/system/components/ModelSelect.tsx b/invokeai/frontend/web/src/features/system/components/ModelSelect.tsx index 520e30b60a..be4be8ceaa 100644 --- a/invokeai/frontend/web/src/features/system/components/ModelSelect.tsx +++ b/invokeai/frontend/web/src/features/system/components/ModelSelect.tsx @@ -4,19 +4,33 @@ import { isEqual } from 'lodash-es'; import { useTranslation } from 'react-i18next'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; -import { selectModelsById, selectModelsIds } from '../store/modelSlice'; +import { + selectModelsAll, + selectModelsById, + selectModelsIds, +} from '../store/modelSlice'; import { RootState } from 'app/store/store'; import { modelSelected } from 'features/parameters/store/generationSlice'; import { generationSelector } from 'features/parameters/store/generationSelectors'; -import IAICustomSelect from 'common/components/IAICustomSelect'; +import IAICustomSelect, { + ItemTooltips, +} from 'common/components/IAICustomSelect'; const selector = createSelector( [(state: RootState) => state, generationSelector], (state, generation) => { const selectedModel = selectModelsById(state, generation.model); const allModelNames = selectModelsIds(state).map((id) => String(id)); + const allModelTooltips = selectModelsAll(state).reduce( + (allModelTooltips, model) => { + allModelTooltips[model.name] = model.description ?? ''; + return allModelTooltips; + }, + {} as ItemTooltips + ); return { allModelNames, + allModelTooltips, selectedModel, }; }, @@ -30,7 +44,8 @@ const selector = createSelector( const ModelSelect = () => { const dispatch = useAppDispatch(); const { t } = useTranslation(); - const { allModelNames, selectedModel } = useAppSelector(selector); + const { allModelNames, allModelTooltips, selectedModel } = + useAppSelector(selector); const handleChangeModel = useCallback( (v: string | null | undefined) => { if (!v) { @@ -46,6 +61,7 @@ const ModelSelect = () => { label={t('modelManager.model')} tooltip={selectedModel?.description} items={allModelNames} + itemTooltips={allModelTooltips} selectedItem={selectedModel?.name ?? ''} setSelectedItem={handleChangeModel} withCheckIcon={true}