mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 14:50:49 +08:00
Merge branch 'comfyanonymous:master' into feature/img-send
This commit is contained in:
commit
ec6e27fbe4
7
nodes.py
7
nodes.py
@ -749,6 +749,13 @@ class SaveImage:
|
|||||||
digits = 0
|
digits = 0
|
||||||
return (digits, prefix)
|
return (digits, prefix)
|
||||||
|
|
||||||
|
def compute_vars(input):
|
||||||
|
input = input.replace("%width%", str(images[0].shape[1]))
|
||||||
|
input = input.replace("%height%", str(images[0].shape[0]))
|
||||||
|
return input
|
||||||
|
|
||||||
|
filename_prefix = compute_vars(filename_prefix)
|
||||||
|
|
||||||
subfolder = os.path.dirname(os.path.normpath(filename_prefix))
|
subfolder = os.path.dirname(os.path.normpath(filename_prefix))
|
||||||
filename = os.path.basename(os.path.normpath(filename_prefix))
|
filename = os.path.basename(os.path.normpath(filename_prefix))
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@ async def cache_control(request: web.Request, handler):
|
|||||||
|
|
||||||
class PromptServer():
|
class PromptServer():
|
||||||
def __init__(self, loop):
|
def __init__(self, loop):
|
||||||
|
PromptServer.instance = self
|
||||||
|
|
||||||
mimetypes.init();
|
mimetypes.init();
|
||||||
mimetypes.types_map['.js'] = 'application/javascript; charset=utf-8'
|
mimetypes.types_map['.js'] = 'application/javascript; charset=utf-8'
|
||||||
self.prompt_queue = None
|
self.prompt_queue = None
|
||||||
|
|||||||
@ -1,8 +1,15 @@
|
|||||||
class ComfyApi extends EventTarget {
|
class ComfyApi extends EventTarget {
|
||||||
|
#registered = new Set();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addEventListener(type, callback, options) {
|
||||||
|
super.addEventListener(type, callback, options);
|
||||||
|
this.#registered.add(type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poll status for colab and other things that don't support websockets.
|
* Poll status for colab and other things that don't support websockets.
|
||||||
*/
|
*/
|
||||||
@ -82,7 +89,11 @@ class ComfyApi extends EventTarget {
|
|||||||
this.dispatchEvent(new CustomEvent("executed", { detail: msg.data }));
|
this.dispatchEvent(new CustomEvent("executed", { detail: msg.data }));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("Unknown message type");
|
if (this.#registered.has(msg.type)) {
|
||||||
|
this.dispatchEvent(new CustomEvent(msg.type, { detail: msg.data }));
|
||||||
|
} else {
|
||||||
|
throw new Error("Unknown message type");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("Unhandled message:", event.data);
|
console.warn("Unhandled message:", event.data);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user