From 2d6119ff9e923a9cba36d977637c9075289cda95 Mon Sep 17 00:00:00 2001 From: Attila Cseh Date: Fri, 5 Sep 2025 13:21:07 +0200 Subject: [PATCH 1/2] LoRA number input min/max restored --- .../frontend/web/src/features/lora/components/LoRACard.tsx | 4 ++-- .../frontend/web/src/features/system/store/configSlice.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx b/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx index 9a1bac52807..90a8bc3edd9 100644 --- a/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx +++ b/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx @@ -80,7 +80,7 @@ const LoRAContent = memo(({ lora }: { lora: LoRA }) => { onChange={handleChange} min={DEFAULT_LORA_WEIGHT_CONFIG.sliderMin} max={DEFAULT_LORA_WEIGHT_CONFIG.sliderMax} - step={DEFAULT_LORA_WEIGHT_CONFIG.coarseStep} + step={DEFAULT_LORA_WEIGHT_CONFIG.fineStep} marks={DEFAULT_LORA_WEIGHT_CONFIG.marks.slice()} defaultValue={DEFAULT_LORA_WEIGHT_CONFIG.initial} isDisabled={!lora.isEnabled} @@ -90,7 +90,7 @@ const LoRAContent = memo(({ lora }: { lora: LoRA }) => { onChange={handleChange} min={DEFAULT_LORA_WEIGHT_CONFIG.numberInputMin} max={DEFAULT_LORA_WEIGHT_CONFIG.numberInputMax} - step={DEFAULT_LORA_WEIGHT_CONFIG.coarseStep} + step={DEFAULT_LORA_WEIGHT_CONFIG.fineStep} w={20} flexShrink={0} defaultValue={DEFAULT_LORA_WEIGHT_CONFIG.initial} diff --git a/invokeai/frontend/web/src/features/system/store/configSlice.ts b/invokeai/frontend/web/src/features/system/store/configSlice.ts index 914ff3043d5..93e732810d8 100644 --- a/invokeai/frontend/web/src/features/system/store/configSlice.ts +++ b/invokeai/frontend/web/src/features/system/store/configSlice.ts @@ -11,8 +11,8 @@ export const DEFAULT_LORA_WEIGHT_CONFIG = { sliderMin: -1, sliderMax: 2, marks: [-1, 0, 1, 2], - numberInputMin: -1, - numberInputMax: 2, + numberInputMin: -10, + numberInputMax: 10, fineStep: 0.01, coarseStep: 0.05, } as const; From 17785a33c0fff4150f51fbfc938a895a3892e911 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 9 Sep 2025 14:38:33 +1000 Subject: [PATCH 2/2] feat(ui): address feedback --- .../src/features/controlLayers/store/lorasSlice.ts | 12 +++++++++++- .../web/src/features/lora/components/LoRACard.tsx | 12 ++++++++---- .../hooks/useLoRAModelDefaultSettings.ts | 2 +- .../LoRAModelDefaultSettings/DefaultWeight.tsx | 6 ++++-- .../web/src/features/system/store/configSlice.ts | 14 ++------------ 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/invokeai/frontend/web/src/features/controlLayers/store/lorasSlice.ts b/invokeai/frontend/web/src/features/controlLayers/store/lorasSlice.ts index f8c00ce2ea5..dfde382fcab 100644 --- a/invokeai/frontend/web/src/features/controlLayers/store/lorasSlice.ts +++ b/invokeai/frontend/web/src/features/controlLayers/store/lorasSlice.ts @@ -1,14 +1,24 @@ import { createSelector, createSlice, type PayloadAction } from '@reduxjs/toolkit'; import type { RootState } from 'app/store/store'; import type { SliceConfig } from 'app/store/types'; +import type { NumericalParameterConfig } from 'app/types/invokeai'; import { paramsReset } from 'features/controlLayers/store/paramsSlice'; import { type LoRA, zLoRA } from 'features/controlLayers/store/types'; import { zModelIdentifierField } from 'features/nodes/types/common'; -import { DEFAULT_LORA_WEIGHT_CONFIG } from 'features/system/store/configSlice'; import type { LoRAModelConfig } from 'services/api/types'; import { v4 as uuidv4 } from 'uuid'; import z from 'zod'; +export const DEFAULT_LORA_WEIGHT_CONFIG: NumericalParameterConfig = { + initial: 0.75, + sliderMin: -1, + sliderMax: 2, + numberInputMin: -10, + numberInputMax: 10, + fineStep: 0.01, + coarseStep: 0.05, +}; + const zLoRAsState = z.object({ loras: z.array(zLoRA), }); diff --git a/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx b/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx index 90a8bc3edd9..89cbc37353c 100644 --- a/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx +++ b/invokeai/frontend/web/src/features/lora/components/LoRACard.tsx @@ -13,16 +13,18 @@ import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover'; import { buildSelectLoRA, + DEFAULT_LORA_WEIGHT_CONFIG, loraDeleted, loraIsEnabledChanged, loraWeightChanged, } from 'features/controlLayers/store/lorasSlice'; import type { LoRA } from 'features/controlLayers/store/types'; -import { DEFAULT_LORA_WEIGHT_CONFIG } from 'features/system/store/configSlice'; import { memo, useCallback, useMemo } from 'react'; import { PiTrashSimpleBold } from 'react-icons/pi'; import { useGetModelConfigQuery } from 'services/api/endpoints/models'; +const MARKS = [-1, 0, 1, 2]; + export const LoRACard = memo((props: { id: string }) => { const selectLoRA = useMemo(() => buildSelectLoRA(props.id), [props.id]); const lora = useAppSelector(selectLoRA); @@ -80,8 +82,9 @@ const LoRAContent = memo(({ lora }: { lora: LoRA }) => { onChange={handleChange} min={DEFAULT_LORA_WEIGHT_CONFIG.sliderMin} max={DEFAULT_LORA_WEIGHT_CONFIG.sliderMax} - step={DEFAULT_LORA_WEIGHT_CONFIG.fineStep} - marks={DEFAULT_LORA_WEIGHT_CONFIG.marks.slice()} + step={DEFAULT_LORA_WEIGHT_CONFIG.coarseStep} + fineStep={DEFAULT_LORA_WEIGHT_CONFIG.fineStep} + marks={MARKS} defaultValue={DEFAULT_LORA_WEIGHT_CONFIG.initial} isDisabled={!lora.isEnabled} /> @@ -90,7 +93,8 @@ const LoRAContent = memo(({ lora }: { lora: LoRA }) => { onChange={handleChange} min={DEFAULT_LORA_WEIGHT_CONFIG.numberInputMin} max={DEFAULT_LORA_WEIGHT_CONFIG.numberInputMax} - step={DEFAULT_LORA_WEIGHT_CONFIG.fineStep} + step={DEFAULT_LORA_WEIGHT_CONFIG.coarseStep} + fineStep={DEFAULT_LORA_WEIGHT_CONFIG.fineStep} w={20} flexShrink={0} defaultValue={DEFAULT_LORA_WEIGHT_CONFIG.initial} diff --git a/invokeai/frontend/web/src/features/modelManagerV2/hooks/useLoRAModelDefaultSettings.ts b/invokeai/frontend/web/src/features/modelManagerV2/hooks/useLoRAModelDefaultSettings.ts index 26f86149aa3..6231b199af4 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/hooks/useLoRAModelDefaultSettings.ts +++ b/invokeai/frontend/web/src/features/modelManagerV2/hooks/useLoRAModelDefaultSettings.ts @@ -1,5 +1,5 @@ import { isNil } from 'es-toolkit/compat'; -import { DEFAULT_LORA_WEIGHT_CONFIG } from 'features/system/store/configSlice'; +import { DEFAULT_LORA_WEIGHT_CONFIG } from 'features/controlLayers/store/lorasSlice'; import { useMemo } from 'react'; import type { LoRAModelConfig } from 'services/api/types'; diff --git a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/LoRAModelDefaultSettings/DefaultWeight.tsx b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/LoRAModelDefaultSettings/DefaultWeight.tsx index 8f1ca4791ff..c26ce38c671 100644 --- a/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/LoRAModelDefaultSettings/DefaultWeight.tsx +++ b/invokeai/frontend/web/src/features/modelManagerV2/subpanels/ModelPanel/LoRAModelDefaultSettings/DefaultWeight.tsx @@ -1,7 +1,7 @@ import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library'; import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover'; +import { DEFAULT_LORA_WEIGHT_CONFIG } from 'features/controlLayers/store/lorasSlice'; import { SettingToggle } from 'features/modelManagerV2/subpanels/ModelPanel/SettingToggle'; -import { DEFAULT_LORA_WEIGHT_CONFIG } from 'features/system/store/configSlice'; import { memo, useCallback, useMemo } from 'react'; import type { UseControllerProps } from 'react-hook-form'; import { useController } from 'react-hook-form'; @@ -9,6 +9,8 @@ import { useTranslation } from 'react-i18next'; import type { LoRAModelDefaultSettingsFormData } from './LoRAModelDefaultSettings'; +const MARKS = [-1, 0, 1, 2]; + type DefaultWeight = LoRAModelDefaultSettingsFormData['weight']; export const DefaultWeight = memo((props: UseControllerProps) => { @@ -51,7 +53,7 @@ export const DefaultWeight = memo((props: UseControllerProps