This commit is contained in:
Benjamin Lu
2025-12-22 18:05:02 -08:00
parent 959c1990b5
commit 0d81c8b518
5 changed files with 477 additions and 99 deletions

View File

@@ -187,12 +187,22 @@ type AsCustomEvents<T> = {
readonly [K in keyof T]: CustomEvent<T[K]>
}
type ExecutingEventDetail =
| ExecutingWsMessage
| {
node: NodeId | null
display_node?: NodeId
prompt_id?: string | null
}
| NodeId
| null
/** Handles differing event and API signatures. */
type ApiToEventType<T = ApiCalls> = {
[K in keyof T]: K extends 'status'
? StatusWsMessageStatus
: K extends 'executing'
? NodeId
? ExecutingEventDetail
: T[K]
}
@@ -646,10 +656,7 @@ export class ComfyApi extends EventTarget {
this.dispatchCustomEvent('status', msg.data.status ?? null)
break
case 'executing':
this.dispatchCustomEvent(
'executing',
msg.data.display_node || msg.data.node
)
this.dispatchCustomEvent('executing', msg.data)
break
case 'execution_start':
case 'execution_error':