Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(canvas): align control adapter defaults
joshistoast7a58a5d5148a
diff --git a/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.test.ts b/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.test.tsindex 9b880e2944..c49f809fac 100644--- a/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.test.ts+++ b/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.test.ts@@ -114,13 +114,14 @@ describe('getFilterNumberBounds', () => {expect(getFilterNumberBounds(param, settings)).toEqual(expected);});- it('changes adjust value bounds with scale_values', () => {+ it('keeps independent legacy adjust slider and numeric bounds in both modes', () => {const param = getFilterDefinition('adjust_image')?.params.find((candidate) => candidate.key === 'value');if (param?.kind !== 'number') {throw new Error('Missing adjust_image.value');}- expect(getFilterNumberBounds(param, { scale_values: false })).toMatchObject({ inputMax: 2, sliderMax: 2 });- expect(getFilterNumberBounds(param, { scale_values: true })).toMatchObject({ inputMax: 255, sliderMax: 255 });+ const expected = { inputMax: 255, inputMin: 0, sliderMax: 2, sliderMin: 0, step: 0.0025 };+ expect(getFilterNumberBounds(param, { scale_values: false })).toEqual(expected);+ expect(getFilterNumberBounds(param, { scale_values: true })).toEqual(expected);});});diff --git a/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.ts b/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.tsindex 47479a40aa..65db2a0299 100644--- a/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.ts+++ b/invokeai/frontend/webv2/src/workbench/generation/canvas/filterGraphs.ts@@ -33,7 +33,6 @@ export type FilterParamSpec =sliderMin?: number;sliderMax?: number;coerceMin?: number;- dynamicBounds?: 'adjust_value';}| { kind: 'boolean'; key: string; default: boolean }| {@@ -164,7 +163,7 @@ export const CONTROL_FILTERS: readonly FilterDefinition[] = [{ labelKey: 'widgets.layers.control.filterOptions.channel.cr', value: 'Cr (YCbCr)' },],},- { default: 1, dynamicBounds: 'adjust_value', key: 'value', kind: 'number', max: 255, min: 0, step: 0.0025 },+ { default: 1, key: 'value', kind: 'number', max: 255, min: 0, sliderMax: 2, step: 0.0025 },{ default: false, key: 'scale_values', kind: 'boolean' },],type: 'adjust_image',@@ -237,16 +236,15 @@ export interface FilterNumberBounds {step: number;}-/** Resolves legacy slider/input ranges, including adjust_image's mode-dependent value maximum. */+/** Resolves independently declared legacy slider and numeric-input ranges. */export const getFilterNumberBounds = (param: Extract<FilterParamSpec, { kind: 'number' }>,- settings: Record<string, unknown>+ _settings: Record<string, unknown>): FilterNumberBounds => {- const dynamicMax = param.dynamicBounds === 'adjust_value' && settings.scale_values !== true ? 2 : param.max;return {- inputMax: dynamicMax,+ inputMax: param.max,inputMin: param.min,- sliderMax: param.dynamicBounds === 'adjust_value' ? dynamicMax : (param.sliderMax ?? dynamicMax),+ sliderMax: param.sliderMax ?? param.max,sliderMin: param.sliderMin ?? param.min,step: param.step,};@@ -369,7 +367,7 @@ export const buildFilterGraph = (: {...node,channel,- offset: Math.round(255 * ((value as number) - 1)),+ offset: Math.round(255 * (Math.min(value as number, 2) - 1)),scale_values: undefined,type: 'img_channel_offset',value: undefined,diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.test.tsindex 5ff17e8f5b..fdbc8bb8e0 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.test.ts@@ -302,7 +302,7 @@ describe('nextInpaintMaskName', () => {describe('createControlLayer', () => {it('centralizes legacy defaults for every adapter kind', () => {expect(CONTROL_ADAPTER_DEFAULTS).toEqual({- control_lora: { beginEndStepPct: [0, 0.75], controlMode: null, kind: 'control_lora', model: null, weight: 0.75 },+ control_lora: { beginEndStepPct: [0, 1], controlMode: null, kind: 'control_lora', model: null, weight: 0.75 },controlnet: {beginEndStepPct: [0, 0.75],controlMode: 'balanced',@@ -310,7 +310,7 @@ describe('createControlLayer', () => {model: null,weight: 0.75,},- t2i_adapter: { beginEndStepPct: [0, 0.75], controlMode: null, kind: 't2i_adapter', model: null, weight: 0.75 },+ t2i_adapter: { beginEndStepPct: [0, 1], controlMode: null, kind: 't2i_adapter', model: null, weight: 1 },});});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.tsindex 4e3be492fe..7151a11ba9 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts@@ -294,7 +294,7 @@ export const CONTROL_ADAPTER_DEFAULTS: Readonly<Record<CanvasControlAdapterContract['kind'], CanvasControlAdapterContract>> = {control_lora: {- beginEndStepPct: [0, 0.75],+ beginEndStepPct: [0, 1],controlMode: null,kind: 'control_lora',model: null,@@ -308,11 +308,11 @@ export const CONTROL_ADAPTER_DEFAULTS: Readonly<weight: 0.75,},t2i_adapter: {- beginEndStepPct: [0, 0.75],+ beginEndStepPct: [0, 1],controlMode: null,kind: 't2i_adapter',model: null,- weight: 0.75,+ weight: 1,},};