mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-10 09:15:06 -05:00
`options` slice was huge and managed a mix of generation parameters and general app settings. It has been split up: - Generation parameters are now in `generationSlice`. - Postprocessing parameters are now in `postprocessingSlice` - UI related things are now in `uiSlice` There is probably more to be done, like `gallerySlice` perhaps should only manage internal gallery state, and not if the gallery is displayed. Full-slice selectors have been made for each slice. Other organisational tweaks.
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import React, { ChangeEvent } from 'react';
|
|
import { RootState } from 'app/store';
|
|
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
|
|
import IAIInput from 'common/components/IAIInput';
|
|
import { validateSeedWeights } from 'common/util/seedWeightPairs';
|
|
import { setSeedWeights } from 'features/parameters/store/generationSlice';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export default function SeedWeights() {
|
|
const seedWeights = useAppSelector(
|
|
(state: RootState) => state.generation.seedWeights
|
|
);
|
|
|
|
const shouldGenerateVariations = useAppSelector(
|
|
(state: RootState) => state.generation.shouldGenerateVariations
|
|
);
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const dispatch = useAppDispatch();
|
|
|
|
const handleChangeSeedWeights = (e: ChangeEvent<HTMLInputElement>) =>
|
|
dispatch(setSeedWeights(e.target.value));
|
|
|
|
return (
|
|
<IAIInput
|
|
label={t('parameters:seedWeights')}
|
|
value={seedWeights}
|
|
isInvalid={
|
|
shouldGenerateVariations &&
|
|
!(validateSeedWeights(seedWeights) || seedWeights === '')
|
|
}
|
|
isDisabled={!shouldGenerateVariations}
|
|
onChange={handleChangeSeedWeights}
|
|
/>
|
|
);
|
|
}
|