fix(ui): rebase conflicts

This commit is contained in:
psychedelicious 2024-08-17 08:39:10 +10:00
parent 506d3b079e
commit 29ac1b5e01
8 changed files with 14 additions and 19 deletions

View File

@ -1,8 +1,8 @@
import type { AppStore, AppThunkDispatch, RootState } from 'app/store/store';
import type { AppThunkDispatch, RootState } from 'app/store/store';
import type { TypedUseSelectorHook } from 'react-redux';
import {useDispatch, useSelector, useStore } from 'react-redux';
// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch = () => useDispatch<AppThunkDispatch>();
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
export const useAppStore = () => useStore<AppStore>();
export const useAppStore = () => useStore<RootState>();

View File

@ -40,9 +40,7 @@ export const AddPromptButtons = ({ id }: AddPromptButtonProps) => {
dispatch(rgNegativePromptChanged({ id, prompt: '' }));
}, [dispatch, id]);
const addIPAdapter = useCallback(() => {
dispatch(
rgIPAdapterAdded({ id, ipAdapter: { ...defaultIPAdapter, id: nanoid(), type: 'ip_adapter', isEnabled: true } })
);
dispatch(rgIPAdapterAdded({ id, ipAdapter: { ...defaultIPAdapter, id: nanoid() } }));
}, [defaultIPAdapter, dispatch, id]);
return (

View File

@ -13,9 +13,9 @@ export const useEntitySelectionColor = (entityIdentifier: CanvasEntityIdentifier
if (!entity) {
return 'base.400';
} else if (entity.type === 'inpaint_mask') {
return rgbColorToString(entity.fill);
return rgbColorToString(entity.fill.color);
} else if (entity.type === 'regional_guidance') {
return rgbColorToString(entity.fill);
return rgbColorToString(entity.fill.color);
} else {
return 'base.400';
}

View File

@ -12,12 +12,10 @@ import { pick } from 'lodash-es';
export const bboxReducers = {
bboxScaledSizeChanged: (state, action: PayloadAction<Partial<Dimensions>>) => {
state.rasterLayers.imageCache = null;
state.bbox.scaledSize = { ...state.bbox.scaledSize, ...action.payload };
},
bboxScaleMethodChanged: (state, action: PayloadAction<BoundingBoxScaleMethod>) => {
state.bbox.scaleMethod = action.payload;
state.rasterLayers.imageCache = null;
if (action.payload === 'auto') {
const optimalDimension = getOptimalDimension(state.params.model);
@ -27,7 +25,6 @@ export const bboxReducers = {
},
bboxChanged: (state, action: PayloadAction<IRect>) => {
state.bbox.rect = action.payload;
state.rasterLayers.imageCache = null;
if (state.bbox.scaleMethod === 'auto') {
const optimalDimension = getOptimalDimension(state.params.model);

View File

@ -27,7 +27,7 @@ import { addSeamless } from 'features/nodes/util/graph/generation/addSeamless';
import { addTextToImage } from 'features/nodes/util/graph/generation/addTextToImage';
import { addWatermarker } from 'features/nodes/util/graph/generation/addWatermarker';
import { Graph } from 'features/nodes/util/graph/generation/Graph';
import { getBoardField, getSDXLStylePrompts, getSizes } from 'features/nodes/util/graph/graphBuilderUtils';
import { getBoardField, getPresetModifiedPrompts, getSizes } from 'features/nodes/util/graph/graphBuilderUtils';
import type { Invocation } from 'services/api/types';
import { isNonRefinerMainModelConfig } from 'services/api/types';
import { assert } from 'tsafe';
@ -61,7 +61,7 @@ export const buildSDXLGraph = async (state: RootState, manager: CanvasManager):
const { originalSize, scaledSize } = getSizes(bbox);
const { positiveStylePrompt, negativeStylePrompt } = getSDXLStylePrompts(state);
const { positiveStylePrompt, negativeStylePrompt } = getPresetModifiedPrompts(state);
const g = new Graph(SDXL_CONTROL_LAYERS_GRAPH);
const modelLoader = g.addNode({

View File

@ -1,18 +1,17 @@
import { Flex } from '@invoke-ai/ui-library';
import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store/storeHooks';
import { selectControlLayersSlice } from 'features/controlLayers/store/controlLayersSlice';
import { selectCanvasV2Slice } from 'features/controlLayers/store/canvasV2Slice';
import { ParamNegativePrompt } from 'features/parameters/components/Core/ParamNegativePrompt';
import { ParamPositivePrompt } from 'features/parameters/components/Core/ParamPositivePrompt';
import { selectGenerationSlice } from 'features/parameters/store/generationSlice';
import { ParamSDXLNegativeStylePrompt } from 'features/sdxl/components/SDXLPrompts/ParamSDXLNegativeStylePrompt';
import { ParamSDXLPositiveStylePrompt } from 'features/sdxl/components/SDXLPrompts/ParamSDXLPositiveStylePrompt';
import { memo } from 'react';
const concatPromptsSelector = createSelector(
[selectGenerationSlice, selectControlLayersSlice],
(generation, controlLayers) => {
return generation.model?.base !== 'sdxl' || controlLayers.present.shouldConcatPrompts;
[selectCanvasV2Slice],
(canvasV2) => {
return canvasV2.params.model?.base !== 'sdxl' || canvasV2.params.shouldConcatPrompts;
}
);

View File

@ -1,6 +1,6 @@
import { Badge, Flex, IconButton, Spacer, Text, Tooltip } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { negativePromptChanged, positivePromptChanged } from 'features/controlLayers/store/controlLayersSlice';
import { negativePromptChanged, positivePromptChanged } from 'features/controlLayers/store/canvasV2Slice';
import { usePresetModifiedPrompts } from 'features/stylePresets/hooks/usePresetModifiedPrompts';
import { activeStylePresetIdChanged, viewModeChanged } from 'features/stylePresets/store/stylePresetSlice';
import type { MouseEventHandler } from 'react';

View File

@ -10,7 +10,8 @@ export const buildPresetModifiedPrompt = (presetPrompt: string, currentPrompt: s
};
export const usePresetModifiedPrompts = () => {
const { positivePrompt, negativePrompt } = useAppSelector((s) => s.canvasV2.prompts);
const positivePrompt = useAppSelector((s) => s.canvasV2.params.positivePrompt);
const negativePrompt = useAppSelector((s) => s.canvasV2.params.negativePrompt);
const activeStylePresetId = useAppSelector((s) => s.stylePreset.activeStylePresetId);