mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-05 17:14:59 -05:00
feat(nodes): add enable, disable, status to invocation cache
- New routes to clear, enable, disable and get the status of the cache - Status includes hits, misses, size, max size, enabled - Add client cache queries and mutations, abstracted into hooks - Add invocation cache status area (next to queue status) w/ buttons
This commit is contained in:
committed by
Kent Keirsey
parent
aa82f9360c
commit
7ac99d6bc3
@@ -0,0 +1,47 @@
|
||||
import IAIButton from 'common/components/IAIButton';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
||||
import { useDisableInvocationCache } from '../hooks/useDisableInvocationCache';
|
||||
import { useEnableInvocationCache } from '../hooks/useEnableInvocationCache';
|
||||
|
||||
const ToggleInvocationCacheButton = () => {
|
||||
const { t } = useTranslation();
|
||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery();
|
||||
|
||||
const {
|
||||
enableInvocationCache,
|
||||
isDisabled: isEnableDisabled,
|
||||
isLoading: isEnableLoading,
|
||||
} = useEnableInvocationCache();
|
||||
|
||||
const {
|
||||
disableInvocationCache,
|
||||
isDisabled: isDisableDisabled,
|
||||
isLoading: isDisableLoading,
|
||||
} = useDisableInvocationCache();
|
||||
|
||||
if (cacheStatus?.enabled) {
|
||||
return (
|
||||
<IAIButton
|
||||
isDisabled={isDisableDisabled}
|
||||
isLoading={isDisableLoading}
|
||||
onClick={disableInvocationCache}
|
||||
>
|
||||
{t('invocationCache.disable')}
|
||||
</IAIButton>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<IAIButton
|
||||
isDisabled={isEnableDisabled}
|
||||
isLoading={isEnableLoading}
|
||||
onClick={enableInvocationCache}
|
||||
>
|
||||
{t('invocationCache.enable')}
|
||||
</IAIButton>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(ToggleInvocationCacheButton);
|
||||
Reference in New Issue
Block a user