fix(ui): fallback to null for invalid metadata values (#4575)

This commit is contained in:
psychedelicious 2023-09-21 00:02:58 +10:00 committed by GitHub
parent bdfdf854fc
commit b5266f89ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1120,36 +1120,45 @@ export type LoRAMetadataItem = z.infer<typeof zLoRAMetadataItem>;
export const zCoreMetadata = z export const zCoreMetadata = z
.object({ .object({
app_version: z.string().nullish(), app_version: z.string().nullish().catch(null),
generation_mode: z.string().nullish(), generation_mode: z.string().nullish().catch(null),
created_by: z.string().nullish(), created_by: z.string().nullish().catch(null),
positive_prompt: z.string().nullish(), positive_prompt: z.string().nullish().catch(null),
negative_prompt: z.string().nullish(), negative_prompt: z.string().nullish().catch(null),
width: z.number().int().nullish(), width: z.number().int().nullish().catch(null),
height: z.number().int().nullish(), height: z.number().int().nullish().catch(null),
seed: z.number().int().nullish(), seed: z.number().int().nullish().catch(null),
rand_device: z.string().nullish(), rand_device: z.string().nullish().catch(null),
cfg_scale: z.number().nullish(), cfg_scale: z.number().nullish().catch(null),
steps: z.number().int().nullish(), steps: z.number().int().nullish().catch(null),
scheduler: z.string().nullish(), scheduler: z.string().nullish().catch(null),
clip_skip: z.number().int().nullish(), clip_skip: z.number().int().nullish().catch(null),
model: z model: z
.union([zMainModel.deepPartial(), zOnnxModel.deepPartial()]) .union([zMainModel.deepPartial(), zOnnxModel.deepPartial()])
.nullish(), .nullish()
controlnets: z.array(zControlField.deepPartial()).nullish(), .catch(null),
loras: z.array(zLoRAMetadataItem).nullish(), controlnets: z.array(zControlField.deepPartial()).nullish().catch(null),
vae: zVaeModelField.nullish(), loras: z
strength: z.number().nullish(), .array(
init_image: z.string().nullish(), z.object({
positive_style_prompt: z.string().nullish(), lora: zLoRAModelField.deepPartial(),
negative_style_prompt: z.string().nullish(), weight: z.number(),
refiner_model: zSDXLRefinerModel.deepPartial().nullish(), })
refiner_cfg_scale: z.number().nullish(), )
refiner_steps: z.number().int().nullish(), .nullish()
refiner_scheduler: z.string().nullish(), .catch(null),
refiner_positive_aesthetic_score: z.number().nullish(), vae: zVaeModelField.nullish().catch(null),
refiner_negative_aesthetic_score: z.number().nullish(), strength: z.number().nullish().catch(null),
refiner_start: z.number().nullish(), init_image: z.string().nullish().catch(null),
positive_style_prompt: z.string().nullish().catch(null),
negative_style_prompt: z.string().nullish().catch(null),
refiner_model: zSDXLRefinerModel.deepPartial().nullish().catch(null),
refiner_cfg_scale: z.number().nullish().catch(null),
refiner_steps: z.number().int().nullish().catch(null),
refiner_scheduler: z.string().nullish().catch(null),
refiner_positive_aesthetic_score: z.number().nullish().catch(null),
refiner_negative_aesthetic_score: z.number().nullish().catch(null),
refiner_start: z.number().nullish().catch(null),
}) })
.passthrough(); .passthrough();