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,14 +1,21 @@
import { StatusWsMessageStatus } from '@/types/apiTypes'
import { api } from '../../api'
import { ComfyButton } from '../components/button'
import { useToastStore } from '@/stores/toastStore'
export function getInterruptButton(visibility: string) {
const btn = new ComfyButton({
icon: 'close',
tooltip: 'Cancel current generation',
enabled: false,
action: () => {
api.interrupt()
action: async () => {
await api.interrupt()
useToastStore().add({
severity: 'info',
summary: 'Interrupted',
detail: 'Execution has been interrupted',
life: 1000
})
},
classList: ['comfyui-button', 'comfyui-interrupt-button', visibility]
})