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>({
|
const advancedAddCheckpointForm = useForm<CheckpointModelConfig>({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
model_name: model_path?.split('\\').splice(-1)[0]?.split('.')[0] ?? '',
|
model_name: model_path?.match(/[^\\/]+$/)?.[0]?.split('.')[0] ?? '',
|
||||||
base_model: 'sd-1',
|
base_model: 'sd-1',
|
||||||
model_type: 'main',
|
model_type: 'main',
|
||||||
path: model_path ? model_path : '',
|
path: model_path ? model_path : '',
|
||||||
@ -102,13 +102,16 @@ export default function AdvancedAddCheckpoint(
|
|||||||
{...advancedAddCheckpointForm.getInputProps('path')}
|
{...advancedAddCheckpointForm.getInputProps('path')}
|
||||||
onBlur={(e) => {
|
onBlur={(e) => {
|
||||||
if (advancedAddCheckpointForm.values['model_name'] === '') {
|
if (advancedAddCheckpointForm.values['model_name'] === '') {
|
||||||
advancedAddCheckpointForm.setFieldValue(
|
const modelName = e.currentTarget.value
|
||||||
'model_name',
|
.match(/[^\\/]+$/)?.[0]
|
||||||
e.currentTarget.value
|
?.split('.')[0];
|
||||||
.split('\\')
|
|
||||||
.splice(-1)[0]
|
if (modelName) {
|
||||||
?.split('.')[0] as string
|
advancedAddCheckpointForm.setFieldValue(
|
||||||
);
|
'model_name',
|
||||||
|
modelName as string
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -25,7 +25,7 @@ export default function AdvancedAddDiffusers(props: AdvancedAddDiffusersProps) {
|
|||||||
|
|
||||||
const advancedAddDiffusersForm = useForm<DiffusersModelConfig>({
|
const advancedAddDiffusersForm = useForm<DiffusersModelConfig>({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
model_name: model_path?.split('\\').splice(-1)[0] ?? '',
|
model_name: model_path?.match(/[^\\/]+$/)?.[0] ?? '',
|
||||||
base_model: 'sd-1',
|
base_model: 'sd-1',
|
||||||
model_type: 'main',
|
model_type: 'main',
|
||||||
path: model_path ? model_path : '',
|
path: model_path ? model_path : '',
|
||||||
@ -94,10 +94,13 @@ export default function AdvancedAddDiffusers(props: AdvancedAddDiffusersProps) {
|
|||||||
{...advancedAddDiffusersForm.getInputProps('path')}
|
{...advancedAddDiffusersForm.getInputProps('path')}
|
||||||
onBlur={(e) => {
|
onBlur={(e) => {
|
||||||
if (advancedAddDiffusersForm.values['model_name'] === '') {
|
if (advancedAddDiffusersForm.values['model_name'] === '') {
|
||||||
advancedAddDiffusersForm.setFieldValue(
|
const modelName = e.currentTarget.value.match(/[^\\/]+$/)?.[0];
|
||||||
'model_name',
|
if (modelName) {
|
||||||
e.currentTarget.value.split('\\').splice(-1)[0] as string
|
advancedAddDiffusersForm.setFieldValue(
|
||||||
);
|
'model_name',
|
||||||
|
modelName as string
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user