mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Make Embedding Picker a mini toggle
This commit is contained in:
parent
a556bf45bb
commit
9204b72383
@ -1,13 +1,18 @@
|
|||||||
import { Flex } from '@chakra-ui/react';
|
import { Flex } from '@chakra-ui/react';
|
||||||
import IAICollapse from 'common/components/IAICollapse';
|
import { RootState } from 'app/store/store';
|
||||||
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import ParamEmbeddingSelect from './ParamEmbeddingSelect';
|
import ParamEmbeddingSelect from './ParamEmbeddingSelect';
|
||||||
|
|
||||||
export default function ParamEmbeddingCollapse() {
|
export default function ParamEmbeddingCollapse() {
|
||||||
|
const shouldShowEmbeddingPicker = useAppSelector(
|
||||||
|
(state: RootState) => state.ui.shouldShowEmbeddingPicker
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IAICollapse label="Embeddings">
|
shouldShowEmbeddingPicker && (
|
||||||
<Flex sx={{ flexDir: 'column', gap: 2 }}>
|
<Flex sx={{ flexDir: 'column', gap: 2 }}>
|
||||||
<ParamEmbeddingSelect />
|
<ParamEmbeddingSelect />
|
||||||
</Flex>
|
</Flex>
|
||||||
</IAICollapse>
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,15 @@ import {
|
|||||||
} from 'features/parameters/store/generationSlice';
|
} from 'features/parameters/store/generationSlice';
|
||||||
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
|
import { activeTabNameSelector } from 'features/ui/store/uiSelectors';
|
||||||
|
|
||||||
|
import { userInvoked } from 'app/store/actions';
|
||||||
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
|
import IAITextarea from 'common/components/IAITextarea';
|
||||||
|
import { useIsReadyToInvoke } from 'common/hooks/useIsReadyToInvoke';
|
||||||
|
import { toggleEmbeddingPicker } from 'features/ui/store/uiSlice';
|
||||||
import { isEqual } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { userInvoked } from 'app/store/actions';
|
import { BiCode } from 'react-icons/bi';
|
||||||
import IAITextarea from 'common/components/IAITextarea';
|
|
||||||
import { useIsReadyToInvoke } from 'common/hooks/useIsReadyToInvoke';
|
|
||||||
|
|
||||||
const promptInputSelector = createSelector(
|
const promptInputSelector = createSelector(
|
||||||
[(state: RootState) => state.generation, activeTabNameSelector],
|
[(state: RootState) => state.generation, activeTabNameSelector],
|
||||||
@ -68,8 +71,21 @@ const ParamPositiveConditioning = () => {
|
|||||||
[dispatch, activeTabName, isReady]
|
[dispatch, activeTabName, isReady]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const shouldShowEmbeddingPicker = useAppSelector(
|
||||||
|
(state: RootState) => state.ui.shouldShowEmbeddingPicker
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
|
<IAIIconButton
|
||||||
|
size="xs"
|
||||||
|
aria-label="Toggle Embedding Picker"
|
||||||
|
tooltip="Toggle Embedding Picker"
|
||||||
|
icon={<BiCode />}
|
||||||
|
sx={{ position: 'absolute', top: 8, right: 2, zIndex: 2 }}
|
||||||
|
isChecked={shouldShowEmbeddingPicker}
|
||||||
|
onClick={() => dispatch(toggleEmbeddingPicker())}
|
||||||
|
></IAIIconButton>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<IAITextarea
|
<IAITextarea
|
||||||
id="prompt"
|
id="prompt"
|
||||||
|
@ -17,9 +17,9 @@ const ImageToImageTabParameters = () => {
|
|||||||
<>
|
<>
|
||||||
<ParamPositiveConditioning />
|
<ParamPositiveConditioning />
|
||||||
<ParamNegativeConditioning />
|
<ParamNegativeConditioning />
|
||||||
|
<ParamEmbeddingCollapse />
|
||||||
<ProcessButtons />
|
<ProcessButtons />
|
||||||
<ImageToImageTabCoreParameters />
|
<ImageToImageTabCoreParameters />
|
||||||
<ParamEmbeddingCollapse />
|
|
||||||
<ParamLoraCollapse />
|
<ParamLoraCollapse />
|
||||||
<ParamDynamicPromptsCollapse />
|
<ParamDynamicPromptsCollapse />
|
||||||
<ParamControlNetCollapse />
|
<ParamControlNetCollapse />
|
||||||
|
@ -18,9 +18,9 @@ const TextToImageTabParameters = () => {
|
|||||||
<>
|
<>
|
||||||
<ParamPositiveConditioning />
|
<ParamPositiveConditioning />
|
||||||
<ParamNegativeConditioning />
|
<ParamNegativeConditioning />
|
||||||
|
<ParamEmbeddingCollapse />
|
||||||
<ProcessButtons />
|
<ProcessButtons />
|
||||||
<TextToImageTabCoreParameters />
|
<TextToImageTabCoreParameters />
|
||||||
<ParamEmbeddingCollapse />
|
|
||||||
<ParamLoraCollapse />
|
<ParamLoraCollapse />
|
||||||
<ParamDynamicPromptsCollapse />
|
<ParamDynamicPromptsCollapse />
|
||||||
<ParamControlNetCollapse />
|
<ParamControlNetCollapse />
|
||||||
|
@ -17,9 +17,9 @@ const UnifiedCanvasParameters = () => {
|
|||||||
<>
|
<>
|
||||||
<ParamPositiveConditioning />
|
<ParamPositiveConditioning />
|
||||||
<ParamNegativeConditioning />
|
<ParamNegativeConditioning />
|
||||||
|
<ParamEmbeddingCollapse />
|
||||||
<ProcessButtons />
|
<ProcessButtons />
|
||||||
<UnifiedCanvasCoreParameters />
|
<UnifiedCanvasCoreParameters />
|
||||||
<ParamEmbeddingCollapse />
|
|
||||||
<ParamLoraCollapse />
|
<ParamLoraCollapse />
|
||||||
<ParamDynamicPromptsCollapse />
|
<ParamDynamicPromptsCollapse />
|
||||||
<ParamControlNetCollapse />
|
<ParamControlNetCollapse />
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { PayloadAction } from '@reduxjs/toolkit';
|
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||||
import { createSlice } from '@reduxjs/toolkit';
|
import { createSlice } from '@reduxjs/toolkit';
|
||||||
import { initialImageChanged } from 'features/parameters/store/generationSlice';
|
import { initialImageChanged } from 'features/parameters/store/generationSlice';
|
||||||
|
import { SchedulerParam } from 'features/parameters/store/parameterZodSchemas';
|
||||||
import { setActiveTabReducer } from './extraReducers';
|
import { setActiveTabReducer } from './extraReducers';
|
||||||
import { InvokeTabName } from './tabMap';
|
import { InvokeTabName } from './tabMap';
|
||||||
import { AddNewModelType, UIState } from './uiTypes';
|
import { AddNewModelType, UIState } from './uiTypes';
|
||||||
import { SchedulerParam } from 'features/parameters/store/parameterZodSchemas';
|
|
||||||
|
|
||||||
export const initialUIState: UIState = {
|
export const initialUIState: UIState = {
|
||||||
activeTab: 0,
|
activeTab: 0,
|
||||||
@ -19,6 +19,7 @@ export const initialUIState: UIState = {
|
|||||||
shouldShowGallery: true,
|
shouldShowGallery: true,
|
||||||
shouldHidePreview: false,
|
shouldHidePreview: false,
|
||||||
shouldShowProgressInViewer: true,
|
shouldShowProgressInViewer: true,
|
||||||
|
shouldShowEmbeddingPicker: false,
|
||||||
favoriteSchedulers: [],
|
favoriteSchedulers: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,6 +97,9 @@ export const uiSlice = createSlice({
|
|||||||
) => {
|
) => {
|
||||||
state.favoriteSchedulers = action.payload;
|
state.favoriteSchedulers = action.payload;
|
||||||
},
|
},
|
||||||
|
toggleEmbeddingPicker: (state) => {
|
||||||
|
state.shouldShowEmbeddingPicker = !state.shouldShowEmbeddingPicker;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
extraReducers(builder) {
|
extraReducers(builder) {
|
||||||
builder.addCase(initialImageChanged, (state) => {
|
builder.addCase(initialImageChanged, (state) => {
|
||||||
@ -122,6 +126,7 @@ export const {
|
|||||||
toggleGalleryPanel,
|
toggleGalleryPanel,
|
||||||
setShouldShowProgressInViewer,
|
setShouldShowProgressInViewer,
|
||||||
favoriteSchedulersChanged,
|
favoriteSchedulersChanged,
|
||||||
|
toggleEmbeddingPicker,
|
||||||
} = uiSlice.actions;
|
} = uiSlice.actions;
|
||||||
|
|
||||||
export default uiSlice.reducer;
|
export default uiSlice.reducer;
|
||||||
|
@ -27,5 +27,6 @@ export interface UIState {
|
|||||||
shouldPinGallery: boolean;
|
shouldPinGallery: boolean;
|
||||||
shouldShowGallery: boolean;
|
shouldShowGallery: boolean;
|
||||||
shouldShowProgressInViewer: boolean;
|
shouldShowProgressInViewer: boolean;
|
||||||
|
shouldShowEmbeddingPicker: boolean;
|
||||||
favoriteSchedulers: SchedulerParam[];
|
favoriteSchedulers: SchedulerParam[];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user