mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: tidy up unused files, unrelated changes
This commit is contained in:
parent
907340b1e1
commit
375c9a1c20
@ -112,7 +112,7 @@ GENERATION_MODES = Literal[
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@invocation("core_metadata", title="Core Metadata", tags=["metadata"], category="metadata", version="1.2.0")
|
@invocation("core_metadata", title="Core Metadata", tags=["metadata"], category="metadata", version="1.0.1")
|
||||||
class CoreMetadataInvocation(BaseInvocation):
|
class CoreMetadataInvocation(BaseInvocation):
|
||||||
"""Collects core generation metadata into a MetadataField"""
|
"""Collects core generation metadata into a MetadataField"""
|
||||||
|
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
from typing import Annotated, Any, Callable
|
|
||||||
|
|
||||||
from pydantic import GetJsonSchemaHandler
|
|
||||||
from pydantic.json_schema import JsonSchemaValue
|
|
||||||
from pydantic_core import core_schema
|
|
||||||
from semver import Version
|
|
||||||
|
|
||||||
|
|
||||||
class _VersionPydanticAnnotation:
|
|
||||||
"""
|
|
||||||
Pydantic annotation for semver.Version.
|
|
||||||
|
|
||||||
Requires a field_serializer to serialize to a string.
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
class MyModel(BaseModel):
|
|
||||||
version: SemVer = Field(..., description="The version of the model.")
|
|
||||||
|
|
||||||
@field_serializer("version")
|
|
||||||
def serialize_version(self, version: SemVer, _info):
|
|
||||||
return str(version)
|
|
||||||
|
|
||||||
MyModel(version=semver.Version.parse("1.2.3"))
|
|
||||||
MyModel.model_validate({"version":"1.2.3"})
|
|
||||||
"""
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __get_pydantic_core_schema__(
|
|
||||||
cls,
|
|
||||||
_source_type: Any,
|
|
||||||
_handler: Callable[[Any], core_schema.CoreSchema],
|
|
||||||
) -> core_schema.CoreSchema:
|
|
||||||
def validate_from_str(value: str) -> Version:
|
|
||||||
return Version.parse(value)
|
|
||||||
|
|
||||||
from_str_schema = core_schema.chain_schema(
|
|
||||||
[
|
|
||||||
core_schema.str_schema(),
|
|
||||||
core_schema.no_info_plain_validator_function(validate_from_str),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
return core_schema.json_or_python_schema(
|
|
||||||
json_schema=from_str_schema,
|
|
||||||
python_schema=core_schema.union_schema(
|
|
||||||
[
|
|
||||||
core_schema.is_instance_schema(Version),
|
|
||||||
from_str_schema,
|
|
||||||
]
|
|
||||||
),
|
|
||||||
serialization=core_schema.to_string_ser_schema(),
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __get_pydantic_json_schema__(
|
|
||||||
cls, _core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler
|
|
||||||
) -> JsonSchemaValue:
|
|
||||||
return handler(core_schema.str_schema())
|
|
||||||
|
|
||||||
|
|
||||||
SemVer = Annotated[Version, _VersionPydanticAnnotation]
|
|
@ -14,7 +14,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { FaDownload, FaPlus } from 'react-icons/fa';
|
import { FaDownload, FaPlus } from 'react-icons/fa';
|
||||||
import { useBoardName } from 'services/api/hooks/useBoardName';
|
import { useBoardName } from 'services/api/hooks/useBoardName';
|
||||||
import { BoardDTO } from 'services/api/types';
|
import { BoardDTO } from 'services/api/types';
|
||||||
import { MENU_LIST_MOTION_PROPS } from 'theme/components/menu';
|
import { menuListMotionProps } from 'theme/components/menu';
|
||||||
import GalleryBoardContextMenuItems from './GalleryBoardContextMenuItems';
|
import GalleryBoardContextMenuItems from './GalleryBoardContextMenuItems';
|
||||||
import NoBoardContextMenuItems from './NoBoardContextMenuItems';
|
import NoBoardContextMenuItems from './NoBoardContextMenuItems';
|
||||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
@ -94,7 +94,7 @@ const BoardContextMenu = ({
|
|||||||
() => (
|
() => (
|
||||||
<MenuList
|
<MenuList
|
||||||
sx={{ visibility: 'visible !important' }}
|
sx={{ visibility: 'visible !important' }}
|
||||||
motionProps={MENU_LIST_MOTION_PROPS}
|
motionProps={menuListMotionProps}
|
||||||
onContextMenu={skipEvent}
|
onContextMenu={skipEvent}
|
||||||
>
|
>
|
||||||
<MenuGroup title={boardName}>
|
<MenuGroup title={boardName}>
|
||||||
|
@ -46,7 +46,7 @@ import {
|
|||||||
useLazyGetImageWorkflowQuery,
|
useLazyGetImageWorkflowQuery,
|
||||||
} from 'services/api/endpoints/images';
|
} from 'services/api/endpoints/images';
|
||||||
import { useDebouncedMetadata } from 'services/api/hooks/useDebouncedMetadata';
|
import { useDebouncedMetadata } from 'services/api/hooks/useDebouncedMetadata';
|
||||||
import { MENU_LIST_MOTION_PROPS } from 'theme/components/menu';
|
import { menuListMotionProps } from 'theme/components/menu';
|
||||||
|
|
||||||
const currentImageButtonsSelector = createSelector(
|
const currentImageButtonsSelector = createSelector(
|
||||||
[stateSelector, activeTabNameSelector],
|
[stateSelector, activeTabNameSelector],
|
||||||
@ -248,7 +248,7 @@ const CurrentImageButtons = () => {
|
|||||||
isDisabled={!imageDTO}
|
isDisabled={!imageDTO}
|
||||||
icon={<FaEllipsis />}
|
icon={<FaEllipsis />}
|
||||||
/>
|
/>
|
||||||
<MenuList motionProps={MENU_LIST_MOTION_PROPS}>
|
<MenuList motionProps={menuListMotionProps}>
|
||||||
{imageDTO && <SingleSelectionMenuItems imageDTO={imageDTO} />}
|
{imageDTO && <SingleSelectionMenuItems imageDTO={imageDTO} />}
|
||||||
</MenuList>
|
</MenuList>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
} from 'common/components/IAIContextMenu';
|
} from 'common/components/IAIContextMenu';
|
||||||
import { MouseEvent, memo, useCallback } from 'react';
|
import { MouseEvent, memo, useCallback } from 'react';
|
||||||
import { ImageDTO } from 'services/api/types';
|
import { ImageDTO } from 'services/api/types';
|
||||||
import { MENU_LIST_MOTION_PROPS } from 'theme/components/menu';
|
import { menuListMotionProps } from 'theme/components/menu';
|
||||||
import SingleSelectionMenuItems from './SingleSelectionMenuItems';
|
import SingleSelectionMenuItems from './SingleSelectionMenuItems';
|
||||||
import { createSelector } from '@reduxjs/toolkit';
|
import { createSelector } from '@reduxjs/toolkit';
|
||||||
import { stateSelector } from 'app/store/store';
|
import { stateSelector } from 'app/store/store';
|
||||||
@ -44,7 +44,7 @@ const ImageContextMenu = ({ imageDTO, children }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<MenuList
|
<MenuList
|
||||||
sx={{ visibility: 'visible !important' }}
|
sx={{ visibility: 'visible !important' }}
|
||||||
motionProps={MENU_LIST_MOTION_PROPS}
|
motionProps={menuListMotionProps}
|
||||||
onContextMenu={skipEvent}
|
onContextMenu={skipEvent}
|
||||||
>
|
>
|
||||||
<MultipleSelectionMenuItems />
|
<MultipleSelectionMenuItems />
|
||||||
@ -55,7 +55,7 @@ const ImageContextMenu = ({ imageDTO, children }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<MenuList
|
<MenuList
|
||||||
sx={{ visibility: 'visible !important' }}
|
sx={{ visibility: 'visible !important' }}
|
||||||
motionProps={MENU_LIST_MOTION_PROPS}
|
motionProps={menuListMotionProps}
|
||||||
onContextMenu={skipEvent}
|
onContextMenu={skipEvent}
|
||||||
>
|
>
|
||||||
<SingleSelectionMenuItems imageDTO={imageDTO} />
|
<SingleSelectionMenuItems imageDTO={imageDTO} />
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
} from 'features/nodes/store/workflowSlice';
|
} from 'features/nodes/store/workflowSlice';
|
||||||
import { MouseEvent, ReactNode, memo, useCallback, useMemo } from 'react';
|
import { MouseEvent, ReactNode, memo, useCallback, useMemo } from 'react';
|
||||||
import { FaMinus, FaPlus } from 'react-icons/fa';
|
import { FaMinus, FaPlus } from 'react-icons/fa';
|
||||||
import { MENU_LIST_MOTION_PROPS } from 'theme/components/menu';
|
import { menuListMotionProps } from 'theme/components/menu';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -110,7 +110,7 @@ const FieldContextMenu = ({ nodeId, fieldName, kind, children }: Props) => {
|
|||||||
!menuItems.length ? null : (
|
!menuItems.length ? null : (
|
||||||
<MenuList
|
<MenuList
|
||||||
sx={{ visibility: 'visible !important' }}
|
sx={{ visibility: 'visible !important' }}
|
||||||
motionProps={MENU_LIST_MOTION_PROPS}
|
motionProps={menuListMotionProps}
|
||||||
onContextMenu={skipEvent}
|
onContextMenu={skipEvent}
|
||||||
>
|
>
|
||||||
<MenuGroup
|
<MenuGroup
|
||||||
|
@ -11,9 +11,9 @@ import { useTranslation } from 'react-i18next';
|
|||||||
|
|
||||||
const selector = createSelector(
|
const selector = createSelector(
|
||||||
stateSelector,
|
stateSelector,
|
||||||
({ workflow: workflows }) => {
|
({ workflow }) => {
|
||||||
return {
|
return {
|
||||||
fields: workflows.exposedFields,
|
fields: workflow.exposedFields,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
defaultSelectorOptions
|
defaultSelectorOptions
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
FaGithub,
|
FaGithub,
|
||||||
FaKeyboard,
|
FaKeyboard,
|
||||||
} from 'react-icons/fa';
|
} from 'react-icons/fa';
|
||||||
import { MENU_LIST_MOTION_PROPS } from 'theme/components/menu';
|
import { menuListMotionProps } from 'theme/components/menu';
|
||||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import HotkeysModal from './HotkeysModal/HotkeysModal';
|
import HotkeysModal from './HotkeysModal/HotkeysModal';
|
||||||
import InvokeAILogoComponent from './InvokeAILogoComponent';
|
import InvokeAILogoComponent from './InvokeAILogoComponent';
|
||||||
@ -54,7 +54,7 @@ const SiteHeader = () => {
|
|||||||
icon={<FaBars />}
|
icon={<FaBars />}
|
||||||
sx={{ boxSize: 8 }}
|
sx={{ boxSize: 8 }}
|
||||||
/>
|
/>
|
||||||
<MenuList motionProps={MENU_LIST_MOTION_PROPS}>
|
<MenuList motionProps={menuListMotionProps}>
|
||||||
<MenuGroup title={t('common.communityLabel')}>
|
<MenuGroup title={t('common.communityLabel')}>
|
||||||
{isGithubLinkEnabled && (
|
{isGithubLinkEnabled && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
@ -75,55 +75,13 @@ export const workflowsApi = api.injectEndpoints({
|
|||||||
}),
|
}),
|
||||||
providesTags: [{ type: 'Workflow', id: LIST_TAG }],
|
providesTags: [{ type: 'Workflow', id: LIST_TAG }],
|
||||||
}),
|
}),
|
||||||
listRecentWorkflows: build.query<
|
|
||||||
paths['/api/v1/workflows/']['get']['responses']['200']['content']['application/json'],
|
|
||||||
void
|
|
||||||
>({
|
|
||||||
query: () => ({
|
|
||||||
url: 'workflows/',
|
|
||||||
params: {
|
|
||||||
page: 0,
|
|
||||||
per_page: 10,
|
|
||||||
order_by: 'opened_at',
|
|
||||||
direction: 'DESC',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
providesTags: [{ type: 'WorkflowsRecent', id: LIST_TAG }],
|
|
||||||
}),
|
|
||||||
listSystemWorkflows: build.query<
|
|
||||||
paths['/api/v1/workflows/']['get']['responses']['200']['content']['application/json'],
|
|
||||||
void
|
|
||||||
>({
|
|
||||||
query: () => ({
|
|
||||||
url: 'workflows/',
|
|
||||||
params: {
|
|
||||||
page: 0,
|
|
||||||
per_page: 10,
|
|
||||||
order_by: 'opened_at',
|
|
||||||
direction: 'DESC',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
transformResponse: () => {
|
|
||||||
return {
|
|
||||||
page: 0,
|
|
||||||
per_page: 10,
|
|
||||||
items: [],
|
|
||||||
total: 0,
|
|
||||||
pages: 0,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
providesTags: [{ type: 'WorkflowsRecent', id: LIST_TAG }],
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
useGetWorkflowQuery,
|
|
||||||
useLazyGetWorkflowQuery,
|
useLazyGetWorkflowQuery,
|
||||||
useCreateWorkflowMutation,
|
useCreateWorkflowMutation,
|
||||||
useDeleteWorkflowMutation,
|
useDeleteWorkflowMutation,
|
||||||
useUpdateWorkflowMutation,
|
useUpdateWorkflowMutation,
|
||||||
useListWorkflowsQuery,
|
useListWorkflowsQuery,
|
||||||
useListRecentWorkflowsQuery,
|
|
||||||
useListSystemWorkflowsQuery,
|
|
||||||
} = workflowsApi;
|
} = workflowsApi;
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
import { skipToken } from '@reduxjs/toolkit/query';
|
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
|
||||||
import { useDebounce } from 'use-debounce';
|
|
||||||
import { useGetWorkflowQuery } from 'services/api/endpoints/workflows';
|
|
||||||
|
|
||||||
export const useDebouncedWorkflow = (workflowId?: string | null) => {
|
|
||||||
const workflowFetchDebounce = useAppSelector(
|
|
||||||
(state) => state.config.workflowFetchDebounce
|
|
||||||
);
|
|
||||||
|
|
||||||
const [debouncedWorkflowID] = useDebounce(
|
|
||||||
workflowId,
|
|
||||||
workflowFetchDebounce ?? 0
|
|
||||||
);
|
|
||||||
|
|
||||||
const { data: workflow, isLoading } = useGetWorkflowQuery(
|
|
||||||
debouncedWorkflowID ?? skipToken
|
|
||||||
);
|
|
||||||
|
|
||||||
return { workflow, isLoading };
|
|
||||||
};
|
|
@ -56,7 +56,7 @@ export const menuTheme = defineMultiStyleConfig({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const MENU_LIST_MOTION_PROPS: MotionProps = {
|
export const menuListMotionProps: MotionProps = {
|
||||||
variants: {
|
variants: {
|
||||||
enter: {
|
enter: {
|
||||||
visibility: 'visible',
|
visibility: 'visible',
|
||||||
|
Loading…
Reference in New Issue
Block a user