blessedcoolant 2023-07-08 03:24:04 +12:00 committed by GitHub
commit d368a1de0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 14 deletions

View File

@ -1,6 +1,6 @@
import IAIIconButton from 'common/components/IAIIconButton';
import { memo } from 'react';
import { BiCode } from 'react-icons/bi';
import { FaCode } from 'react-icons/fa';
type Props = {
onClick: () => void;
@ -13,15 +13,24 @@ const AddEmbeddingButton = (props: Props) => {
size="sm"
aria-label="Add Embedding"
tooltip="Add Embedding"
icon={<BiCode />}
icon={<FaCode />}
sx={{
p: 2,
color: 'base.700',
color: 'base.500',
_hover: {
color: 'base.550',
color: 'base.600',
},
_active: {
color: 'base.700',
},
_dark: {
color: 'base.500',
_hover: {
color: 'base.400',
},
_active: {
color: 'base.300',
},
},
}}
variant="link"

View File

@ -1,11 +1,10 @@
import { Box, FormControl, useDisclosure } from '@chakra-ui/react';
import { RootState } from 'app/store/store';
import { stateSelector } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { ChangeEvent, KeyboardEvent, useCallback, useRef } from 'react';
import { createSelector } from '@reduxjs/toolkit';
import {
GenerationState,
clampSymmetrySteps,
setPositivePrompt,
} from 'features/parameters/store/generationSlice';
@ -22,10 +21,11 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next';
const promptInputSelector = createSelector(
[(state: RootState) => state.generation, activeTabNameSelector],
(parameters: GenerationState, activeTabName) => {
[stateSelector, activeTabNameSelector],
({ generation, ui }, activeTabName) => {
return {
prompt: parameters.positivePrompt,
shouldPinParametersPanel: ui.shouldPinParametersPanel,
prompt: generation.positivePrompt,
activeTabName,
};
},
@ -41,7 +41,8 @@ const promptInputSelector = createSelector(
*/
const ParamPositiveConditioning = () => {
const dispatch = useAppDispatch();
const { prompt, activeTabName } = useAppSelector(promptInputSelector);
const { prompt, shouldPinParametersPanel, activeTabName } =
useAppSelector(promptInputSelector);
const isReady = useIsReadyToInvoke();
const promptRef = useRef<HTMLTextAreaElement>(null);
const { isOpen, onClose, onOpen } = useDisclosure();
@ -120,7 +121,7 @@ const ParamPositiveConditioning = () => {
// };
return (
<Box>
<Box position="relative">
<FormControl>
<ParamEmbeddingPopover
isOpen={isOpen}
@ -144,7 +145,7 @@ const ParamPositiveConditioning = () => {
<Box
sx={{
position: 'absolute',
top: 6,
top: shouldPinParametersPanel ? 6 : 0,
insetInlineEnd: 0,
}}
>

View File

@ -33,12 +33,21 @@ const PinParametersPanelButton = (props: PinParametersPanelButtonProps) => {
variant="ghost"
size="sm"
sx={{
color: 'base.700',
color: 'base.500',
_hover: {
color: 'base.550',
color: 'base.600',
},
_active: {
color: 'base.700',
},
_dark: {
color: 'base.500',
_hover: {
color: 'base.400',
},
_active: {
color: 'base.300',
},
},
...sx,
}}