Skip to content

Commit c7b2bdb

Browse files
Mary Hipppsychedelicious
authored andcommitted
allow inplace installs
1 parent 4a20377 commit c7b2bdb

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,11 +766,14 @@
766766
"importModels": "Import Models",
767767
"importQueue": "Import Queue",
768768
"inpainting": "v1 Inpainting",
769+
"inplaceInstall": "Inplace install",
770+
"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.",
769771
"interpolationType": "Interpolation Type",
770772
"inverseSigmoid": "Inverse Sigmoid",
771773
"invokeAIFolder": "Invoke AI Folder",
772774
"invokeRoot": "InvokeAI folder",
773775
"load": "Load",
776+
"localOnly": "local only",
774777
"loraModels": "LoRAs",
775778
"manual": "Manual",
776779
"merge": "Merge",

invokeai/frontend/web/src/features/modelManagerV2/subpanels/AddModelPanel/InstallModelForm.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Button, Flex, FormControl, FormLabel, Input } from '@invoke-ai/ui-library';
1+
import { Button, Checkbox, Flex, FormControl, FormLabel, Input, Tooltip } from '@invoke-ai/ui-library';
22
import { useAppDispatch } from 'app/store/storeHooks';
33
import { addToast } from 'features/system/store/systemSlice';
44
import { makeToast } from 'features/system/util/makeToast';
@@ -10,6 +10,7 @@ import { useInstallModelMutation } from 'services/api/endpoints/models';
1010

1111
type SimpleImportModelConfig = {
1212
location: string;
13+
inplace: boolean;
1314
};
1415

1516
export const InstallModelForm = () => {
@@ -20,6 +21,7 @@ export const InstallModelForm = () => {
2021
const { register, handleSubmit, formState, reset } = useForm<SimpleImportModelConfig>({
2122
defaultValues: {
2223
location: '',
24+
inplace: true,
2325
},
2426
mode: 'onChange',
2527
});
@@ -30,7 +32,7 @@ export const InstallModelForm = () => {
3032
return;
3133
}
3234

33-
installModel({ source: values.location })
35+
installModel({ source: values.location, inplace: values.inplace })
3436
.unwrap()
3537
.then((_) => {
3638
dispatch(
@@ -41,10 +43,10 @@ export const InstallModelForm = () => {
4143
})
4244
)
4345
);
44-
reset();
46+
reset(undefined, { keepValues: true });
4547
})
4648
.catch((error) => {
47-
reset();
49+
reset(undefined, { keepValues: true });
4850
if (error) {
4951
dispatch(
5052
addToast(
@@ -73,6 +75,17 @@ export const InstallModelForm = () => {
7375
{t('modelManager.addModel')}
7476
</Button>
7577
</Flex>
78+
79+
<FormControl flexDir="column" gap="1" alignItems="flex-start" mt={3}>
80+
<Tooltip label={t('modelManager.inplaceInstallTooltip')}>
81+
<Flex gap={3}>
82+
<Checkbox {...register('inplace')} />
83+
<FormLabel>
84+
{t('modelManager.inplaceInstall')} ({t('modelManager.localOnly')})
85+
</FormLabel>
86+
</Flex>
87+
</Tooltip>
88+
</FormControl>
7689
</form>
7790
);
7891
};

invokeai/frontend/web/src/services/api/endpoints/models.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type ConvertMainModelResponse =
5454

5555
type InstallModelArg = {
5656
source: paths['/api/v2/models/install']['post']['parameters']['query']['source'];
57+
inplace: paths['/api/v2/models/install']['post']['parameters']['query']['inplace'];
5758
};
5859
type InstallModelResponse = paths['/api/v2/models/install']['post']['responses']['201']['content']['application/json'];
5960

@@ -176,10 +177,10 @@ export const modelsApi = api.injectEndpoints({
176177
invalidatesTags: ['Model'],
177178
}),
178179
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
179-
query: ({ source }) => {
180+
query: ({ source, inplace }) => {
180181
return {
181182
url: buildModelsUrl('install'),
182-
params: { source },
183+
params: { source, inplace },
183184
method: 'POST',
184185
};
185186
},

0 commit comments

Comments
 (0)