fix(ui): move lora followup fixes

This commit is contained in:
psychedelicious 2024-06-17 12:33:35 +10:00
parent ca9314e077
commit 396d0a4bc0
6 changed files with 12 additions and 13 deletions

View File

@ -2,8 +2,7 @@ import { getStore } from 'app/store/nanostores/store';
import { deepClone } from 'common/util/deepClone'; import { deepClone } from 'common/util/deepClone';
import { objectKeys } from 'common/util/objectKeys'; import { objectKeys } from 'common/util/objectKeys';
import { shouldConcatPromptsChanged } from 'features/controlLayers/store/canvasV2Slice'; import { shouldConcatPromptsChanged } from 'features/controlLayers/store/canvasV2Slice';
import type { LayerData } from 'features/controlLayers/store/types'; import type { LayerData, LoRA } from 'features/controlLayers/store/types';
import type { LoRA } from 'features/lora/store/loraSlice';
import type { import type {
AnyControlAdapterConfigMetadata, AnyControlAdapterConfigMetadata,
BuildMetadataHandlers, BuildMetadataHandlers,

View File

@ -1,5 +1,6 @@
import { getCAId, getImageObjectId, getIPAId, getLayerId } from 'features/controlLayers/konva/naming'; import { getCAId, getImageObjectId, getIPAId, getLayerId } from 'features/controlLayers/konva/naming';
import type { ControlAdapterData, IPAdapterData, LayerData } from 'features/controlLayers/store/types'; import { defaultLoRAConfig } from 'features/controlLayers/store/lorasReducers';
import type { ControlAdapterData, IPAdapterData, LayerData, LoRA } from 'features/controlLayers/store/types';
import { import {
CA_PROCESSOR_DATA, CA_PROCESSOR_DATA,
imageDTOToImageWithDims, imageDTOToImageWithDims,
@ -9,8 +10,6 @@ import {
isProcessorTypeV2, isProcessorTypeV2,
zLayerData, zLayerData,
} from 'features/controlLayers/store/types'; } from 'features/controlLayers/store/types';
import type { LoRA } from 'features/lora/store/loraSlice';
import { defaultLoRAConfig } from 'features/lora/store/loraSlice';
import type { import type {
ControlNetConfigMetadata, ControlNetConfigMetadata,
IPAdapterConfigMetadata, IPAdapterConfigMetadata,

View File

@ -16,6 +16,8 @@ import {
ipaRecalled, ipaRecalled,
layerAllDeleted, layerAllDeleted,
layerRecalled, layerRecalled,
loraAllDeleted,
loraRecalled,
negativePrompt2Changed, negativePrompt2Changed,
negativePromptChanged, negativePromptChanged,
positivePrompt2Changed, positivePrompt2Changed,
@ -41,11 +43,10 @@ import type {
ControlAdapterData, ControlAdapterData,
IPAdapterData, IPAdapterData,
LayerData, LayerData,
LoRA,
RegionalGuidanceData, RegionalGuidanceData,
} from 'features/controlLayers/store/types'; } from 'features/controlLayers/store/types';
import { setHrfEnabled, setHrfMethod, setHrfStrength } from 'features/hrf/store/hrfSlice'; import { setHrfEnabled, setHrfMethod, setHrfStrength } from 'features/hrf/store/hrfSlice';
import type { LoRA } from 'features/lora/store/loraSlice';
import { loraRecalled, lorasReset } from 'features/lora/store/loraSlice';
import type { import type {
ControlNetConfigMetadata, ControlNetConfigMetadata,
IPAdapterConfigMetadata, IPAdapterConfigMetadata,
@ -186,17 +187,17 @@ const recallVAE: MetadataRecallFunc<ParameterVAEModel | null | undefined> = (vae
}; };
const recallLoRA: MetadataRecallFunc<LoRA> = (lora) => { const recallLoRA: MetadataRecallFunc<LoRA> = (lora) => {
getStore().dispatch(loraRecalled(lora)); getStore().dispatch(loraRecalled({ lora }));
}; };
const recallAllLoRAs: MetadataRecallFunc<LoRA[]> = (loras) => { const recallAllLoRAs: MetadataRecallFunc<LoRA[]> = (loras) => {
const { dispatch } = getStore(); const { dispatch } = getStore();
dispatch(lorasReset()); dispatch(loraAllDeleted());
if (!loras.length) { if (!loras.length) {
return; return;
} }
loras.forEach((lora) => { loras.forEach((lora) => {
dispatch(loraRecalled(lora)); dispatch(loraRecalled({ lora }));
}); });
}; };

View File

@ -1,6 +1,5 @@
import { getStore } from 'app/store/nanostores/store'; import { getStore } from 'app/store/nanostores/store';
import type { LayerData } from 'features/controlLayers/store/types'; import type { LayerData, LoRA } from 'features/controlLayers/store/types';
import type { LoRA } from 'features/lora/store/loraSlice';
import type { import type {
ControlNetConfigMetadata, ControlNetConfigMetadata,
IPAdapterConfigMetadata, IPAdapterConfigMetadata,

View File

@ -18,7 +18,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel
const { t } = useTranslation(); const { t } = useTranslation();
const mainModel = useAppSelector((s) => s.canvasV2.params.model); const mainModel = useAppSelector((s) => s.canvasV2.params.model);
const addedLoRAs = useAppSelector((s) => s.lora.loras); const addedLoRAs = useAppSelector((s) => s.canvasV2.loras);
const { data: mainModelConfig, isLoading: isLoadingMainModelConfig } = useGetModelConfigQuery( const { data: mainModelConfig, isLoading: isLoadingMainModelConfig } = useGetModelConfigQuery(
mainModel?.key ?? skipToken mainModel?.key ?? skipToken
); );

View File

@ -38,6 +38,7 @@ export const useClearIntermediates = (shouldShowClearIntermediates: boolean): Us
_clearIntermediates() _clearIntermediates()
.unwrap() .unwrap()
.then((clearedCount) => { .then((clearedCount) => {
// TODO(psyche): Do we need to reset things w/ canvas v2?
// dispatch(controlAdaptersReset()); // dispatch(controlAdaptersReset());
// dispatch(resetCanvas()); // dispatch(resetCanvas());
toast({ toast({