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