diff --git a/components/SettingsModal.vue b/components/SettingsModal.vue index 6dcd67a..6675458 100644 --- a/components/SettingsModal.vue +++ b/components/SettingsModal.vue @@ -10,6 +10,36 @@ +
+

GPU

+
+

+ Stops Comfy on the desktop GPU so it drops out of VRAM. The PC stays on. Generate or Wake GPU will start it again. +

+
+ + +
+

{{ gpuMessage }}

+
+
+

Storage

@@ -256,6 +286,10 @@ const loginNext = ref('') const drafts = reactive>({}) const storageLoading = ref(true) const storageError = ref('') +const gpuSleeping = ref(false) +const gpuWaking = ref(false) +const gpuError = ref(false) +const gpuMessage = ref('') const storage = ref<{ libraryBytes: number breakdown: { clips: number; stills: number; tmp: number; other: number } @@ -392,6 +426,38 @@ async function loadStorage() { } } +async function sleepGpu() { + if (gpuSleeping.value || gpuWaking.value) return + gpuSleeping.value = true + gpuError.value = false + gpuMessage.value = 'Stopping Comfy on the GPU…' + try { + await $fetch('/api/comfy/sleep', { method: 'POST' }) + gpuMessage.value = 'Comfy is stopped. VRAM is free until you generate or wake the GPU.' + } catch (error: any) { + gpuError.value = true + gpuMessage.value = error?.data?.statusMessage || error?.statusMessage || 'Could not stop Comfy.' + } finally { + gpuSleeping.value = false + } +} + +async function wakeGpu() { + if (gpuWaking.value || gpuSleeping.value) return + gpuWaking.value = true + gpuError.value = false + gpuMessage.value = 'Starting Comfy on the GPU…' + try { + await $fetch('/api/comfy/wake', { method: 'POST' }) + gpuMessage.value = 'Wake sent. The first job can still take a couple of minutes if Comfy is cold.' + } catch (error: any) { + gpuError.value = true + gpuMessage.value = error?.data?.statusMessage || error?.statusMessage || 'Could not wake the GPU.' + } finally { + gpuWaking.value = false + } +} + async function loadLoraKeys() { loraRowsLoading.value = true try { diff --git a/pages/index.vue b/pages/index.vue index 145285f..e51d1a2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -30,6 +30,17 @@ > {{ gpuWaking ? 'Starting GPU…' : 'Wake GPU' }} +