File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/AddModelsPanel Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 11import { Flex } from '@chakra-ui/react' ;
22import { useForm } from '@mantine/form' ;
3- import { makeToast } from 'features/system/util/makeToast' ;
43import { useAppDispatch } from 'app/store/storeHooks' ;
54import IAIButton from 'common/components/IAIButton' ;
65import IAIMantineTextInput from 'common/components/IAIMantineInput' ;
76import IAISimpleCheckbox from 'common/components/IAISimpleCheckbox' ;
87import { addToast } from 'features/system/store/systemSlice' ;
8+ import { makeToast } from 'features/system/util/makeToast' ;
99import { useState } from 'react' ;
1010import { useTranslation } from 'react-i18next' ;
1111import { useAddMainModelsMutation } from 'services/api/endpoints/models' ;
@@ -100,6 +100,17 @@ export default function AdvancedAddCheckpoint(
100100 label = "Model Location"
101101 required
102102 { ...advancedAddCheckpointForm . getInputProps ( 'path' ) }
103+ onBlur = { ( e ) => {
104+ if ( advancedAddCheckpointForm . values [ 'model_name' ] === '' ) {
105+ advancedAddCheckpointForm . setFieldValue (
106+ 'model_name' ,
107+ e . currentTarget . value
108+ . split ( '\\' )
109+ . splice ( - 1 ) [ 0 ]
110+ ?. split ( '.' ) [ 0 ] as string
111+ ) ;
112+ }
113+ } }
103114 />
104115 < IAIMantineTextInput
105116 label = "Description"
Original file line number Diff line number Diff line change 11import { Flex } from '@chakra-ui/react' ;
22import { useForm } from '@mantine/form' ;
3- import { makeToast } from 'features/system/util/makeToast' ;
43import { useAppDispatch } from 'app/store/storeHooks' ;
54import IAIButton from 'common/components/IAIButton' ;
65import IAIMantineTextInput from 'common/components/IAIMantineInput' ;
76import { addToast } from 'features/system/store/systemSlice' ;
7+ import { makeToast } from 'features/system/util/makeToast' ;
88import { useTranslation } from 'react-i18next' ;
99import { useAddMainModelsMutation } from 'services/api/endpoints/models' ;
1010import { DiffusersModelConfig } from 'services/api/types' ;
@@ -92,6 +92,14 @@ export default function AdvancedAddDiffusers(props: AdvancedAddDiffusersProps) {
9292 label = "Model Location"
9393 placeholder = "Provide the path to a local folder where your Diffusers Model is stored"
9494 { ...advancedAddDiffusersForm . getInputProps ( 'path' ) }
95+ onBlur = { ( e ) => {
96+ if ( advancedAddDiffusersForm . values [ 'model_name' ] === '' ) {
97+ advancedAddDiffusersForm . setFieldValue (
98+ 'model_name' ,
99+ e . currentTarget . value . split ( '\\' ) . splice ( - 1 ) [ 0 ] as string
100+ ) ;
101+ }
102+ } }
95103 />
96104 < IAIMantineTextInput
97105 label = "Description"
You can’t perform that action at this time.
0 commit comments