mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Initial Implementation - Model Conversion Frontend
This commit is contained in:
parent
f3153d45bc
commit
9232290950
@ -38,6 +38,10 @@ export const addNewModel = createAction<
|
|||||||
|
|
||||||
export const deleteModel = createAction<string>('socketio/deleteModel');
|
export const deleteModel = createAction<string>('socketio/deleteModel');
|
||||||
|
|
||||||
|
export const convertToDiffusers = createAction<string>(
|
||||||
|
'socketio/convertToDiffusers'
|
||||||
|
);
|
||||||
|
|
||||||
export const requestModelChange = createAction<string>(
|
export const requestModelChange = createAction<string>(
|
||||||
'socketio/requestModelChange'
|
'socketio/requestModelChange'
|
||||||
);
|
);
|
||||||
|
@ -178,6 +178,9 @@ const makeSocketIOEmitters = (
|
|||||||
emitDeleteModel: (modelName: string) => {
|
emitDeleteModel: (modelName: string) => {
|
||||||
socketio.emit('deleteModel', modelName);
|
socketio.emit('deleteModel', modelName);
|
||||||
},
|
},
|
||||||
|
emitConvertToDiffusers: (modelName: string) => {
|
||||||
|
socketio.emit('convertToDiffusers', modelName);
|
||||||
|
},
|
||||||
emitRequestModelChange: (modelName: string) => {
|
emitRequestModelChange: (modelName: string) => {
|
||||||
dispatch(modelChangeRequested());
|
dispatch(modelChangeRequested());
|
||||||
socketio.emit('requestModelChange', modelName);
|
socketio.emit('requestModelChange', modelName);
|
||||||
|
@ -64,6 +64,7 @@ export const socketioMiddleware = () => {
|
|||||||
emitSearchForModels,
|
emitSearchForModels,
|
||||||
emitAddNewModel,
|
emitAddNewModel,
|
||||||
emitDeleteModel,
|
emitDeleteModel,
|
||||||
|
emitConvertToDiffusers,
|
||||||
emitRequestModelChange,
|
emitRequestModelChange,
|
||||||
emitSaveStagingAreaImageToGallery,
|
emitSaveStagingAreaImageToGallery,
|
||||||
emitRequestEmptyTempFolder,
|
emitRequestEmptyTempFolder,
|
||||||
@ -199,6 +200,11 @@ export const socketioMiddleware = () => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'socketio/convertToDiffusers': {
|
||||||
|
emitConvertToDiffusers(action.payload);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'socketio/requestModelChange': {
|
case 'socketio/requestModelChange': {
|
||||||
emitRequestModelChange(action.payload);
|
emitRequestModelChange(action.payload);
|
||||||
break;
|
break;
|
||||||
|
@ -85,6 +85,7 @@ const ModelList = () => {
|
|||||||
name={model.name}
|
name={model.name}
|
||||||
status={model.status}
|
status={model.status}
|
||||||
description={model.description}
|
description={model.description}
|
||||||
|
format={model.format}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
if (model.format === isSelectedFilter) {
|
if (model.format === isSelectedFilter) {
|
||||||
@ -94,6 +95,7 @@ const ModelList = () => {
|
|||||||
name={model.name}
|
name={model.name}
|
||||||
status={model.status}
|
status={model.status}
|
||||||
description={model.description}
|
description={model.description}
|
||||||
|
format={model.format}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -105,6 +107,7 @@ const ModelList = () => {
|
|||||||
name={model.name}
|
name={model.name}
|
||||||
status={model.status}
|
status={model.status}
|
||||||
description={model.description}
|
description={model.description}
|
||||||
|
format={model.format}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -114,6 +117,7 @@ const ModelList = () => {
|
|||||||
name={model.name}
|
name={model.name}
|
||||||
status={model.status}
|
status={model.status}
|
||||||
description={model.description}
|
description={model.description}
|
||||||
|
format={model.format}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,27 @@
|
|||||||
import { DeleteIcon, EditIcon } from '@chakra-ui/icons';
|
import { DeleteIcon, EditIcon } from '@chakra-ui/icons';
|
||||||
import { Box, Button, Flex, Spacer, Text, Tooltip } from '@chakra-ui/react';
|
import { Box, Button, Flex, Spacer, Text, Tooltip } from '@chakra-ui/react';
|
||||||
import { ModelStatus } from 'app/invokeai';
|
import { ModelStatus } from 'app/invokeai';
|
||||||
import { deleteModel, requestModelChange } from 'app/socketio/actions';
|
import {
|
||||||
|
convertToDiffusers,
|
||||||
|
deleteModel,
|
||||||
|
requestModelChange,
|
||||||
|
} from 'app/socketio/actions';
|
||||||
import { RootState } from 'app/store';
|
import { RootState } from 'app/store';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
|
||||||
import IAIAlertDialog from 'common/components/IAIAlertDialog';
|
import IAIAlertDialog from 'common/components/IAIAlertDialog';
|
||||||
import IAIIconButton from 'common/components/IAIIconButton';
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
import { setOpenModel } from 'features/system/store/systemSlice';
|
import {
|
||||||
|
setIsProcessing,
|
||||||
|
setOpenModel,
|
||||||
|
} from 'features/system/store/systemSlice';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { MdSwitchLeft } from 'react-icons/md';
|
||||||
|
|
||||||
type ModelListItemProps = {
|
type ModelListItemProps = {
|
||||||
name: string;
|
name: string;
|
||||||
status: ModelStatus;
|
status: ModelStatus;
|
||||||
description: string;
|
description: string;
|
||||||
|
format: string | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ModelListItem(props: ModelListItemProps) {
|
export default function ModelListItem(props: ModelListItemProps) {
|
||||||
@ -28,7 +37,7 @@ export default function ModelListItem(props: ModelListItemProps) {
|
|||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const { name, status, description } = props;
|
const { name, status, description, format } = props;
|
||||||
|
|
||||||
const handleChangeModel = () => {
|
const handleChangeModel = () => {
|
||||||
dispatch(requestModelChange(name));
|
dispatch(requestModelChange(name));
|
||||||
@ -38,6 +47,11 @@ export default function ModelListItem(props: ModelListItemProps) {
|
|||||||
dispatch(setOpenModel(name));
|
dispatch(setOpenModel(name));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const convertModelHandler = () => {
|
||||||
|
dispatch(setIsProcessing(true));
|
||||||
|
dispatch(convertToDiffusers(name));
|
||||||
|
};
|
||||||
|
|
||||||
const handleModelDelete = () => {
|
const handleModelDelete = () => {
|
||||||
dispatch(deleteModel(name));
|
dispatch(deleteModel(name));
|
||||||
dispatch(setOpenModel(null));
|
dispatch(setOpenModel(null));
|
||||||
@ -83,6 +97,7 @@ export default function ModelListItem(props: ModelListItemProps) {
|
|||||||
>
|
>
|
||||||
{t('modelmanager:load')}
|
{t('modelmanager:load')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<IAIIconButton
|
<IAIIconButton
|
||||||
icon={<EditIcon />}
|
icon={<EditIcon />}
|
||||||
size={'sm'}
|
size={'sm'}
|
||||||
@ -91,6 +106,16 @@ export default function ModelListItem(props: ModelListItemProps) {
|
|||||||
isDisabled={status === 'active' || isProcessing || !isConnected}
|
isDisabled={status === 'active' || isProcessing || !isConnected}
|
||||||
className=" modal-close-btn"
|
className=" modal-close-btn"
|
||||||
/>
|
/>
|
||||||
|
{format !== 'diffusers' && (
|
||||||
|
<IAIIconButton
|
||||||
|
icon={<MdSwitchLeft />}
|
||||||
|
size={'sm'}
|
||||||
|
onClick={convertModelHandler}
|
||||||
|
aria-label="Convert Model"
|
||||||
|
isDisabled={status === 'active' || isProcessing || !isConnected}
|
||||||
|
className=" modal-close-btn"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<IAIAlertDialog
|
<IAIAlertDialog
|
||||||
title={t('modelmanager:deleteModel')}
|
title={t('modelmanager:deleteModel')}
|
||||||
acceptCallback={handleModelDelete}
|
acceptCallback={handleModelDelete}
|
||||||
|
Loading…
Reference in New Issue
Block a user