fix(ui): recall control adapter metadata fields

This commit is contained in:
psychedelicious 2024-03-14 12:18:06 +11:00 committed by Kent Keirsey
parent 06ff105a1f
commit 0131e7d928

View File

@ -225,28 +225,27 @@ const parseControlNet: MetadataParseFunc<ControlNetConfigMetadata> = async (meta
const control_model = await getProperty(metadataItem, 'control_model'); const control_model = await getProperty(metadataItem, 'control_model');
const key = await getModelKey(control_model, 'controlnet'); const key = await getModelKey(control_model, 'controlnet');
const controlNetModel = await fetchModelConfigWithTypeGuard(key, isControlNetModelConfig); const controlNetModel = await fetchModelConfigWithTypeGuard(key, isControlNetModelConfig);
const image = zControlField.shape.image.nullish().catch(null).parse(await getProperty(metadataItem, 'image'));
const image = zControlField.shape.image.nullish().catch(null).parse(getProperty(metadataItem, 'image'));
const control_weight = zControlField.shape.control_weight const control_weight = zControlField.shape.control_weight
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'control_weight')); .parse(await getProperty(metadataItem, 'control_weight'));
const begin_step_percent = zControlField.shape.begin_step_percent const begin_step_percent = zControlField.shape.begin_step_percent
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'begin_step_percent')); .parse(await getProperty(metadataItem, 'begin_step_percent'));
const end_step_percent = zControlField.shape.end_step_percent const end_step_percent = zControlField.shape.end_step_percent
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'end_step_percent')); .parse(await getProperty(metadataItem, 'end_step_percent'));
const control_mode = zControlField.shape.control_mode const control_mode = zControlField.shape.control_mode
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'control_mode')); .parse(await getProperty(metadataItem, 'control_mode'));
const resize_mode = zControlField.shape.resize_mode const resize_mode = zControlField.shape.resize_mode
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'resize_mode')); .parse(await getProperty(metadataItem, 'resize_mode'));
const { processorType, processorNode } = buildControlAdapterProcessor(controlNetModel); const { processorType, processorNode } = buildControlAdapterProcessor(controlNetModel);
@ -284,20 +283,20 @@ const parseT2IAdapter: MetadataParseFunc<T2IAdapterConfigMetadata> = async (meta
const key = await getModelKey(t2i_adapter_model, 't2i_adapter'); const key = await getModelKey(t2i_adapter_model, 't2i_adapter');
const t2iAdapterModel = await fetchModelConfigWithTypeGuard(key, isT2IAdapterModelConfig); const t2iAdapterModel = await fetchModelConfigWithTypeGuard(key, isT2IAdapterModelConfig);
const image = zT2IAdapterField.shape.image.nullish().catch(null).parse(getProperty(metadataItem, 'image')); const image = zT2IAdapterField.shape.image.nullish().catch(null).parse(await getProperty(metadataItem, 'image'));
const weight = zT2IAdapterField.shape.weight.nullish().catch(null).parse(getProperty(metadataItem, 'weight')); const weight = zT2IAdapterField.shape.weight.nullish().catch(null).parse(await getProperty(metadataItem, 'weight'));
const begin_step_percent = zT2IAdapterField.shape.begin_step_percent const begin_step_percent = zT2IAdapterField.shape.begin_step_percent
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'begin_step_percent')); .parse(await getProperty(metadataItem, 'begin_step_percent'));
const end_step_percent = zT2IAdapterField.shape.end_step_percent const end_step_percent = zT2IAdapterField.shape.end_step_percent
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'end_step_percent')); .parse(await getProperty(metadataItem, 'end_step_percent'));
const resize_mode = zT2IAdapterField.shape.resize_mode const resize_mode = zT2IAdapterField.shape.resize_mode
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'resize_mode')); .parse(await getProperty(metadataItem, 'resize_mode'));
const { processorType, processorNode } = buildControlAdapterProcessor(t2iAdapterModel); const { processorType, processorNode } = buildControlAdapterProcessor(t2iAdapterModel);
@ -334,16 +333,16 @@ const parseIPAdapter: MetadataParseFunc<IPAdapterConfigMetadata> = async (metada
const key = await getModelKey(ip_adapter_model, 'ip_adapter'); const key = await getModelKey(ip_adapter_model, 'ip_adapter');
const ipAdapterModel = await fetchModelConfigWithTypeGuard(key, isIPAdapterModelConfig); const ipAdapterModel = await fetchModelConfigWithTypeGuard(key, isIPAdapterModelConfig);
const image = zIPAdapterField.shape.image.nullish().catch(null).parse(getProperty(metadataItem, 'image')); const image = zIPAdapterField.shape.image.nullish().catch(null).parse(await getProperty(metadataItem, 'image'));
const weight = zIPAdapterField.shape.weight.nullish().catch(null).parse(getProperty(metadataItem, 'weight')); const weight = zIPAdapterField.shape.weight.nullish().catch(null).parse(await getProperty(metadataItem, 'weight'));
const begin_step_percent = zIPAdapterField.shape.begin_step_percent const begin_step_percent = zIPAdapterField.shape.begin_step_percent
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'begin_step_percent')); .parse(await getProperty(metadataItem, 'begin_step_percent'));
const end_step_percent = zIPAdapterField.shape.end_step_percent const end_step_percent = zIPAdapterField.shape.end_step_percent
.nullish() .nullish()
.catch(null) .catch(null)
.parse(getProperty(metadataItem, 'end_step_percent')); .parse(await getProperty(metadataItem, 'end_step_percent'));
const ipAdapter: IPAdapterConfigMetadata = { const ipAdapter: IPAdapterConfigMetadata = {
id: uuidv4(), id: uuidv4(),