This commit is contained in:
Mary Hipp 2024-02-28 12:04:51 -05:00
parent 8566c1c7ff
commit 8926a1a424
12 changed files with 29 additions and 33 deletions

View File

@ -1,8 +1,9 @@
import { Flex, Box } from '@invoke-ai/ui-library'; import { Box, Flex } from '@invoke-ai/ui-library';
import { skipToken } from '@reduxjs/toolkit/query'; import { skipToken } from '@reduxjs/toolkit/query';
import { useAppSelector } from '../../../../../app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import { useGetModelMetadataQuery } from '../../../../../services/api/endpoints/models'; import DataViewer from 'features/gallery/components/ImageMetadataViewer/DataViewer';
import DataViewer from '../../../../gallery/components/ImageMetadataViewer/DataViewer'; import { useGetModelMetadataQuery } from 'services/api/endpoints/models';
import { TriggerPhrases } from './TriggerPhrases'; import { TriggerPhrases } from './TriggerPhrases';
export const ModelMetadata = () => { export const ModelMetadata = () => {

View File

@ -8,13 +8,13 @@ import {
TagCloseButton, TagCloseButton,
TagLabel, TagLabel,
} from '@invoke-ai/ui-library'; } from '@invoke-ai/ui-library';
import { useState, useMemo, useCallback } from 'react';
import type { ChangeEvent } from 'react';
import { ModelListHeader } from '../../ModelManagerPanel/ModelListHeader';
import { skipToken } from '@reduxjs/toolkit/query'; import { skipToken } from '@reduxjs/toolkit/query';
import { useAppSelector } from '../../../../../app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import { useGetModelMetadataQuery, useUpdateModelMetadataMutation } from '../../../../../services/api/endpoints/models'; import { ModelListHeader } from 'features/modelManagerV2/subpanels/ModelManagerPanel/ModelListHeader';
import type { ChangeEvent } from 'react';
import { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useGetModelMetadataQuery, useUpdateModelMetadataMutation } from 'services/api/endpoints/models';
export const TriggerPhrases = () => { export const TriggerPhrases = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@ -1,13 +1,13 @@
import { Box, Flex, Heading, Tab, TabList, TabPanel, TabPanels, Tabs, Text } from '@invoke-ai/ui-library';
import { skipToken } from '@reduxjs/toolkit/query';
import { useAppSelector } from 'app/store/storeHooks'; import { useAppSelector } from 'app/store/storeHooks';
import { useTranslation } from 'react-i18next';
import { useGetModelConfigQuery } from 'services/api/endpoints/models';
import { ModelMetadata } from './Metadata/ModelMetadata';
import { ModelAttrView } from './ModelAttrView';
import { ModelEdit } from './ModelEdit'; import { ModelEdit } from './ModelEdit';
import { ModelView } from './ModelView'; import { ModelView } from './ModelView';
import { Tabs, TabList, Tab, TabPanels, TabPanel, Flex, Heading, Text, Box } from '@invoke-ai/ui-library';
import { ModelMetadata } from './Metadata/ModelMetadata';
import { skipToken } from '@reduxjs/toolkit/query';
import { useGetModelConfigQuery } from '../../../../services/api/endpoints/models';
import { ModelAttrView } from './ModelAttrView';
import { useTranslation } from 'react-i18next';
export const Model = () => { export const Model = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@ -1,10 +1,10 @@
import { Box, Textarea } from '@invoke-ai/ui-library'; import { Box, Textarea } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { setNegativePrompt } from 'features/parameters/store/generationSlice';
import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton';
import { PromptPopover } from 'features/prompt/PromptPopover'; import { PromptPopover } from 'features/prompt/PromptPopover';
import { usePrompt } from 'features/prompt/usePrompt'; import { usePrompt } from 'features/prompt/usePrompt';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { setNegativePrompt } from 'features/parameters/store/generationSlice';
import { memo, useCallback, useRef } from 'react'; import { memo, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';

View File

@ -1,11 +1,11 @@
import { Box, Textarea } from '@invoke-ai/ui-library'; import { Box, Textarea } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { ShowDynamicPromptsPreviewButton } from 'features/dynamicPrompts/components/ShowDynamicPromptsPreviewButton'; import { ShowDynamicPromptsPreviewButton } from 'features/dynamicPrompts/components/ShowDynamicPromptsPreviewButton';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { setPositivePrompt } from 'features/parameters/store/generationSlice';
import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton';
import { PromptPopover } from 'features/prompt/PromptPopover'; import { PromptPopover } from 'features/prompt/PromptPopover';
import { usePrompt } from 'features/prompt/usePrompt'; import { usePrompt } from 'features/prompt/usePrompt';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { setPositivePrompt } from 'features/parameters/store/generationSlice';
import { SDXLConcatButton } from 'features/sdxl/components/SDXLPrompts/SDXLConcatButton'; import { SDXLConcatButton } from 'features/sdxl/components/SDXLPrompts/SDXLConcatButton';
import { memo, useCallback, useRef } from 'react'; import { memo, useCallback, useRef } from 'react';
import type { HotkeyCallback } from 'react-hotkeys-hook'; import type { HotkeyCallback } from 'react-hotkeys-hook';

View File

@ -5,8 +5,7 @@ import { useAppSelector } from 'app/store/storeHooks';
import type { PromptTriggerSelectProps } from 'features/prompt/types'; import type { PromptTriggerSelectProps } from 'features/prompt/types';
import { t } from 'i18next'; import { t } from 'i18next';
import { map } from 'lodash-es'; import { map } from 'lodash-es';
import { useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useGetModelMetadataQuery, useGetTextualInversionModelsQuery } from 'services/api/endpoints/models'; import { useGetModelMetadataQuery, useGetTextualInversionModelsQuery } from 'services/api/endpoints/models';
@ -46,7 +45,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel
options: compatibleEmbeddingsArray.map((model) => ({ label: model.name, value: `<${model.name}>` })), options: compatibleEmbeddingsArray.map((model) => ({ label: model.name, value: `<${model.name}>` })),
}, },
]; ];
}, [data, currentBaseModel]); }, [data, currentBaseModel, t]);
const options = useMemo(() => { const options = useMemo(() => {
if (!metadata || !metadata.trigger_phrases) { if (!metadata || !metadata.trigger_phrases) {
@ -60,7 +59,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel
}, },
]; ];
return [...metadataOptions, ...embeddingOptions]; return [...metadataOptions, ...embeddingOptions];
}, [embeddingOptions, metadata]); }, [embeddingOptions, metadata, t]);
return ( return (
<FormControl> <FormControl>

View File

@ -9,5 +9,4 @@ export type PromptPopoverProps = PropsWithChildren &
PromptTriggerSelectProps & { PromptTriggerSelectProps & {
isOpen: boolean; isOpen: boolean;
width?: number | string; width?: number | string;
}; };

View File

@ -54,7 +54,6 @@ export const usePrompt = ({ prompt, textareaRef, onChange: _onChange }: UseInser
[textareaRef, _onChange, prompt] [textareaRef, _onChange, prompt]
); );
const onFocus = useCallback(() => { const onFocus = useCallback(() => {
textareaRef.current?.focus(); textareaRef.current?.focus();
}, [textareaRef]); }, [textareaRef]);
@ -64,7 +63,6 @@ export const usePrompt = ({ prompt, textareaRef, onChange: _onChange }: UseInser
onFocus(); onFocus();
}, [onFocus, onClose]); }, [onFocus, onClose]);
const onSelect = useCallback( const onSelect = useCallback(
(v: string) => { (v: string) => {
insertTrigger(v); insertTrigger(v);
@ -73,7 +71,6 @@ export const usePrompt = ({ prompt, textareaRef, onChange: _onChange }: UseInser
[handleClosePopover, insertTrigger] [handleClosePopover, insertTrigger]
); );
const onKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = useCallback( const onKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = useCallback(
(e) => { (e) => {
if (e.key === '<') { if (e.key === '<') {

View File

@ -1,9 +1,9 @@
import { Box, Textarea } from '@invoke-ai/ui-library'; import { Box, Textarea } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton';
import { PromptPopover } from 'features/prompt/PromptPopover'; import { PromptPopover } from 'features/prompt/PromptPopover';
import { usePrompt } from 'features/prompt/usePrompt'; import { usePrompt } from 'features/prompt/usePrompt';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { setNegativeStylePromptSDXL } from 'features/sdxl/store/sdxlSlice'; import { setNegativeStylePromptSDXL } from 'features/sdxl/store/sdxlSlice';
import { memo, useCallback, useRef } from 'react'; import { memo, useCallback, useRef } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';

View File

@ -1,9 +1,9 @@
import { Box, Textarea } from '@invoke-ai/ui-library'; import { Box, Textarea } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton'; import { AddPromptTriggerButton } from 'features/prompt/AddPromptTriggerButton';
import { PromptPopover } from 'features/prompt/PromptPopover'; import { PromptPopover } from 'features/prompt/PromptPopover';
import { usePrompt } from 'features/prompt/usePrompt'; import { usePrompt } from 'features/prompt/usePrompt';
import { PromptOverlayButtonWrapper } from 'features/parameters/components/Prompts/PromptOverlayButtonWrapper';
import { setPositiveStylePromptSDXL } from 'features/sdxl/store/sdxlSlice'; import { setPositiveStylePromptSDXL } from 'features/sdxl/store/sdxlSlice';
import { memo, useCallback, useRef } from 'react'; import { memo, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';

View File

@ -24,7 +24,7 @@ export type UpdateModelArg = {
body: paths['/api/v2/models/i/{key}']['patch']['requestBody']['content']['application/json']; body: paths['/api/v2/models/i/{key}']['patch']['requestBody']['content']['application/json'];
}; };
export type UpdateModelMetadataArg = { type UpdateModelMetadataArg = {
key: paths['/api/v2/models/i/{key}/metadata']['patch']['parameters']['path']['key']; key: paths['/api/v2/models/i/{key}/metadata']['patch']['parameters']['path']['key'];
body: paths['/api/v2/models/i/{key}/metadata']['patch']['requestBody']['content']['application/json']; body: paths['/api/v2/models/i/{key}/metadata']['patch']['requestBody']['content']['application/json'];
}; };

View File

@ -576,7 +576,7 @@ export type paths = {
}; };
}; };
export type webhooks = Record<string, never>; type webhooks = Record<string, never>;
export type components = { export type components = {
schemas: { schemas: {
@ -11391,9 +11391,9 @@ export type components = {
pathItems: never; pathItems: never;
}; };
export type $defs = Record<string, never>; type $defs = Record<string, never>;
export type external = Record<string, never>; type external = Record<string, never>;
export type operations = { export type operations = {
/** /**