Show text progress messages on executing nodes (#3824)

This commit is contained in:
Christian Byrne
2025-05-10 13:10:58 -07:00
committed by GitHub
parent 4cc6a15fde
commit 992c2ba822
7 changed files with 207 additions and 2 deletions

View File

@@ -1,12 +1,14 @@
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { useNodeProgressText } from '@/composables/node/useNodeProgressText'
import type {
ExecutedWsMessage,
ExecutionCachedWsMessage,
ExecutionErrorWsMessage,
ExecutionStartWsMessage,
NodeError,
ProgressTextWsMessage,
ProgressWsMessage
} from '@/schemas/apiSchema'
import type {
@@ -103,6 +105,7 @@ export const useExecutionStore = defineStore('execution', () => {
handleExecutionError as EventListener
)
}
api.addEventListener('progress_text', handleProgressText as EventListener)
function unbindExecutionEvents() {
api.removeEventListener(
@@ -121,6 +124,10 @@ export const useExecutionStore = defineStore('execution', () => {
'execution_error',
handleExecutionError as EventListener
)
api.removeEventListener(
'progress_text',
handleProgressText as EventListener
)
}
function handleExecutionStart(e: CustomEvent<ExecutionStartWsMessage>) {
@@ -177,6 +184,16 @@ export const useExecutionStore = defineStore('execution', () => {
lastExecutionError.value = e.detail
}
function handleProgressText(e: CustomEvent<ProgressTextWsMessage>) {
const { nodeId, text } = e.detail
if (!text || !nodeId) return
const node = app.graph.getNodeById(nodeId)
if (!node) return
useNodeProgressText().showTextPreview(node, text)
}
function storePrompt({
nodes,
id,