mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-30 12:59:55 +00:00
Show text progress messages on executing nodes (#3824)
This commit is contained in:
@@ -14,6 +14,7 @@ import type {
|
||||
LogsRawResponse,
|
||||
LogsWsMessage,
|
||||
PendingTaskItem,
|
||||
ProgressTextWsMessage,
|
||||
ProgressWsMessage,
|
||||
PromptResponse,
|
||||
RunningTaskItem,
|
||||
@@ -101,6 +102,7 @@ interface BackendApiCalls {
|
||||
logs: LogsWsMessage
|
||||
/** Binary preview/progress data */
|
||||
b_preview: Blob
|
||||
progress_text: ProgressTextWsMessage
|
||||
}
|
||||
|
||||
/** Dictionary of all api calls */
|
||||
@@ -399,12 +401,21 @@ export class ComfyApi extends EventTarget {
|
||||
if (event.data instanceof ArrayBuffer) {
|
||||
const view = new DataView(event.data)
|
||||
const eventType = view.getUint32(0)
|
||||
const imageType = view.getUint32(4)
|
||||
const imageData = event.data.slice(8)
|
||||
|
||||
let imageMime
|
||||
switch (eventType) {
|
||||
case 3:
|
||||
const decoder = new TextDecoder()
|
||||
const data = event.data.slice(4)
|
||||
const nodeIdLength = view.getUint32(4)
|
||||
this.dispatchCustomEvent('progress_text', {
|
||||
nodeId: decoder.decode(data.slice(4, 4 + nodeIdLength)),
|
||||
text: decoder.decode(data.slice(4 + nodeIdLength))
|
||||
})
|
||||
break
|
||||
case 1:
|
||||
const imageType = view.getUint32(4)
|
||||
const imageData = event.data.slice(8)
|
||||
switch (imageType) {
|
||||
case 2:
|
||||
imageMime = 'image/png'
|
||||
|
||||
Reference in New Issue
Block a user