mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore(ui): lint
This commit is contained in:
parent
aaeef03593
commit
80065858ed
@ -674,6 +674,7 @@
|
||||
"noMetaData": "No metadata found",
|
||||
"noRecallParameters": "No parameters to recall found",
|
||||
"parameterSet": "Parameter {{parameter}} set",
|
||||
"parsingFailed": "Parsing Failed",
|
||||
"perlin": "Perlin Noise",
|
||||
"positivePrompt": "Positive Prompt",
|
||||
"recallParameters": "Recall Parameters",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { Item } from '@invoke-ai/ui-library';
|
||||
import type { EntityState } from '@reduxjs/toolkit';
|
||||
import { EMPTY_ARRAY } from "app/store/constants";
|
||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||
import type { ModelIdentifierWithBase } from 'features/nodes/types/common';
|
||||
import { MODEL_TYPE_SHORT_MAP } from 'features/parameters/types/constants';
|
||||
import { filter } from 'lodash-es';
|
||||
|
@ -10,8 +10,6 @@ export const LAYER_NAMES_DICT: { label: string; value: CanvasLayer }[] = [
|
||||
{ label: 'Mask', value: 'mask' },
|
||||
];
|
||||
|
||||
const LAYER_NAMES = ['base', 'mask'] as const;
|
||||
|
||||
const zBoundingBoxScaleMethod = z.enum(['none', 'auto', 'manual']);
|
||||
export type BoundingBoxScaleMethod = z.infer<typeof zBoundingBoxScaleMethod>;
|
||||
export const isBoundingBoxScaleMethod = (v: unknown): v is BoundingBoxScaleMethod =>
|
||||
|
@ -58,5 +58,5 @@ export const useImageActions = (image_name?: string) => {
|
||||
parseAndRecallPrompts(metadata);
|
||||
}, [metadata]);
|
||||
|
||||
return { recallAll, remix, recallSeed, recallPrompts , hasMetadata, hasSeed, hasPrompts, isLoadingMetadata };
|
||||
return { recallAll, remix, recallSeed, recallPrompts, hasMetadata, hasSeed, hasPrompts, isLoadingMetadata };
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ const MetadataViewT2IAdapter = ({
|
||||
}
|
||||
handlers.recallItem(t2iAdapter, true);
|
||||
}, [handlers, t2iAdapter]);
|
||||
|
||||
|
||||
const [renderedValue, setRenderedValue] = useState<React.ReactNode>(null);
|
||||
useEffect(() => {
|
||||
const _renderValue = async () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { IconButtonProps} from '@invoke-ai/ui-library';
|
||||
import type { IconButtonProps } from '@invoke-ai/ui-library';
|
||||
import { IconButton, Tooltip } from '@invoke-ai/ui-library';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
@ -2,15 +2,23 @@ import { Text } from '@invoke-ai/ui-library';
|
||||
import type { MetadataHandlers } from 'features/metadata/types';
|
||||
import { MetadataParseFailedToken, MetadataParsePendingToken } from 'features/metadata/util/parsers';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const pendingRenderedValue = <Text>Loading</Text>;
|
||||
const failedRenderedValue = <Text>Parsing Failed</Text>;
|
||||
const Pending = () => {
|
||||
const { t } = useTranslation();
|
||||
return <Text>{t('common.loading')}</Text>;
|
||||
};
|
||||
|
||||
const Failed = () => {
|
||||
const { t } = useTranslation();
|
||||
return <Text>{t('metadata.parsingFailed')}</Text>;
|
||||
};
|
||||
|
||||
export const useMetadataItem = <T,>(metadata: unknown, handlers: MetadataHandlers<T>) => {
|
||||
const [value, setValue] = useState<T | typeof MetadataParsePendingToken | typeof MetadataParseFailedToken>(
|
||||
MetadataParsePendingToken
|
||||
);
|
||||
const [renderedValue, setRenderedValue] = useState<React.ReactNode>(pendingRenderedValue);
|
||||
const [renderedValue, setRenderedValue] = useState<React.ReactNode>(Pending);
|
||||
|
||||
useEffect(() => {
|
||||
const _parse = async () => {
|
||||
@ -31,11 +39,11 @@ export const useMetadataItem = <T,>(metadata: unknown, handlers: MetadataHandler
|
||||
useEffect(() => {
|
||||
const _renderValue = async () => {
|
||||
if (value === MetadataParsePendingToken) {
|
||||
setRenderedValue(pendingRenderedValue);
|
||||
setRenderedValue(Pending);
|
||||
return;
|
||||
}
|
||||
if (value === MetadataParseFailedToken) {
|
||||
setRenderedValue(failedRenderedValue);
|
||||
setRenderedValue(Failed);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ const options: ComboboxOption[] = [
|
||||
{ value: 'controlnet', label: MODEL_TYPE_LABELS['controlnet'] as string },
|
||||
{ value: 'ip_adapter', label: MODEL_TYPE_LABELS['ip_adapter'] as string },
|
||||
{ value: 't2i_adapater', label: MODEL_TYPE_LABELS['t2i_adapter'] as string },
|
||||
] as const
|
||||
] as const;
|
||||
|
||||
const ModelTypeSelect = <T extends AnyModelConfig>(props: UseControllerProps<T>) => {
|
||||
const { field } = useController(props);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { EMPTY_ARRAY } from "app/store/constants";
|
||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectNodesSlice } from 'features/nodes/store/nodesSlice';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { EMPTY_ARRAY } from "app/store/constants";
|
||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectNodesSlice } from 'features/nodes/store/nodesSlice';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { EMPTY_ARRAY } from "app/store/constants";
|
||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectNodesSlice } from 'features/nodes/store/nodesSlice';
|
||||
import { selectNodeTemplate } from 'features/nodes/store/selectors';
|
||||
|
@ -10,7 +10,6 @@ import { t } from 'i18next';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useGetImageDTOQuery, useGetImageMetadataQuery } from 'services/api/endpoints/images';
|
||||
|
||||
|
||||
export const usePreselectedImage = (selectedImage?: {
|
||||
imageName: string;
|
||||
action: 'sendToImg2Img' | 'sendToCanvas' | 'useAllParameters';
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
TabPanels,
|
||||
Tabs,
|
||||
} from '@invoke-ai/ui-library';
|
||||
import { EMPTY_ARRAY } from "app/store/constants";
|
||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { LoRAList } from 'features/lora/components/LoRAList';
|
||||
|
@ -46,7 +46,7 @@ type InstallModelArg = {
|
||||
access_token?: paths['/api/v2/models/install']['post']['parameters']['query']['access_token'];
|
||||
// TODO(MM2): This is typed as `Optional[Dict[str, Any]]` in backend...
|
||||
config?: JSONObject;
|
||||
// config: NonNullable<paths['/api/v2/models/heuristic_install']['post']['requestBody']>['content']['application/json'];
|
||||
// config: NonNullable<paths['/api/v2/models/install']['post']['requestBody']>['content']['application/json'];
|
||||
};
|
||||
|
||||
type InstallModelResponse = paths['/api/v2/models/install']['post']['responses']['201']['content']['application/json'];
|
||||
@ -180,7 +180,7 @@ export const modelsApi = api.injectEndpoints({
|
||||
installModel: build.mutation<InstallModelResponse, InstallModelArg>({
|
||||
query: ({ source, config, access_token }) => {
|
||||
return {
|
||||
url: buildModelsUrl('heuristic_install'),
|
||||
url: buildModelsUrl('install'),
|
||||
params: { source, access_token },
|
||||
method: 'POST',
|
||||
body: config,
|
||||
|
Loading…
Reference in New Issue
Block a user