mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
allow inplace installs
This commit is contained in:
committed by
psychedelicious
parent
4a20377fef
commit
c7b2bdb846
@ -766,11 +766,14 @@
|
|||||||
"importModels": "Import Models",
|
"importModels": "Import Models",
|
||||||
"importQueue": "Import Queue",
|
"importQueue": "Import Queue",
|
||||||
"inpainting": "v1 Inpainting",
|
"inpainting": "v1 Inpainting",
|
||||||
|
"inplaceInstall": "Inplace install",
|
||||||
|
"inplaceInstallTooltip": "If inplace installs are enabled, Invoke will reference your model files from where they are now. If disabled, your model files will be cloned into your invokeai directory and referenced from there.",
|
||||||
"interpolationType": "Interpolation Type",
|
"interpolationType": "Interpolation Type",
|
||||||
"inverseSigmoid": "Inverse Sigmoid",
|
"inverseSigmoid": "Inverse Sigmoid",
|
||||||
"invokeAIFolder": "Invoke AI Folder",
|
"invokeAIFolder": "Invoke AI Folder",
|
||||||
"invokeRoot": "InvokeAI folder",
|
"invokeRoot": "InvokeAI folder",
|
||||||
"load": "Load",
|
"load": "Load",
|
||||||
|
"localOnly": "local only",
|
||||||
"loraModels": "LoRAs",
|
"loraModels": "LoRAs",
|
||||||
"manual": "Manual",
|
"manual": "Manual",
|
||||||
"merge": "Merge",
|
"merge": "Merge",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Button, Flex, FormControl, FormLabel, Input } from '@invoke-ai/ui-library';
|
import { Button, Checkbox, Flex, FormControl, FormLabel, Input, Tooltip } from '@invoke-ai/ui-library';
|
||||||
import { useAppDispatch } from 'app/store/storeHooks';
|
import { useAppDispatch } from 'app/store/storeHooks';
|
||||||
import { addToast } from 'features/system/store/systemSlice';
|
import { addToast } from 'features/system/store/systemSlice';
|
||||||
import { makeToast } from 'features/system/util/makeToast';
|
import { makeToast } from 'features/system/util/makeToast';
|
||||||
@ -10,6 +10,7 @@ import { useInstallModelMutation } from 'services/api/endpoints/models';
|
|||||||
|
|
||||||
type SimpleImportModelConfig = {
|
type SimpleImportModelConfig = {
|
||||||
location: string;
|
location: string;
|
||||||
|
inplace: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const InstallModelForm = () => {
|
export const InstallModelForm = () => {
|
||||||
@ -20,6 +21,7 @@ export const InstallModelForm = () => {
|
|||||||
const { register, handleSubmit, formState, reset } = useForm<SimpleImportModelConfig>({
|
const { register, handleSubmit, formState, reset } = useForm<SimpleImportModelConfig>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
location: '',
|
location: '',
|
||||||
|
inplace: true,
|
||||||
},
|
},
|
||||||
mode: 'onChange',
|
mode: 'onChange',
|
||||||
});
|
});
|
||||||
@ -30,7 +32,7 @@ export const InstallModelForm = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
installModel({ source: values.location })
|
installModel({ source: values.location, inplace: values.inplace })
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
@ -41,10 +43,10 @@ export const InstallModelForm = () => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
reset();
|
reset(undefined, { keepValues: true });
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
reset();
|
reset(undefined, { keepValues: true });
|
||||||
if (error) {
|
if (error) {
|
||||||
dispatch(
|
dispatch(
|
||||||
addToast(
|
addToast(
|
||||||
@ -73,6 +75,17 @@ export const InstallModelForm = () => {
|
|||||||
{t('modelManager.addModel')}
|
{t('modelManager.addModel')}
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<FormControl flexDir="column" gap="1" alignItems="flex-start" mt={3}>
|
||||||
|
<Tooltip label={t('modelManager.inplaceInstallTooltip')}>
|
||||||
|
<Flex gap={3}>
|
||||||
|
<Checkbox {...register('inplace')} />
|
||||||
|
<FormLabel>
|
||||||
|
{t('modelManager.inplaceInstall')} ({t('modelManager.localOnly')})
|
||||||
|
</FormLabel>
|
||||||
|
</Flex>
|
||||||
|
</Tooltip>
|
||||||
|
</FormControl>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -54,6 +54,7 @@ type ConvertMainModelResponse =
|
|||||||
|
|
||||||
type InstallModelArg = {
|
type InstallModelArg = {
|
||||||
source: paths['/api/v2/models/install']['post']['parameters']['query']['source'];
|
source: paths['/api/v2/models/install']['post']['parameters']['query']['source'];
|
||||||
|
inplace: paths['/api/v2/models/install']['post']['parameters']['query']['inplace'];
|
||||||
};
|
};
|
||||||
type InstallModelResponse = paths['/api/v2/models/install']['post']['responses']['201']['content']['application/json'];
|
type InstallModelResponse = paths['/api/v2/models/install']['post']['responses']['201']['content']['application/json'];
|
||||||
|
|
||||||
@ -176,10 +177,10 @@ export const modelsApi = api.injectEndpoints({
|
|||||||
invalidatesTags: ['Model'],
|
invalidatesTags: ['Model'],
|
||||||
}),
|
}),
|
||||||
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
|
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
|
||||||
query: ({ source }) => {
|
query: ({ source, inplace }) => {
|
||||||
return {
|
return {
|
||||||
url: buildModelsUrl('install'),
|
url: buildModelsUrl('install'),
|
||||||
params: { source },
|
params: { source, inplace },
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user