Skip to content

Commit

Permalink
feat(ui): use control adapter processor helper in metadata parser
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Mar 8, 2024
1 parent 4ef105b commit 2e43b8a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions invokeai/frontend/web/src/features/metadata/util/parsers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { CONTROLNET_PROCESSORS } from 'features/controlAdapters/store/constants';
import { isControlAdapterProcessorType } from 'features/controlAdapters/store/types';
import {
initialControlNet,
initialIPAdapter,
initialT2IAdapter,
} from 'features/controlAdapters/util/buildControlAdapter';
import { buildControlAdapterProcessor } from 'features/controlAdapters/util/buildControlAdapterProcessor';
import type { LoRA } from 'features/lora/store/loraSlice';
import { defaultLoRAConfig } from 'features/lora/store/loraSlice';
import type {
Expand Down Expand Up @@ -254,9 +253,7 @@ const parseControlNet: MetadataParseFunc<ControlNetConfigMetadata> = async (meta
.catch(null)
.parse(getProperty(metadataItem, 'resize_mode'));

const defaultPreprocessor = controlNetModel.default_settings?.preprocessor;
const processorType = isControlAdapterProcessorType(defaultPreprocessor) ? defaultPreprocessor : 'none';
const processorNode = CONTROLNET_PROCESSORS[processorType].default;
const { processorType, processorNode } = buildControlAdapterProcessor(controlNetModel);

const controlNet: ControlNetConfigMetadata = {
type: 'controlnet',
Expand Down Expand Up @@ -307,9 +304,7 @@ const parseT2IAdapter: MetadataParseFunc<T2IAdapterConfigMetadata> = async (meta
.catch(null)
.parse(getProperty(metadataItem, 'resize_mode'));

const defaultPreprocessor = t2iAdapterModel.default_settings?.preprocessor;
const processorType = isControlAdapterProcessorType(defaultPreprocessor) ? defaultPreprocessor : 'none';
const processorNode = CONTROLNET_PROCESSORS[processorType].default;
const { processorType, processorNode } = buildControlAdapterProcessor(t2iAdapterModel);

const t2iAdapter: T2IAdapterConfigMetadata = {
type: 't2i_adapter',
Expand Down

0 comments on commit 2e43b8a

Please sign in to comment.