mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: Support UNIX paths
This commit is contained in:
parent
c91ba2dbe7
commit
f9c3c07d98
@ -28,7 +28,7 @@ export default function AdvancedAddCheckpoint(
|
||||
|
||||
const advancedAddCheckpointForm = useForm<CheckpointModelConfig>({
|
||||
initialValues: {
|
||||
model_name: model_path?.split('\\').splice(-1)[0]?.split('.')[0] ?? '',
|
||||
model_name: model_path?.match(/[^\\/]+$/)?.[0]?.split('.')[0] ?? '',
|
||||
base_model: 'sd-1',
|
||||
model_type: 'main',
|
||||
path: model_path ? model_path : '',
|
||||
@ -102,13 +102,16 @@ export default function AdvancedAddCheckpoint(
|
||||
{...advancedAddCheckpointForm.getInputProps('path')}
|
||||
onBlur={(e) => {
|
||||
if (advancedAddCheckpointForm.values['model_name'] === '') {
|
||||
advancedAddCheckpointForm.setFieldValue(
|
||||
'model_name',
|
||||
e.currentTarget.value
|
||||
.split('\\')
|
||||
.splice(-1)[0]
|
||||
?.split('.')[0] as string
|
||||
);
|
||||
const modelName = e.currentTarget.value
|
||||
.match(/[^\\/]+$/)?.[0]
|
||||
?.split('.')[0];
|
||||
|
||||
if (modelName) {
|
||||
advancedAddCheckpointForm.setFieldValue(
|
||||
'model_name',
|
||||
modelName as string
|
||||
);
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
@ -25,7 +25,7 @@ export default function AdvancedAddDiffusers(props: AdvancedAddDiffusersProps) {
|
||||
|
||||
const advancedAddDiffusersForm = useForm<DiffusersModelConfig>({
|
||||
initialValues: {
|
||||
model_name: model_path?.split('\\').splice(-1)[0] ?? '',
|
||||
model_name: model_path?.match(/[^\\/]+$/)?.[0] ?? '',
|
||||
base_model: 'sd-1',
|
||||
model_type: 'main',
|
||||
path: model_path ? model_path : '',
|
||||
@ -94,10 +94,13 @@ export default function AdvancedAddDiffusers(props: AdvancedAddDiffusersProps) {
|
||||
{...advancedAddDiffusersForm.getInputProps('path')}
|
||||
onBlur={(e) => {
|
||||
if (advancedAddDiffusersForm.values['model_name'] === '') {
|
||||
advancedAddDiffusersForm.setFieldValue(
|
||||
'model_name',
|
||||
e.currentTarget.value.split('\\').splice(-1)[0] as string
|
||||
);
|
||||
const modelName = e.currentTarget.value.match(/[^\\/]+$/)?.[0];
|
||||
if (modelName) {
|
||||
advancedAddDiffusersForm.setFieldValue(
|
||||
'model_name',
|
||||
modelName as string
|
||||
);
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user