chore(ui): lint

This commit is contained in:
psychedelicious 2024-03-07 19:00:23 +11:00
parent 4077dfe0c3
commit 8e694992bb
6 changed files with 4 additions and 68 deletions

View File

@ -1,23 +0,0 @@
import { Box, Divider, Text } from '@invoke-ai/ui-library';
export const ModelListHeader = ({ title }: { title: string }) => {
return (
<Box position="relative" padding="10px 0">
<Divider sx={{ backgroundColor: 'base.400' }} />
<Box
sx={{
position: 'absolute',
top: '50%',
left: 0,
transform: 'translate(0, -50%)',
backgroundColor: 'base.800',
padding: '10px',
}}
>
<Text variant="subtext" fontSize="sm">
{title}
</Text>
</Box>
</Box>
);
};

View File

@ -1,41 +0,0 @@
import { Box, Flex } from '@invoke-ai/ui-library';
import { skipToken } from '@reduxjs/toolkit/query';
import { useAppSelector } from 'app/store/storeHooks';
import DataViewer from 'features/gallery/components/ImageMetadataViewer/DataViewer';
import { useMemo } from 'react';
import { useGetModelConfigQuery } from 'services/api/endpoints/models';
import type { ModelType } from 'services/api/types';
import { TriggerPhrases } from './TriggerPhrases';
const MODEL_TYPE_TRIGGER_PHRASE: ModelType[] = ['main', 'lora'];
export const ModelMetadata = () => {
const selectedModelKey = useAppSelector((s) => s.modelmanagerV2.selectedModelKey);
const { data } = useGetModelConfigQuery(selectedModelKey ?? skipToken);
const shouldShowTriggerPhraseSettings = useMemo(() => {
if (!data?.type) {
return false;
}
return MODEL_TYPE_TRIGGER_PHRASE.includes(data.type);
}, [data]);
const apiResponseFormatted = useMemo(() => {
if (!data?.source_api_response) {
return {};
}
return JSON.parse(data.source_api_response);
}, [data?.source_api_response]);
return (
<Flex flexDir="column" height="full" gap="3">
{shouldShowTriggerPhraseSettings && (
<Box layerStyle="second" borderRadius="base" p={3}>
<TriggerPhrases />
</Box>
)}
<DataViewer label="metadata" data={apiResponseFormatted} />
</Flex>
);
};

View File

@ -1,7 +1,7 @@
import { Box, Flex, Text } from '@invoke-ai/ui-library';
import { skipToken } from '@reduxjs/toolkit/query';
import { useAppSelector } from 'app/store/storeHooks';
import { TriggerPhrases } from 'features/modelManagerV2/subpanels/ModelPanel/Metadata/TriggerPhrases';
import { TriggerPhrases } from 'features/modelManagerV2/subpanels/ModelPanel/TriggerPhrases';
import { useTranslation } from 'react-i18next';
import { useGetModelConfigQuery } from 'services/api/endpoints/models';

View File

@ -30,7 +30,7 @@ export type UpdateModelArg = {
body: paths['/api/v2/models/i/{key}']['patch']['requestBody']['content']['application/json'];
};
export type UpdateModelImageArg = {
type UpdateModelImageArg = {
key: string;
image: Blob;
};

View File

@ -49,8 +49,8 @@ export type ControlNetModelConfig = S['ControlNetDiffusersConfig'] | S['ControlN
export type IPAdapterModelConfig = S['IPAdapterConfig'];
export type T2IAdapterModelConfig = S['T2IAdapterConfig'];
export type TextualInversionModelConfig = S['TextualInversionFileConfig'] | S['TextualInversionFolderConfig'];
export type DiffusersModelConfig = S['MainDiffusersConfig'];
export type CheckpointModelConfig = S['MainCheckpointConfig'];
type DiffusersModelConfig = S['MainDiffusersConfig'];
type CheckpointModelConfig = S['MainCheckpointConfig'];
type CLIPVisionDiffusersConfig = S['CLIPVisionDiffusersConfig'];
export type MainModelConfig = DiffusersModelConfig | CheckpointModelConfig;
export type AnyModelConfig =