mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-04 22:15:08 -05:00
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { ButtonGroup } from '@invoke-ai/ui-library';
|
|
import { memo } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
|
|
|
import ClearInvocationCacheButton from './ClearInvocationCacheButton';
|
|
import StatusStatGroup from './common/StatusStatGroup';
|
|
import StatusStatItem from './common/StatusStatItem';
|
|
import ToggleInvocationCacheButton from './ToggleInvocationCacheButton';
|
|
|
|
const InvocationCacheStatus = () => {
|
|
const { t } = useTranslation();
|
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined);
|
|
|
|
return (
|
|
<StatusStatGroup>
|
|
<StatusStatItem
|
|
isDisabled={!cacheStatus?.enabled}
|
|
label={t('invocationCache.cacheSize')}
|
|
value={cacheStatus?.size ?? 0}
|
|
/>
|
|
<StatusStatItem
|
|
isDisabled={!cacheStatus?.enabled}
|
|
label={t('invocationCache.hits')}
|
|
value={cacheStatus?.hits ?? 0}
|
|
/>
|
|
<StatusStatItem
|
|
isDisabled={!cacheStatus?.enabled}
|
|
label={t('invocationCache.misses')}
|
|
value={cacheStatus?.misses ?? 0}
|
|
/>
|
|
<StatusStatItem
|
|
isDisabled={!cacheStatus?.enabled}
|
|
label={t('invocationCache.maxCacheSize')}
|
|
value={cacheStatus?.max_size ?? 0}
|
|
/>
|
|
<ButtonGroup w={24} orientation="vertical" size="sm">
|
|
<ClearInvocationCacheButton />
|
|
<ToggleInvocationCacheButton />
|
|
</ButtonGroup>
|
|
</StatusStatGroup>
|
|
);
|
|
};
|
|
|
|
export default memo(InvocationCacheStatus);
|