diff --git a/src/composables/useCoreCommands.ts b/src/composables/useCoreCommands.ts index cc817b858..f0b1cc5e6 100644 --- a/src/composables/useCoreCommands.ts +++ b/src/composables/useCoreCommands.ts @@ -857,6 +857,27 @@ export function useCoreCommands(): ComfyCommand[] { }) return } + await api.freeMemory({ freeExecutionCache: false }) + } + }, + { + id: 'Comfy.Memory.UnloadModelsAndExecutionCache', + icon: 'mdi mdi-vacuum-outline', + label: 'Unload Models and Execution Cache', + versionAdded: '1.16.4', + function: async () => { + if (!useSettingStore().get('Comfy.Memory.AllowManualUnload')) { + useToastStore().add({ + severity: 'error', + summary: t('g.error'), + detail: t('g.commandProhibited', { + command: 'Comfy.Memory.UnloadModelsAndExecutionCache' + }), + life: 3000 + }) + return + } + await api.freeMemory({ freeExecutionCache: true }) } } ] diff --git a/tests-ui/tests/composables/useUpdateAvailableNodes.test.ts b/tests-ui/tests/composables/useUpdateAvailableNodes.test.ts index 392f9b878..f574b5fe7 100644 --- a/tests-ui/tests/composables/useUpdateAvailableNodes.test.ts +++ b/tests-ui/tests/composables/useUpdateAvailableNodes.test.ts @@ -84,9 +84,11 @@ describe('useUpdateAvailableNodes', () => { } }) - mockIsSemVer.mockImplementation((version: string) => { - return !version.includes('nightly') - }) + mockIsSemVer.mockImplementation( + (version: string): version is `${number}.${number}.${number}` => { + return !version.includes('nightly') + } + ) mockCompareVersions.mockImplementation( (latest: string | undefined, installed: string | undefined) => {