mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fixed merge conflicts
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import {
|
||||
As,
|
||||
ChakraProps,
|
||||
Flex,
|
||||
FlexProps,
|
||||
Icon,
|
||||
Skeleton,
|
||||
Spinner,
|
||||
@ -47,15 +47,14 @@ export const IAILoadingImageFallback = (props: Props) => {
|
||||
);
|
||||
};
|
||||
|
||||
type IAINoImageFallbackProps = {
|
||||
type IAINoImageFallbackProps = FlexProps & {
|
||||
label?: string;
|
||||
icon?: As | null;
|
||||
boxSize?: StyleProps['boxSize'];
|
||||
sx?: ChakraProps['sx'];
|
||||
};
|
||||
|
||||
export const IAINoContentFallback = (props: IAINoImageFallbackProps) => {
|
||||
const { icon = FaImage, boxSize = 16 } = props;
|
||||
const { icon = FaImage, boxSize = 16, sx, ...rest } = props;
|
||||
|
||||
return (
|
||||
<Flex
|
||||
@ -73,8 +72,9 @@ export const IAINoContentFallback = (props: IAINoImageFallbackProps) => {
|
||||
_dark: {
|
||||
color: 'base.500',
|
||||
},
|
||||
...props.sx,
|
||||
...sx,
|
||||
}}
|
||||
{...rest}
|
||||
>
|
||||
{icon && <Icon as={icon} boxSize={boxSize} opacity={0.7} />}
|
||||
{props.label && <Text textAlign="center">{props.label}</Text>}
|
||||
|
@ -0,0 +1,29 @@
|
||||
import { Box, Text } from '@chakra-ui/react';
|
||||
import { forwardRef, memo } from 'react';
|
||||
|
||||
interface ItemProps extends React.ComponentPropsWithoutRef<'div'> {
|
||||
label: string;
|
||||
value: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
const IAIMantineSelectItemWithDescription = forwardRef<
|
||||
HTMLDivElement,
|
||||
ItemProps
|
||||
>(({ label, description, ...rest }: ItemProps, ref) => (
|
||||
<Box ref={ref} {...rest}>
|
||||
<Box>
|
||||
<Text fontWeight={600}>{label}</Text>
|
||||
{description && (
|
||||
<Text size="xs" variant="subtext">
|
||||
{description}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
));
|
||||
|
||||
IAIMantineSelectItemWithDescription.displayName =
|
||||
'IAIMantineSelectItemWithDescription';
|
||||
|
||||
export default memo(IAIMantineSelectItemWithDescription);
|
@ -4,7 +4,6 @@ import { useAppToaster } from 'app/components/Toaster';
|
||||
import { stateSelector } from 'app/store/store';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
|
||||
import { selectIsBusy } from 'features/system/store/systemSelectors';
|
||||
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import {
|
||||
@ -51,7 +50,6 @@ type ImageUploaderProps = {
|
||||
const ImageUploader = (props: ImageUploaderProps) => {
|
||||
const { children } = props;
|
||||
const { autoAddBoardId, postUploadAction } = useAppSelector(selector);
|
||||
const isBusy = useAppSelector(selectIsBusy);
|
||||
const toaster = useAppToaster();
|
||||
const { t } = useTranslation();
|
||||
const [isHandlingUpload, setIsHandlingUpload] = useState<boolean>(false);
|
||||
@ -106,6 +104,10 @@ const ImageUploader = (props: ImageUploaderProps) => {
|
||||
[t, toaster, fileAcceptedCallback, fileRejectionCallback]
|
||||
);
|
||||
|
||||
const onDragOver = useCallback(() => {
|
||||
setIsHandlingUpload(true);
|
||||
}, []);
|
||||
|
||||
const {
|
||||
getRootProps,
|
||||
getInputProps,
|
||||
@ -117,8 +119,7 @@ const ImageUploader = (props: ImageUploaderProps) => {
|
||||
accept: { 'image/png': ['.png'], 'image/jpeg': ['.jpg', '.jpeg', '.png'] },
|
||||
noClick: true,
|
||||
onDrop,
|
||||
onDragOver: () => setIsHandlingUpload(true),
|
||||
disabled: isBusy,
|
||||
onDragOver,
|
||||
multiple: false,
|
||||
});
|
||||
|
||||
|
@ -4,25 +4,22 @@ import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
|
||||
import { isInvocationNode } from 'features/nodes/types/types';
|
||||
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
|
||||
import i18n from 'i18next';
|
||||
import { forEach, map } from 'lodash-es';
|
||||
import { getConnectedEdges } from 'reactflow';
|
||||
import i18n from 'i18next';
|
||||
|
||||
const selector = createSelector(
|
||||
[stateSelector, activeTabNameSelector],
|
||||
(state, activeTabName) => {
|
||||
const { generation, system, nodes } = state;
|
||||
(
|
||||
{ controlNet, generation, system, nodes, dynamicPrompts },
|
||||
activeTabName
|
||||
) => {
|
||||
const { initialImage, model } = generation;
|
||||
|
||||
const { isProcessing, isConnected } = system;
|
||||
const { isConnected } = system;
|
||||
|
||||
const reasons: string[] = [];
|
||||
|
||||
// Cannot generate if already processing an image
|
||||
if (isProcessing) {
|
||||
reasons.push(i18n.t('parameters.invoke.systemBusy'));
|
||||
}
|
||||
|
||||
// Cannot generate if not connected
|
||||
if (!isConnected) {
|
||||
reasons.push(i18n.t('parameters.invoke.systemDisconnected'));
|
||||
@ -82,12 +79,16 @@ const selector = createSelector(
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (dynamicPrompts.prompts.length === 0) {
|
||||
reasons.push(i18n.t('parameters.invoke.noPrompts'));
|
||||
}
|
||||
|
||||
if (!model) {
|
||||
reasons.push(i18n.t('parameters.invoke.noModelSelected'));
|
||||
}
|
||||
|
||||
if (state.controlNet.isEnabled) {
|
||||
map(state.controlNet.controlNets).forEach((controlNet, i) => {
|
||||
if (controlNet.isEnabled) {
|
||||
map(controlNet.controlNets).forEach((controlNet, i) => {
|
||||
if (!controlNet.isEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -112,12 +113,12 @@ const selector = createSelector(
|
||||
}
|
||||
}
|
||||
|
||||
return { isReady: !reasons.length, isProcessing, reasons };
|
||||
return { isReady: !reasons.length, reasons };
|
||||
},
|
||||
defaultSelectorOptions
|
||||
);
|
||||
|
||||
export const useIsReadyToInvoke = () => {
|
||||
const { isReady, isProcessing, reasons } = useAppSelector(selector);
|
||||
return { isReady, isProcessing, reasons };
|
||||
export const useIsReadyToEnqueue = () => {
|
||||
const { isReady, reasons } = useAppSelector(selector);
|
||||
return { isReady, reasons };
|
||||
};
|
28
invokeai/frontend/web/src/common/util/generateSeeds.ts
Normal file
28
invokeai/frontend/web/src/common/util/generateSeeds.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { NUMPY_RAND_MAX, NUMPY_RAND_MIN } from 'app/constants';
|
||||
import { random } from 'lodash-es';
|
||||
|
||||
export type GenerateSeedsArg = {
|
||||
count: number;
|
||||
start?: number;
|
||||
min?: number;
|
||||
max?: number;
|
||||
};
|
||||
|
||||
export const generateSeeds = ({
|
||||
count,
|
||||
start,
|
||||
min = NUMPY_RAND_MIN,
|
||||
max = NUMPY_RAND_MAX,
|
||||
}: GenerateSeedsArg) => {
|
||||
const first = start ?? random(min, max);
|
||||
const seeds: number[] = [];
|
||||
for (let i = first; i < first + count; i++) {
|
||||
seeds.push(i % max);
|
||||
}
|
||||
return seeds;
|
||||
};
|
||||
|
||||
export const generateOneSeed = (
|
||||
min: number = NUMPY_RAND_MIN,
|
||||
max: number = NUMPY_RAND_MAX
|
||||
) => random(min, max);
|
Reference in New Issue
Block a user