Add toast message on execution interrupted (#490)

* Move toast to top level

* Toast store
This commit is contained in:
Chenlei Hu
2024-08-17 12:29:48 -04:00
committed by GitHub
parent a1a6eeed0f
commit 069766337a
6 changed files with 71 additions and 6 deletions

View File

@@ -1,17 +1,24 @@
import { app } from '../../scripts/app'
import { api } from '../../scripts/api'
import { useToastStore } from '@/stores/toastStore'
app.registerExtension({
name: 'Comfy.Keybinds',
init() {
const keybindListener = function (event) {
const keybindListener = async function (event) {
const modifierPressed = event.ctrlKey || event.metaKey
// Queue prompt using (ctrl or command) + enter
if (modifierPressed && event.key === 'Enter') {
// Cancel current prompt using (ctrl or command) + alt + enter
if (event.altKey) {
api.interrupt()
await api.interrupt()
useToastStore().add({
severity: 'info',
summary: 'Interrupted',
detail: 'Execution has been interrupted',
life: 1000
})
return
}
// Queue prompt as first for generation using (ctrl or command) + shift + enter