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:
parent
4a20377fef
commit
c7b2bdb846
@ -766,11 +766,14 @@
|
||||
"importModels": "Import Models",
|
||||
"importQueue": "Import Queue",
|
||||
"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",
|
||||
"inverseSigmoid": "Inverse Sigmoid",
|
||||
"invokeAIFolder": "Invoke AI Folder",
|
||||
"invokeRoot": "InvokeAI folder",
|
||||
"load": "Load",
|
||||
"localOnly": "local only",
|
||||
"loraModels": "LoRAs",
|
||||
"manual": "Manual",
|
||||
"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 { addToast } from 'features/system/store/systemSlice';
|
||||
import { makeToast } from 'features/system/util/makeToast';
|
||||
@ -10,6 +10,7 @@ import { useInstallModelMutation } from 'services/api/endpoints/models';
|
||||
|
||||
type SimpleImportModelConfig = {
|
||||
location: string;
|
||||
inplace: boolean;
|
||||
};
|
||||
|
||||
export const InstallModelForm = () => {
|
||||
@ -20,6 +21,7 @@ export const InstallModelForm = () => {
|
||||
const { register, handleSubmit, formState, reset } = useForm<SimpleImportModelConfig>({
|
||||
defaultValues: {
|
||||
location: '',
|
||||
inplace: true,
|
||||
},
|
||||
mode: 'onChange',
|
||||
});
|
||||
@ -30,7 +32,7 @@ export const InstallModelForm = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
installModel({ source: values.location })
|
||||
installModel({ source: values.location, inplace: values.inplace })
|
||||
.unwrap()
|
||||
.then((_) => {
|
||||
dispatch(
|
||||
@ -41,10 +43,10 @@ export const InstallModelForm = () => {
|
||||
})
|
||||
)
|
||||
);
|
||||
reset();
|
||||
reset(undefined, { keepValues: true });
|
||||
})
|
||||
.catch((error) => {
|
||||
reset();
|
||||
reset(undefined, { keepValues: true });
|
||||
if (error) {
|
||||
dispatch(
|
||||
addToast(
|
||||
@ -73,6 +75,17 @@ export const InstallModelForm = () => {
|
||||
{t('modelManager.addModel')}
|
||||
</Button>
|
||||
</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>
|
||||
);
|
||||
};
|
||||
|
@ -54,6 +54,7 @@ type ConvertMainModelResponse =
|
||||
|
||||
type InstallModelArg = {
|
||||
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'];
|
||||
|
||||
@ -176,10 +177,10 @@ export const modelsApi = api.injectEndpoints({
|
||||
invalidatesTags: ['Model'],
|
||||
}),
|
||||
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
|
||||
query: ({ source }) => {
|
||||
query: ({ source, inplace }) => {
|
||||
return {
|
||||
url: buildModelsUrl('install'),
|
||||
params: { source },
|
||||
params: { source, inplace },
|
||||
method: 'POST',
|
||||
};
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user