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
refactor(webv2): move Upscale parameters to ScrubberField
Josh Corbett64b88f4b1a23
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex 96c8f38457..558ebf6456 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -757,13 +757,6 @@"An image size (in number of pixels) equivalent to 512x512 is recommended for SD1.5 models and a size equivalent to 1024x1024 is recommended for SDXL models."]},- "batchCount": {- "heading": "Iterations",- "paragraphs": [- "The number of images to generate.",- "If Dynamic Prompts is enabled, each of the prompts will be generated this many times."- ]- },"cfgRescale": {"heading": "CFG Rescale Multiplier","paragraphs": [@@ -2359,7 +2352,6 @@"upscale": {"addLora": "LoRAs","advanced": "Advanced",- "batchCount": "Batch count","bundledVae": "Bundled VAE","cfgScale": "CFG scale","clipSkip": "CLIP skip",diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsxindex e1ae5ebed8..5605da3dca 100644--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx@@ -49,7 +49,7 @@ import {} from '@features/upscale/core/settings';import { useMountEffect } from '@platform/react/useMountEffect';import { Combobox, Field, IconButton, Select, Tooltip } from '@platform/ui';-import { SliderNumberField } from '@platform/ui/SliderNumberField';+import { ScrubberField } from '@platform/ui/ScrubberField';import { toaster } from '@platform/ui/toaster';import { DicesIcon } from 'lucide-react';import { memo, useCallback, useId, useMemo } from 'react';@@ -92,7 +92,9 @@ const STRUCTURE_MARKS = [UPSCALE_STRUCTURE_MIN, 0, UPSCALE_STRUCTURE_MAX];const TILE_SIZE_MARKS = [UPSCALE_TILE_SIZE_MIN, 1024, UPSCALE_TILE_SIZE_MAX];const TILE_OVERLAP_MARKS = [UPSCALE_TILE_OVERLAP_MIN, 128, 256, UPSCALE_TILE_OVERLAP_MAX];-const GENERATION_GRID_COLUMNS = { base: 2, md: 3 };+/** Scrub ranges cover everyday values; typing still reaches the validated bounds. */+const STEPS_SLIDER_MAX = 100;+const CFG_SLIDER_MAX = 20;const ADVANCED_GRID_COLUMNS = { base: 1, md: 2 };const SWITCH_CHECKED_PROPS = { bg: 'accent.solid' };const PRESET_ENTRIES = Object.entries(UPSCALE_PRESETS);@@ -378,12 +380,8 @@ export const UpscaleWidgetView = () => {// `onChange={(x) => patch({ x })}` props would defeat every `memo` below.const set = useMemo(() => ({- batchCount: ({ valueAsNumber }: NumberInput.ValueChangeDetails) =>- Number.isFinite(valueAsNumber) && patch({ batchCount: valueAsNumber }),- cfgScale: ({ valueAsNumber }: NumberInput.ValueChangeDetails) =>- Number.isFinite(valueAsNumber) && patch({ cfgScale: valueAsNumber }),- clipSkip: ({ valueAsNumber }: NumberInput.ValueChangeDetails) =>- Number.isFinite(valueAsNumber) && patch({ clipSkip: valueAsNumber }),+ cfgScale: (cfgScale: number) => patch({ cfgScale }),+ clipSkip: (clipSkip: number) => patch({ clipSkip }),creativity: (creativity: number) => patch({ creativity }),inputImage: (inputImage: UpscaleWidgetValues['inputImage']) => patch({ inputImage }),randomizeSeed: (details: { checked: boolean }) => patch({ shouldRandomizeSeed: details.checked }),@@ -394,8 +392,7 @@ export const UpscaleWidgetView = () => {shuffleSeed: () => patch({ seed: Math.floor(Math.random() * SEED_MAX) }),spandrelModel: (model: ModelConfig | null) =>patch({ upscaleModel: isSpandrelModelConfig(model) ? model : null }),- steps: ({ valueAsNumber }: NumberInput.ValueChangeDetails) =>- Number.isFinite(valueAsNumber) && patch({ steps: valueAsNumber }),+ steps: (steps: number) => patch({ steps }),structure: (structure: number) => patch({ structure }),tileOverlap: (tileOverlap: number) => patch({ tileOverlap }),tileSize: (tileSize: number) => patch({ tileSize }),@@ -469,24 +466,19 @@ export const UpscaleWidgetView = () => {onChange={set.spandrelModel}/></Field>- <Field+ <ScrubberFielderror={errors.scale}+ formatValue={formatScale}helpText={t('widgets.upscale.scaleHelp')}hint="upscaleScale"label={t('widgets.upscale.scale')}- >- <SliderNumberField- ariaLabel={t('widgets.upscale.scale')}- formatValue={formatScale}- marks={SCALE_MARKS}- max={UPSCALE_SCALE_MAX}- min={UPSCALE_SCALE_MIN}- showStepper- step={0.5}- value={values.scale}- onChange={set.scale}- />- </Field>+ marks={SCALE_MARKS}+ max={UPSCALE_SCALE_MAX}+ min={UPSCALE_SCALE_MIN}+ step={0.5}+ value={values.scale}+ onChange={set.scale}+ /><SegmentGroup.Rootaria-label={t('widgets.upscale.presetsLabel')}size="xs"@@ -514,40 +506,30 @@ export const UpscaleWidgetView = () => {);})}</SegmentGroup.Root>- <Field+ <ScrubberFielderror={errors.creativity}helpText={t('widgets.upscale.creativityHelp')}hint="creativity"label={t('widgets.upscale.creativity')}- >- <SliderNumberField- ariaLabel={t('widgets.upscale.creativity')}- marks={CREATIVITY_MARKS}- max={UPSCALE_CREATIVITY_MAX}- min={UPSCALE_CREATIVITY_MIN}- showStepper- step={1}- value={values.creativity}- onChange={set.creativity}- />- </Field>- <Field+ marks={CREATIVITY_MARKS}+ max={UPSCALE_CREATIVITY_MAX}+ min={UPSCALE_CREATIVITY_MIN}+ step={1}+ value={values.creativity}+ onChange={set.creativity}+ />+ <ScrubberFielderror={errors.structure}helpText={t('widgets.upscale.structureHelp')}hint="structure"label={t('widgets.upscale.structure')}- >- <SliderNumberField- ariaLabel={t('widgets.upscale.structure')}- marks={STRUCTURE_MARKS}- max={UPSCALE_STRUCTURE_MAX}- min={UPSCALE_STRUCTURE_MIN}- showStepper- step={1}- value={values.structure}- onChange={set.structure}- />- </Field>+ marks={STRUCTURE_MARKS}+ max={UPSCALE_STRUCTURE_MAX}+ min={UPSCALE_STRUCTURE_MIN}+ step={1}+ value={values.structure}+ onChange={set.structure}+ /></Stack></GenerationSettingsSection>@@ -582,33 +564,29 @@ export const UpscaleWidgetView = () => {onChange={selectMainModel}/></Field>- <SimpleGrid columns={GENERATION_GRID_COLUMNS} gap="2">- <Field error={errors.steps} hint="steps" label={t('widgets.upscale.steps')}>- <NumberInput.Root max={1000} min={1} size="xs" value={String(values.steps)} onValueChange={set.steps}>- <NumberInput.Control />- <NumberInput.Input fontVariantNumeric="tabular-nums" />- </NumberInput.Root>- </Field>- <Field error={errors.cfgScale} hint="cfgScale" label={t('widgets.upscale.cfgScale')}>- <NumberInput.Root- max={100}- min={0}- size="xs"- step={0.5}- value={String(values.cfgScale)}- onValueChange={set.cfgScale}- >- <NumberInput.Control />- <NumberInput.Input fontVariantNumeric="tabular-nums" />- </NumberInput.Root>- </Field>- <Field hint="batchCount" label={t('widgets.upscale.batchCount')}>- <NumberInput.Root min={1} size="xs" value={String(values.batchCount)} onValueChange={set.batchCount}>- <NumberInput.Control />- <NumberInput.Input fontVariantNumeric="tabular-nums" />- </NumberInput.Root>- </Field>- </SimpleGrid>+ {/* Iterations live in the top bar's invoke cluster, which edits this widget's batch count directly. */}+ <ScrubberField+ error={errors.steps}+ hint="steps"+ inputMax={1000}+ label={t('widgets.upscale.steps')}+ max={STEPS_SLIDER_MAX}+ min={1}+ step={1}+ value={values.steps}+ onChange={set.steps}+ />+ <ScrubberField+ error={errors.cfgScale}+ hint="cfgScale"+ inputMax={100}+ label={t('widgets.upscale.cfgScale')}+ max={CFG_SLIDER_MAX}+ min={0}+ step={0.5}+ value={values.cfgScale}+ onChange={set.cfgScale}+ /><Field hint="scheduler" label={t('widgets.upscale.scheduler')}><Comboboxaria-label={t('widgets.upscale.scheduler')}@@ -695,40 +673,30 @@ export const UpscaleWidgetView = () => {onChange={setTileControlNet}/></Field>- <Field+ <ScrubberFielderror={errors.tileSize}helpText={t('widgets.upscale.tileSizeHelp')}hint="tileSize"label={t('widgets.upscale.tileSize')}- >- <SliderNumberField- ariaLabel={t('widgets.upscale.tileSize')}- marks={TILE_SIZE_MARKS}- max={UPSCALE_TILE_SIZE_MAX}- min={UPSCALE_TILE_SIZE_MIN}- showStepper- step={64}- value={values.tileSize}- onChange={set.tileSize}- />- </Field>- <Field+ marks={TILE_SIZE_MARKS}+ max={UPSCALE_TILE_SIZE_MAX}+ min={UPSCALE_TILE_SIZE_MIN}+ step={64}+ value={values.tileSize}+ onChange={set.tileSize}+ />+ <ScrubberFielderror={errors.tileOverlap}helpText={t('widgets.upscale.tileOverlapHelp')}hint="tileOverlap"label={t('widgets.upscale.tileOverlap')}- >- <SliderNumberField- ariaLabel={t('widgets.upscale.tileOverlap')}- marks={TILE_OVERLAP_MARKS}- max={UPSCALE_TILE_OVERLAP_MAX}- min={UPSCALE_TILE_OVERLAP_MIN}- showStepper- step={8}- value={values.tileOverlap}- onChange={set.tileOverlap}- />- </Field>+ marks={TILE_OVERLAP_MARKS}+ max={UPSCALE_TILE_OVERLAP_MAX}+ min={UPSCALE_TILE_OVERLAP_MIN}+ step={8}+ value={values.tileOverlap}+ onChange={set.tileOverlap}+ /><SimpleGrid columns={ADVANCED_GRID_COLUMNS} gap="2"><Fieldhint="vae"@@ -756,12 +724,15 @@ export const UpscaleWidgetView = () => {</Field></SimpleGrid>{values.model?.base === 'sd-1' ? (- <Field hint="clipSkip" label={t('widgets.upscale.clipSkip')}>- <NumberInput.Root max={12} min={0} size="xs" value={String(values.clipSkip)} onValueChange={set.clipSkip}>- <NumberInput.Control />- <NumberInput.Input fontVariantNumeric="tabular-nums" />- </NumberInput.Root>- </Field>+ <ScrubberField+ hint="clipSkip"+ label={t('widgets.upscale.clipSkip')}+ max={12}+ min={0}+ step={1}+ value={values.clipSkip}+ onChange={set.clipSkip}+ />) : null}</Stack></GenerationSettingsSection>diff --git a/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.ts b/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.tsindex da628ac754..d2a2d42e0d 100644--- a/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.ts+++ b/invokeai/frontend/webv2/src/platform/ui/hints/hintRegistry.ts@@ -26,7 +26,6 @@ const SUPPORT_CONCEPTS = 'https://support.invoke.ai/support/solutions/articles/1*/export const FEATURE_HINTS = {aspectRatio: {},- batchCount: { href: 'https://support.invoke.ai/support/solutions/articles/151000159073' },cfgRescale: { href: SUPPORT_ADVANCED_SETTINGS },cfgScale: { href: 'https://www.youtube.com/watch?v=1OeHEJrsTpI' },clipSkip: { href: SUPPORT_ADVANCED_SETTINGS },