mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-18 08:12:22 -05:00
feat(ui): add badges for advanced settings
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { Flex } from '@chakra-ui/layout';
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import { stateSelector } from 'app/store/store';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { InvControlGroup } from 'common/components/InvControl/InvControlGroup';
|
||||
import type { InvLabelProps } from 'common/components/InvControl/types';
|
||||
import { InvSingleAccordion } from 'common/components/InvSingleAccordion/InvSingleAccordion';
|
||||
@@ -19,11 +22,35 @@ const labelProps2: InvLabelProps = {
|
||||
flexGrow: 1,
|
||||
};
|
||||
|
||||
const selectBadges = createMemoizedSelector(stateSelector, (state) => {
|
||||
const badges: (string | number)[] = [];
|
||||
if (state.generation.vae) {
|
||||
let vaeBadge = state.generation.vae.model_name;
|
||||
if (state.generation.vaePrecision === 'fp16') {
|
||||
vaeBadge += ` ${state.generation.vaePrecision}`;
|
||||
}
|
||||
badges.push(vaeBadge);
|
||||
} else if (state.generation.vaePrecision === 'fp16') {
|
||||
badges.push(`VAE ${state.generation.vaePrecision}`);
|
||||
}
|
||||
if (state.generation.clipSkip) {
|
||||
badges.push(`Skip ${state.generation.clipSkip}`);
|
||||
}
|
||||
if (state.generation.cfgRescaleMultiplier) {
|
||||
badges.push(`Rescale ${state.generation.cfgRescaleMultiplier}`);
|
||||
}
|
||||
if (state.generation.seamlessXAxis || state.generation.seamlessYAxis) {
|
||||
badges.push('seamless');
|
||||
}
|
||||
return badges;
|
||||
});
|
||||
|
||||
export const AdvancedSettingsAccordion = memo(() => {
|
||||
const badges = useAppSelector(selectBadges);
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<InvSingleAccordion label={t('accordions.advanced.title')}>
|
||||
<InvSingleAccordion label={t('accordions.advanced.title')} badges={badges}>
|
||||
<Flex gap={4} alignItems="center" p={4} flexDir="column">
|
||||
<Flex gap={4} w="full">
|
||||
<ParamVAEModelSelect />
|
||||
|
||||
@@ -20,7 +20,7 @@ import ParamCFGScale from 'features/parameters/components/Core/ParamCFGScale';
|
||||
import ParamScheduler from 'features/parameters/components/Core/ParamScheduler';
|
||||
import ParamSteps from 'features/parameters/components/Core/ParamSteps';
|
||||
import ParamMainModelSelect from 'features/parameters/components/MainModel/ParamMainModelSelect';
|
||||
import { size, truncate } from 'lodash-es';
|
||||
import { size } from 'lodash-es';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -34,9 +34,7 @@ const badgesSelector = createMemoizedSelector(
|
||||
const loraTabBadges = size(lora.loras) ? [size(lora.loras)] : [];
|
||||
const accordionBadges: (string | number)[] = [];
|
||||
if (generation.model) {
|
||||
accordionBadges.push(
|
||||
truncate(generation.model.model_name, { length: 24, omission: '...' })
|
||||
);
|
||||
accordionBadges.push(generation.model.model_name);
|
||||
accordionBadges.push(generation.model.base_model);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user