Use UUIDs everywhere & improve prompt popup

This commit is contained in:
space-nuko
2023-05-13 01:20:58 -05:00
parent 7786a0aba6
commit 23271197b5
12 changed files with 6064 additions and 2522 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
"last_link_id": 11, "last_link_id": 11,
"nodes": [ "nodes": [
{ {
"id": 2, "id": "47706464-4d82-4329-91a9-c9b2bec4cf60",
"type": "ui/combo", "type": "ui/combo",
"pos": [ "pos": [
1957.9086484470572, 1957.9086484470572,
@@ -39,7 +39,7 @@
"name": "value", "name": "value",
"type": "string", "type": "string",
"links": [ "links": [
1 "ca92647a-2a42-45c1-9e75-96aadd954d2f"
] ]
}, },
{ {
@@ -64,7 +64,7 @@
"saveUserState": false "saveUserState": false
}, },
{ {
"id": 3, "id": "8ad09059-f3fc-453f-8633-bd7281bc2802",
"type": "ui/image_upload", "type": "ui/image_upload",
"pos": [ "pos": [
1925.8925619834713, 1925.8925619834713,
@@ -90,7 +90,7 @@
"name": "filename", "name": "filename",
"type": "string", "type": "string",
"links": [ "links": [
4 "6c59e5a0-008d-4f8f-a2a3-e18ce2536194"
] ]
}, },
{ {
@@ -129,7 +129,7 @@
"saveUserState": false "saveUserState": false
}, },
{ {
"id": 5, "id": "c3c2fedf-e8ea-4d42-a866-5e8118cba44f",
"type": "ImageUpscaleWithModel", "type": "ImageUpscaleWithModel",
"pos": [ "pos": [
2322, 2322,
@@ -146,13 +146,13 @@
{ {
"name": "upscale_model", "name": "upscale_model",
"type": "UPSCALE_MODEL", "type": "UPSCALE_MODEL",
"link": 2, "link": "e76b88da-2474-4416-947a-3df7744b9f0e",
"config": {} "config": {}
}, },
{ {
"name": "image", "name": "image",
"type": "IMAGE", "type": "IMAGE",
"link": 5, "link": "978dec85-18c9-42f5-af2a-d560ea9f6a3b",
"config": {} "config": {}
} }
], ],
@@ -161,7 +161,7 @@
"name": "IMAGE", "name": "IMAGE",
"type": "IMAGE", "type": "IMAGE",
"links": [ "links": [
7 "a2678fb8-093c-4769-92e8-20ae02961047"
], ],
"slot_index": 0 "slot_index": 0
} }
@@ -175,7 +175,7 @@
"saveUserState": true "saveUserState": true
}, },
{ {
"id": 10, "id": "257170fc-2503-4304-9d8c-fdc50f1fd0da",
"type": "ui/button", "type": "ui/button",
"pos": [ "pos": [
2657, 2657,
@@ -196,7 +196,7 @@
"name": "clicked", "name": "clicked",
"type": -2, "type": -2,
"links": [ "links": [
9 "76b86223-43cc-4eee-b678-6481aa77066d"
], ],
"shape": 1, "shape": 1,
"slot_index": 0 "slot_index": 0
@@ -223,7 +223,7 @@
"saveUserState": true "saveUserState": true
}, },
{ {
"id": 8, "id": "f842f292-01b3-45e3-8972-ef5d036dd7d3",
"type": "SaveImage", "type": "SaveImage",
"pos": [ "pos": [
2542, 2542,
@@ -240,13 +240,13 @@
{ {
"name": "images", "name": "images",
"type": "IMAGE", "type": "IMAGE",
"link": 7, "link": "a2678fb8-093c-4769-92e8-20ae02961047",
"config": {} "config": {}
}, },
{ {
"name": "filename_prefix", "name": "filename_prefix",
"type": "string", "type": "string",
"link": 11, "link": "79173f8b-dace-41e6-9897-3ba6d7e8ef3e",
"config": {}, "config": {},
"defaultWidgetNode": null, "defaultWidgetNode": null,
"widgetNodeType": "ui/text", "widgetNodeType": "ui/text",
@@ -258,7 +258,7 @@
"name": "onExecuted", "name": "onExecuted",
"type": -2, "type": -2,
"links": [ "links": [
8 "fc2282f2-64c9-44b8-ae2f-0476777d088f"
], ],
"color_off": "rebeccapurple", "color_off": "rebeccapurple",
"color_on": "rebeccapurple", "color_on": "rebeccapurple",
@@ -275,7 +275,7 @@
"saveUserState": true "saveUserState": true
}, },
{ {
"id": 6, "id": "1dcc0510-9e06-4ca4-b607-26c361abce6c",
"type": "LoadImage", "type": "LoadImage",
"pos": [ "pos": [
2160, 2160,
@@ -292,7 +292,7 @@
{ {
"name": "image", "name": "image",
"type": "string", "type": "string",
"link": 4, "link": "6c59e5a0-008d-4f8f-a2a3-e18ce2536194",
"config": {}, "config": {},
"defaultWidgetNode": null, "defaultWidgetNode": null,
"widgetNodeType": "ui/combo", "widgetNodeType": "ui/combo",
@@ -305,7 +305,7 @@
"name": "IMAGE", "name": "IMAGE",
"type": "IMAGE", "type": "IMAGE",
"links": [ "links": [
5 "978dec85-18c9-42f5-af2a-d560ea9f6a3b"
], ],
"slot_index": 0 "slot_index": 0
}, },
@@ -324,7 +324,7 @@
"saveUserState": true "saveUserState": true
}, },
{ {
"id": 9, "id": "5c25a00f-c779-44b0-a09f-6915e7170536",
"type": "ui/text", "type": "ui/text",
"pos": [ "pos": [
2445, 2445,
@@ -357,7 +357,7 @@
"name": "value", "name": "value",
"type": "string", "type": "string",
"links": [ "links": [
11 "79173f8b-dace-41e6-9897-3ba6d7e8ef3e"
], ],
"slot_index": 0 "slot_index": 0
}, },
@@ -384,7 +384,7 @@
"saveUserState": true "saveUserState": true
}, },
{ {
"id": 4, "id": "31918f22-9e41-446d-a024-a24c90bc5a45",
"type": "ui/gallery", "type": "ui/gallery",
"pos": [ "pos": [
2819, 2819,
@@ -407,7 +407,7 @@
{ {
"name": "store", "name": "store",
"type": -1, "type": -1,
"link": 8, "link": "fc2282f2-64c9-44b8-ae2f-0476777d088f",
"color_off": "rebeccapurple", "color_off": "rebeccapurple",
"color_on": "rebeccapurple", "color_on": "rebeccapurple",
"shape": 1 "shape": 1
@@ -415,7 +415,7 @@
{ {
"name": "clear", "name": "clear",
"type": -1, "type": -1,
"link": 9, "link": "76b86223-43cc-4eee-b678-6481aa77066d",
"shape": 1 "shape": 1
} }
], ],
@@ -456,7 +456,7 @@
"saveUserState": false "saveUserState": false
}, },
{ {
"id": 1, "id": "76728844-31dc-4a76-bd2f-f32f1d7bbb64",
"type": "UpscaleModelLoader", "type": "UpscaleModelLoader",
"pos": [ "pos": [
2088, 2088,
@@ -473,7 +473,7 @@
{ {
"name": "model_name", "name": "model_name",
"type": "string", "type": "string",
"link": 1, "link": "ca92647a-2a42-45c1-9e75-96aadd954d2f",
"config": {}, "config": {},
"defaultWidgetNode": null, "defaultWidgetNode": null,
"widgetNodeType": "ui/combo", "widgetNodeType": "ui/combo",
@@ -485,7 +485,7 @@
"name": "UPSCALE_MODEL", "name": "UPSCALE_MODEL",
"type": "UPSCALE_MODEL", "type": "UPSCALE_MODEL",
"links": [ "links": [
2 "e76b88da-2474-4416-947a-3df7744b9f0e"
], ],
"slot_index": 0 "slot_index": 0
} }
@@ -501,66 +501,66 @@
], ],
"links": [ "links": [
[ [
1, "ca92647a-2a42-45c1-9e75-96aadd954d2f",
2, "47706464-4d82-4329-91a9-c9b2bec4cf60",
0, 0,
1, "76728844-31dc-4a76-bd2f-f32f1d7bbb64",
0, 0,
"string" "string"
], ],
[ [
2, "e76b88da-2474-4416-947a-3df7744b9f0e",
1, "76728844-31dc-4a76-bd2f-f32f1d7bbb64",
0, 0,
5, "c3c2fedf-e8ea-4d42-a866-5e8118cba44f",
0, 0,
"UPSCALE_MODEL" "UPSCALE_MODEL"
], ],
[ [
4, "6c59e5a0-008d-4f8f-a2a3-e18ce2536194",
3, "8ad09059-f3fc-453f-8633-bd7281bc2802",
0, 0,
6, "1dcc0510-9e06-4ca4-b607-26c361abce6c",
0, 0,
"string" "string"
], ],
[ [
5, "978dec85-18c9-42f5-af2a-d560ea9f6a3b",
6, "1dcc0510-9e06-4ca4-b607-26c361abce6c",
0, 0,
5, "c3c2fedf-e8ea-4d42-a866-5e8118cba44f",
1, 1,
"IMAGE" "IMAGE"
], ],
[ [
7, "a2678fb8-093c-4769-92e8-20ae02961047",
5, "c3c2fedf-e8ea-4d42-a866-5e8118cba44f",
0, 0,
8, "f842f292-01b3-45e3-8972-ef5d036dd7d3",
0, 0,
"IMAGE" "IMAGE"
], ],
[ [
8, "fc2282f2-64c9-44b8-ae2f-0476777d088f",
8, "f842f292-01b3-45e3-8972-ef5d036dd7d3",
0, 0,
4, "31918f22-9e41-446d-a024-a24c90bc5a45",
1, 1,
-1 -1
], ],
[ [
9, "76b86223-43cc-4eee-b678-6481aa77066d",
10, "257170fc-2503-4304-9d8c-fdc50f1fd0da",
0, 0,
4, "31918f22-9e41-446d-a024-a24c90bc5a45",
2, 2,
-1 -1
], ],
[ [
11, "79173f8b-dace-41e6-9897-3ba6d7e8ef3e",
9, "5c25a00f-c779-44b0-a09f-6915e7170536",
0, 0,
8, "f842f292-01b3-45e3-8972-ef5d036dd7d3",
1, 1,
"string" "string"
] ]
@@ -571,12 +571,12 @@
"version": 10 "version": 10
}, },
"layout": { "layout": {
"root": "0", "root": "4d6c8745-5133-4d31-a33c-bc93f507ac45",
"allItems": { "allItems": {
"0": { "0": {
"dragItem": { "dragItem": {
"type": "container", "type": "container",
"id": "0", "id": "4d6c8745-5133-4d31-a33c-bc93f507ac45",
"attrs": { "attrs": {
"title": "", "title": "",
"hidden": false, "hidden": false,
@@ -594,14 +594,14 @@
} }
}, },
"children": [ "children": [
"1", "c3414cbc-42d4-4c63-bdda-f960bac31fdd",
"2" "bcacc84b-4d08-4ebb-977f-7b0be56543c1"
] ]
}, },
"1": { "1": {
"dragItem": { "dragItem": {
"type": "container", "type": "container",
"id": "1", "id": "c3414cbc-42d4-4c63-bdda-f960bac31fdd",
"attrs": { "attrs": {
"title": "", "title": "",
"hidden": false, "hidden": false,
@@ -619,15 +619,15 @@
} }
}, },
"children": [ "children": [
"5", "74447132-c425-4db0-be80-57fdec6d4fc9",
"4" "052ece2d-e32a-486c-9856-d07fd26e7ab2"
], ],
"parent": "0" "parent": "4d6c8745-5133-4d31-a33c-bc93f507ac45"
}, },
"2": { "2": {
"dragItem": { "dragItem": {
"type": "container", "type": "container",
"id": "2", "id": "bcacc84b-4d08-4ebb-977f-7b0be56543c1",
"attrs": { "attrs": {
"title": "", "title": "",
"hidden": false, "hidden": false,
@@ -645,16 +645,16 @@
} }
}, },
"children": [ "children": [
"6", "6e754e38-5790-4e46-a4b7-dbe5fb9ee30d",
"12" "6c0af451-b908-4850-a5cf-a458fc3147ed"
], ],
"parent": "0" "parent": "4d6c8745-5133-4d31-a33c-bc93f507ac45"
}, },
"3": { "3": {
"dragItem": { "dragItem": {
"type": "widget", "type": "widget",
"id": "3", "id": "ee2182f5-88e5-4f68-a6d4-1f39cd7c47e6",
"nodeId": 2, "nodeId": "47706464-4d82-4329-91a9-c9b2bec4cf60",
"attrs": { "attrs": {
"title": "Model Name", "title": "Model Name",
"hidden": false, "hidden": false,
@@ -672,12 +672,12 @@
} }
}, },
"children": [], "children": [],
"parent": "4" "parent": "052ece2d-e32a-486c-9856-d07fd26e7ab2"
}, },
"4": { "4": {
"dragItem": { "dragItem": {
"type": "container", "type": "container",
"id": "4", "id": "052ece2d-e32a-486c-9856-d07fd26e7ab2",
"attrs": { "attrs": {
"title": "UpscaleModelLoader", "title": "UpscaleModelLoader",
"hidden": false, "hidden": false,
@@ -695,15 +695,15 @@
} }
}, },
"children": [ "children": [
"3" "ee2182f5-88e5-4f68-a6d4-1f39cd7c47e6"
], ],
"parent": "1" "parent": "c3414cbc-42d4-4c63-bdda-f960bac31fdd"
}, },
"5": { "5": {
"dragItem": { "dragItem": {
"type": "widget", "type": "widget",
"id": "5", "id": "74447132-c425-4db0-be80-57fdec6d4fc9",
"nodeId": 3, "nodeId": "8ad09059-f3fc-453f-8633-bd7281bc2802",
"attrs": { "attrs": {
"title": "Image", "title": "Image",
"hidden": false, "hidden": false,
@@ -721,13 +721,13 @@
} }
}, },
"children": [], "children": [],
"parent": "1" "parent": "c3414cbc-42d4-4c63-bdda-f960bac31fdd"
}, },
"6": { "6": {
"dragItem": { "dragItem": {
"type": "widget", "type": "widget",
"id": "6", "id": "6e754e38-5790-4e46-a4b7-dbe5fb9ee30d",
"nodeId": 4, "nodeId": "31918f22-9e41-446d-a024-a24c90bc5a45",
"attrs": { "attrs": {
"title": "Result", "title": "Result",
"hidden": false, "hidden": false,
@@ -745,13 +745,13 @@
} }
}, },
"children": [], "children": [],
"parent": "2" "parent": "bcacc84b-4d08-4ebb-977f-7b0be56543c1"
}, },
"9": { "9": {
"dragItem": { "dragItem": {
"type": "widget", "type": "widget",
"id": "9", "id": "d4c3177b-5d39-4293-9d6e-6abf941a94d4",
"nodeId": 9, "nodeId": "5c25a00f-c779-44b0-a09f-6915e7170536",
"attrs": { "attrs": {
"title": "Filename Prefix", "title": "Filename Prefix",
"hidden": false, "hidden": false,
@@ -769,13 +769,13 @@
} }
}, },
"children": [], "children": [],
"parent": "12" "parent": "6c0af451-b908-4850-a5cf-a458fc3147ed"
}, },
"11": { "11": {
"dragItem": { "dragItem": {
"type": "widget", "type": "widget",
"id": "11", "id": "e9e0d601-1cce-4de3-9885-1834df406efd",
"nodeId": 10, "nodeId": "257170fc-2503-4304-9d8c-fdc50f1fd0da",
"attrs": { "attrs": {
"title": "Clear Outputs", "title": "Clear Outputs",
"hidden": false, "hidden": false,
@@ -793,12 +793,12 @@
} }
}, },
"children": [], "children": [],
"parent": "12" "parent": "6c0af451-b908-4850-a5cf-a458fc3147ed"
}, },
"12": { "12": {
"dragItem": { "dragItem": {
"type": "container", "type": "container",
"id": "12", "id": "6c0af451-b908-4850-a5cf-a458fc3147ed",
"attrs": { "attrs": {
"title": "", "title": "",
"hidden": false, "hidden": false,
@@ -816,10 +816,258 @@
} }
}, },
"children": [ "children": [
"9", "d4c3177b-5d39-4293-9d6e-6abf941a94d4",
"11" "e9e0d601-1cce-4de3-9885-1834df406efd"
], ],
"parent": "2" "parent": "bcacc84b-4d08-4ebb-977f-7b0be56543c1"
},
"4d6c8745-5133-4d31-a33c-bc93f507ac45": {
"dragItem": {
"type": "container",
"id": "4d6c8745-5133-4d31-a33c-bc93f507ac45",
"attrs": {
"title": "",
"hidden": false,
"disabled": false,
"direction": "horizontal",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [
"c3414cbc-42d4-4c63-bdda-f960bac31fdd",
"bcacc84b-4d08-4ebb-977f-7b0be56543c1"
]
},
"c3414cbc-42d4-4c63-bdda-f960bac31fdd": {
"dragItem": {
"type": "container",
"id": "c3414cbc-42d4-4c63-bdda-f960bac31fdd",
"attrs": {
"title": "",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [
"74447132-c425-4db0-be80-57fdec6d4fc9",
"052ece2d-e32a-486c-9856-d07fd26e7ab2"
],
"parent": "4d6c8745-5133-4d31-a33c-bc93f507ac45"
},
"bcacc84b-4d08-4ebb-977f-7b0be56543c1": {
"dragItem": {
"type": "container",
"id": "bcacc84b-4d08-4ebb-977f-7b0be56543c1",
"attrs": {
"title": "",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [
"6e754e38-5790-4e46-a4b7-dbe5fb9ee30d",
"6c0af451-b908-4850-a5cf-a458fc3147ed"
],
"parent": "4d6c8745-5133-4d31-a33c-bc93f507ac45"
},
"ee2182f5-88e5-4f68-a6d4-1f39cd7c47e6": {
"dragItem": {
"type": "widget",
"id": "ee2182f5-88e5-4f68-a6d4-1f39cd7c47e6",
"nodeId": "47706464-4d82-4329-91a9-c9b2bec4cf60",
"attrs": {
"title": "Model Name",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [],
"parent": "052ece2d-e32a-486c-9856-d07fd26e7ab2"
},
"052ece2d-e32a-486c-9856-d07fd26e7ab2": {
"dragItem": {
"type": "container",
"id": "052ece2d-e32a-486c-9856-d07fd26e7ab2",
"attrs": {
"title": "UpscaleModelLoader",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [
"ee2182f5-88e5-4f68-a6d4-1f39cd7c47e6"
],
"parent": "c3414cbc-42d4-4c63-bdda-f960bac31fdd"
},
"74447132-c425-4db0-be80-57fdec6d4fc9": {
"dragItem": {
"type": "widget",
"id": "74447132-c425-4db0-be80-57fdec6d4fc9",
"nodeId": "8ad09059-f3fc-453f-8633-bd7281bc2802",
"attrs": {
"title": "Image",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [],
"parent": "c3414cbc-42d4-4c63-bdda-f960bac31fdd"
},
"6e754e38-5790-4e46-a4b7-dbe5fb9ee30d": {
"dragItem": {
"type": "widget",
"id": "6e754e38-5790-4e46-a4b7-dbe5fb9ee30d",
"nodeId": "31918f22-9e41-446d-a024-a24c90bc5a45",
"attrs": {
"title": "Result",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [],
"parent": "bcacc84b-4d08-4ebb-977f-7b0be56543c1"
},
"d4c3177b-5d39-4293-9d6e-6abf941a94d4": {
"dragItem": {
"type": "widget",
"id": "d4c3177b-5d39-4293-9d6e-6abf941a94d4",
"nodeId": "5c25a00f-c779-44b0-a09f-6915e7170536",
"attrs": {
"title": "Filename Prefix",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [],
"parent": "6c0af451-b908-4850-a5cf-a458fc3147ed"
},
"e9e0d601-1cce-4de3-9885-1834df406efd": {
"dragItem": {
"type": "widget",
"id": "e9e0d601-1cce-4de3-9885-1834df406efd",
"nodeId": "257170fc-2503-4304-9d8c-fdc50f1fd0da",
"attrs": {
"title": "Clear Outputs",
"hidden": false,
"disabled": false,
"direction": "vertical",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "secondary",
"buttonSize": "large",
"tags": []
}
},
"children": [],
"parent": "6c0af451-b908-4850-a5cf-a458fc3147ed"
},
"6c0af451-b908-4850-a5cf-a458fc3147ed": {
"dragItem": {
"type": "container",
"id": "6c0af451-b908-4850-a5cf-a458fc3147ed",
"attrs": {
"title": "",
"hidden": false,
"disabled": false,
"direction": "horizontal",
"classes": "",
"style": "",
"nodeDisabledState": "disabled",
"variant": "gallery",
"containerVariant": "block",
"openOnStartup": false,
"buttonVariant": "primary",
"buttonSize": "large",
"tags": []
}
},
"children": [
"d4c3177b-5d39-4293-9d6e-6abf941a94d4",
"e9e0d601-1cce-4de3-9885-1834df406efd"
],
"parent": "bcacc84b-4d08-4ebb-977f-7b0be56543c1"
} }
}, },
"currentId": 15, "currentId": 15,

View File

@@ -2,12 +2,13 @@ import type { Progress, SerializedPrompt, SerializedPromptInputs, SerializedProm
import type TypedEmitter from "typed-emitter"; import type TypedEmitter from "typed-emitter";
import EventEmitter from "events"; import EventEmitter from "events";
import type { GalleryOutput, GalleryOutputEntry } from "./nodes/ComfyWidgetNodes"; import type { GalleryOutput, GalleryOutputEntry } from "./nodes/ComfyWidgetNodes";
import type { SerializedLGraph } from "@litegraph-ts/core"; import type { SerializedLGraph, UUID } from "@litegraph-ts/core";
import type { SerializedLayoutState } from "./stores/layoutState";
export type ComfyPromptRequest = { export type ComfyPromptRequest = {
client_id?: string, client_id?: string,
prompt: SerializedPromptInputsAll, prompt: SerializedPromptInputsAll,
extra_data: ComfyPromptExtraData, extra_data: ComfyBoxPromptExtraData,
front?: boolean, front?: boolean,
number?: number number?: number
} }
@@ -29,14 +30,14 @@ export type ComfyAPIQueueResponse = {
error?: string error?: string
} }
export type NodeID = string; export type NodeID = UUID;
export type PromptID = string; // UUID export type PromptID = UUID; // UUID
export type ComfyAPIHistoryItem = [ export type ComfyAPIHistoryItem = [
number, // prompt number number, // prompt number
PromptID, PromptID,
SerializedPromptInputsAll, SerializedPromptInputsAll,
ComfyPromptExtraData, ComfyBoxPromptExtraData,
NodeID[] // good outputs NodeID[] // good outputs
] ]
@@ -56,14 +57,18 @@ export type ComfyAPIHistoryResponse = {
} }
export type ComfyPromptPNGInfo = { export type ComfyPromptPNGInfo = {
workflow: SerializedLGraph workflow: SerializedLGraph,
comfyBoxLayout: SerializedLayoutState,
comfyBoxSubgraphs: string[],
} }
export type ComfyPromptExtraData = { export type ComfyBoxPromptExtraData = ComfyUIPromptExtraData & {
thumbnails?: GalleryOutputEntry[],
}
export type ComfyUIPromptExtraData = {
extra_pnginfo?: ComfyPromptPNGInfo, extra_pnginfo?: ComfyPromptPNGInfo,
client_id?: string, // UUID client_id?: UUID, // UUID
subgraphs: string[],
thumbnails?: GalleryOutputEntry[]
} }
type ComfyAPIEvents = { type ComfyAPIEvents = {

View File

@@ -1,6 +1,6 @@
import { LiteGraph, LGraph, LGraphCanvas, LGraphNode, type LGraphNodeConstructor, type LGraphNodeExecutable, type SerializedLGraph, type SerializedLGraphGroup, type SerializedLGraphNode, type SerializedLLink, NodeMode, type Vector2, BuiltInSlotType, type INodeInputSlot } from "@litegraph-ts/core"; import { LiteGraph, LGraph, LGraphCanvas, LGraphNode, type LGraphNodeConstructor, type LGraphNodeExecutable, type SerializedLGraph, type SerializedLGraphGroup, type SerializedLGraphNode, type SerializedLLink, NodeMode, type Vector2, BuiltInSlotType, type INodeInputSlot } from "@litegraph-ts/core";
import type { LConnectionKind, INodeSlot } from "@litegraph-ts/core"; import type { LConnectionKind, INodeSlot } from "@litegraph-ts/core";
import ComfyAPI, { type ComfyAPIStatusResponse, type ComfyPromptExtraData, type ComfyPromptRequest, type NodeID, type PromptID } from "$lib/api" import ComfyAPI, { type ComfyAPIStatusResponse, type ComfyBoxPromptExtraData, type ComfyPromptRequest, type NodeID, type PromptID } from "$lib/api"
import { getPngMetadata, importA1111 } from "$lib/pnginfo"; import { getPngMetadata, importA1111 } from "$lib/pnginfo";
import EventEmitter from "events"; import EventEmitter from "events";
import type TypedEmitter from "typed-emitter"; import type TypedEmitter from "typed-emitter";
@@ -349,7 +349,7 @@ export default class ComfyApp {
this.api.addEventListener("executed", (promptID: PromptID, nodeID: NodeID, output: GalleryOutput) => { this.api.addEventListener("executed", (promptID: PromptID, nodeID: NodeID, output: GalleryOutput) => {
this.nodeOutputs[nodeID] = output; this.nodeOutputs[nodeID] = output;
const node = this.lGraph.getNodeById(parseInt(nodeID)) as ComfyGraphNode; const node = this.lGraph.getNodeById(nodeID) as ComfyGraphNode;
if (node?.onExecuted) { if (node?.onExecuted) {
node.onExecuted(output); node.onExecuted(output);
} }
@@ -467,7 +467,6 @@ export default class ComfyApp {
state = structuredClone(blankGraph) state = structuredClone(blankGraph)
} }
await this.deserialize(state) await this.deserialize(state)
uiState.update(s => { s.uiUnlocked = true; return s; })
} }
/** /**
@@ -558,7 +557,7 @@ export default class ComfyApp {
* Converts the current graph workflow for sending to the API * Converts the current graph workflow for sending to the API
* @returns The workflow and node links * @returns The workflow and node links
*/ */
async graphToPrompt(tag: string | null = null): Promise<SerializedPrompt> { graphToPrompt(tag: string | null = null): SerializedPrompt {
// Run frontend-only logic // Run frontend-only logic
this.lGraph.runStep(1) this.lGraph.runStep(1)
@@ -754,14 +753,16 @@ export default class ComfyApp {
} }
} }
const p = await this.graphToPrompt(tag); const p = this.graphToPrompt(tag);
const l = layoutState.serialize();
console.debug(promptToGraphVis(p)) console.debug(promptToGraphVis(p))
const extraData: ComfyPromptExtraData = { const extraData: ComfyBoxPromptExtraData = {
extra_pnginfo: { extra_pnginfo: {
workflow: p.workflow workflow: p.workflow,
comfyBoxLayout: l,
comfyBoxSubgraphs: [tag],
}, },
subgraphs: [tag],
thumbnails thumbnails
} }

View File

@@ -157,8 +157,10 @@
let showModal = false; let showModal = false;
let selectedPrompt = null; let selectedPrompt = null;
let selectedImages = [];
function showPrompt(entry: QueueUIEntry, e: MouseEvent) { function showPrompt(entry: QueueUIEntry, e: MouseEvent) {
selectedPrompt = entry.entry.prompt; selectedPrompt = entry.entry.prompt;
selectedImages = entry.images;
showModal = true; showModal = true;
} }
@@ -178,7 +180,7 @@
<h1 style="padding-bottom: 1rem;">Prompt Details</h1> <h1 style="padding-bottom: 1rem;">Prompt Details</h1>
</div> </div>
{#if selectedPrompt} {#if selectedPrompt}
<PromptDisplay prompt={selectedPrompt} /> <PromptDisplay prompt={selectedPrompt} images={selectedImages} />
{/if} {/if}
</Modal> </Modal>
@@ -495,6 +497,9 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.queue-remaining { .queue-remaining {

View File

@@ -1,15 +1,22 @@
<script lang="ts"> <script lang="ts">
import { fade } from "svelte/transition";
import { TextBox } from "@gradio/form"; import { TextBox } from "@gradio/form";
import type { SerializedPromptInput, SerializedPromptInputsAll } from "./ComfyApp"; import type { SerializedPromptInput, SerializedPromptInputsAll } from "./ComfyApp";
import { Block, BlockLabel, BlockTitle } from "@gradio/atoms"; import { Block, BlockLabel, BlockTitle } from "@gradio/atoms";
import { JSON as JSONComponent } from "@gradio/json"; import { JSON as JSONComponent } from "@gradio/json";
import { JSON as JSONIcon, Copy, Check } from "@gradio/icons"; import { JSON as JSONIcon, Copy, Check } from "@gradio/icons";
import Accordion from "$lib/components/gradio/app/Accordion.svelte"; import Accordion from "$lib/components/gradio/app/Accordion.svelte";
import Gallery from "$lib/components/gradio/gallery/Gallery.svelte";
import type { Styles } from "@gradio/utils";
const splitLength = 50; const splitLength = 50;
export let prompt: SerializedPromptInputsAll; export let prompt: SerializedPromptInputsAll;
export let images: string[] = [];
let galleryStyle: Styles = {
grid_cols: [2],
object_fit: "cover",
}
function isInputLink(input: SerializedPromptInput): boolean { function isInputLink(input: SerializedPromptInput): boolean {
return Array.isArray(input) return Array.isArray(input)
@@ -55,6 +62,7 @@
</script> </script>
<div class="prompt-display"> <div class="prompt-display">
<div class="scroll-container">
<Block> <Block>
{#each Object.entries(prompt) as [nodeID, inputs], i} {#each Object.entries(prompt) as [nodeID, inputs], i}
{@const classType = inputs.class_type} {@const classType = inputs.class_type}
@@ -62,10 +70,9 @@
{#if filtered.length > 0} {#if filtered.length > 0}
<div class="accordion"> <div class="accordion">
<Block padding={true}> <Block padding={true}>
<Accordion label="Node {nodeID}: {classType}" open={false}> <Accordion label="Node {i+1}: {classType}" open={false}>
{#each filtered as [inputName, input]} {#each filtered as [inputName, input]}
<Block> <Block>
<BlockTitle>Input: {inputName}</BlockTitle>
<button class="copy-button" on:click={() => handleCopy(nodeID, inputName, input)}> <button class="copy-button" on:click={() => handleCopy(nodeID, inputName, input)}>
{#if copiedNodeID === nodeID && copiedInputName === inputName} {#if copiedNodeID === nodeID && copiedInputName === inputName}
<span class="copied-icon"> <span class="copied-icon">
@@ -104,14 +111,49 @@
{/each} {/each}
</Block> </Block>
</div> </div>
{#if images.length > 0}
<div class="image-container">
<Block>
<Gallery
value={images}
label=""
show_label={false}
style={galleryStyle}
root={""}
root_url={""}
/>
</Block>
</div>
{/if}
</div>
<style lang="scss"> <style lang="scss">
.prompt-display { .prompt-display {
overflow-y: scroll; width: 70vw;
width: 50vw;
height: 60vh; height: 60vh;
color: none; color: none;
display: flex;
flex-wrap: nowrap;
overflow-y: auto;
flex-direction: column;
@media (min-width: 1600px) {
flex-direction: row;
}
.scroll-container {
position: relative;
/* overflow-y: auto; */
flex: 1 1 0%;
}
.image-container {
position: relative;
flex: 1 1 0%;
max-width: 30vw;
}
.copy-button { .copy-button {
display: flex; display: flex;
position: absolute; position: absolute;

View File

@@ -530,7 +530,7 @@ export class ComfySetNodeModeAdvancedAction extends ComfyGraphNode {
} }
for (const [nodeId, newMode] of Object.entries(nodeChanges)) { for (const [nodeId, newMode] of Object.entries(nodeChanges)) {
this.graph.getNodeById(parseInt(nodeId)).changeMode(newMode); this.graph.getNodeById(nodeId).changeMode(newMode);
} }
const layout = get(layoutState); const layout = get(layoutState);

View File

@@ -47,7 +47,7 @@ function notifyToast(text: string, options: NotifyOptions) {
} }
else if (options.type === "warning") { else if (options.type === "warning") {
toastOptions.theme = { toastOptions.theme = {
'--toastBackground': 'var(--color-yellow-500)', '--toastBackground': 'var(--color-yellow-600)',
} }
} }
else if (options.type === "error") { else if (options.type === "error") {

View File

@@ -1,9 +1,10 @@
import { get, writable } from 'svelte/store'; import { get, writable } from 'svelte/store';
import type { Readable, Writable } from 'svelte/store'; import type { Writable } from 'svelte/store';
import type ComfyApp from "$lib/components/ComfyApp" import type ComfyApp from "$lib/components/ComfyApp"
import { type LGraphNode, type IWidget, type LGraph, NodeMode, type LGraphRemoveNodeOptions, type LGraphAddNodeOptions } from "@litegraph-ts/core" import { type LGraphNode, type IWidget, type LGraph, NodeMode, type LGraphRemoveNodeOptions, type LGraphAddNodeOptions, type UUID } from "@litegraph-ts/core"
import { dndzone, SHADOW_PLACEHOLDER_ITEM_ID } from 'svelte-dnd-action'; import { SHADOW_PLACEHOLDER_ITEM_ID } from 'svelte-dnd-action';
import type { ComfyWidgetNode } from '$lib/nodes'; import type { ComfyWidgetNode } from '$lib/nodes';
import type { NodeID } from '$lib/api';
type DragItemEntry = { type DragItemEntry = {
/* /*
@@ -58,12 +59,12 @@ export type LayoutState = {
* Items indexed by the litegraph node they're bound to * Items indexed by the litegraph node they're bound to
* Only contains drag items of type "widget" * Only contains drag items of type "widget"
*/ */
allItemsByNode: Record<number, DragItemEntry>, allItemsByNode: Record<NodeID, DragItemEntry>,
/* /*
* Next ID to use for instantiating a new drag item * Next ID to use for instantiating a new drag item
*/ */
currentId: number, currentId: UUID,
/* /*
* Selected drag items. * Selected drag items.
@@ -642,7 +643,7 @@ export interface WidgetLayout extends IDragItem {
node: ComfyWidgetNode node: ComfyWidgetNode
} }
export type DragItemID = string; export type DragItemID = UUID;
type LayoutStateOps = { type LayoutStateOps = {
addContainer: (parent: ContainerLayout | null, attrs: Partial<Attributes>, index?: number) => ContainerLayout, addContainer: (parent: ContainerLayout | null, attrs: Partial<Attributes>, index?: number) => ContainerLayout,
@@ -654,8 +655,8 @@ type LayoutStateOps = {
groupItems: (dragItems: IDragItem[], attrs?: Partial<Attributes>) => ContainerLayout, groupItems: (dragItems: IDragItem[], attrs?: Partial<Attributes>) => ContainerLayout,
ungroup: (container: ContainerLayout) => void, ungroup: (container: ContainerLayout) => void,
getCurrentSelection: () => IDragItem[], getCurrentSelection: () => IDragItem[],
findLayoutEntryForNode: (nodeId: number) => DragItemEntry | null, findLayoutEntryForNode: (nodeId: NodeID) => DragItemEntry | null,
findLayoutForNode: (nodeId: number) => IDragItem | null, findLayoutForNode: (nodeId: NodeID) => IDragItem | null,
serialize: () => SerializedLayoutState, serialize: () => SerializedLayoutState,
deserialize: (data: SerializedLayoutState, graph: LGraph) => void, deserialize: (data: SerializedLayoutState, graph: LGraph) => void,
initDefaultLayout: () => void, initDefaultLayout: () => void,
@@ -916,7 +917,7 @@ function ungroup(container: ContainerLayout) {
store.set(state) store.set(state)
} }
function findLayoutEntryForNode(nodeId: number): DragItemEntry | null { function findLayoutEntryForNode(nodeId: NodeID): DragItemEntry | null {
const state = get(store) const state = get(store)
const found = Object.entries(state.allItems).find(pair => const found = Object.entries(state.allItems).find(pair =>
pair[1].dragItem.type === "widget" pair[1].dragItem.type === "widget"
@@ -926,7 +927,7 @@ function findLayoutEntryForNode(nodeId: number): DragItemEntry | null {
return null; return null;
} }
function findLayoutForNode(nodeId: number): WidgetLayout | null { function findLayoutForNode(nodeId: NodeID): WidgetLayout | null {
const found = findLayoutEntryForNode(nodeId); const found = findLayoutEntryForNode(nodeId);
if (!found) if (!found)
return null; return null;
@@ -963,7 +964,7 @@ function initDefaultLayout() {
export type SerializedLayoutState = { export type SerializedLayoutState = {
root: DragItemID | null, root: DragItemID | null,
allItems: Record<DragItemID, SerializedDragEntry>, allItems: Record<DragItemID, SerializedDragEntry>,
currentId: number, currentId: UUID,
attrs: LayoutAttributes attrs: LayoutAttributes
} }
@@ -976,7 +977,7 @@ export type SerializedDragEntry = {
export type SerializedDragItem = { export type SerializedDragItem = {
type: string, type: string,
id: DragItemID, id: DragItemID,
nodeId: number | null, nodeId: UUID | null,
attrs: Attributes attrs: Attributes
} }

View File

@@ -1,4 +1,4 @@
import type { ComfyAPIHistoryEntry, ComfyAPIHistoryItem, ComfyAPIHistoryResponse, ComfyAPIQueueResponse, ComfyAPIStatusResponse, ComfyPromptExtraData, NodeID, PromptID } from "$lib/api"; import type { ComfyAPIHistoryEntry, ComfyAPIHistoryItem, ComfyAPIHistoryResponse, ComfyAPIQueueResponse, ComfyAPIStatusResponse, ComfyBoxPromptExtraData, NodeID, PromptID } from "$lib/api";
import type { Progress, SerializedPromptInputsAll, SerializedPromptOutputs } from "$lib/components/ComfyApp"; import type { Progress, SerializedPromptInputsAll, SerializedPromptOutputs } from "$lib/components/ComfyApp";
import type { GalleryOutput } from "$lib/nodes/ComfyWidgetNodes"; import type { GalleryOutput } from "$lib/nodes/ComfyWidgetNodes";
import notify from "$lib/notify"; import notify from "$lib/notify";
@@ -29,10 +29,11 @@ export type QueueEntry = {
finishedAt?: Date, finishedAt?: Date,
promptID: PromptID, promptID: PromptID,
prompt: SerializedPromptInputsAll, prompt: SerializedPromptInputsAll,
extraData: ComfyPromptExtraData, extraData: ComfyBoxPromptExtraData,
goodOutputs: NodeID[], goodOutputs: NodeID[],
/* Data not sent by Comfy's API, lost on page refresh */ /* Data not sent by ComfyUI's API, lost on page refresh */
/* Prompt outputs, collected while the prompt is still executing */ /* Prompt outputs, collected while the prompt is still executing */
outputs: SerializedPromptOutputs, outputs: SerializedPromptOutputs,
@@ -53,7 +54,7 @@ export type QueueState = {
queuePending: Writable<QueueEntry[]>, queuePending: Writable<QueueEntry[]>,
queueCompleted: Writable<CompletedQueueEntry[]>, queueCompleted: Writable<CompletedQueueEntry[]>,
queueRemaining: number | "X" | null; queueRemaining: number | "X" | null;
runningNodeID: number | null; runningNodeID: NodeID | null;
progress: Progress | null, progress: Progress | null,
isInterrupting: boolean isInterrupting: boolean
} }
@@ -170,7 +171,7 @@ function executingUpdated(promptID: PromptID, runningNodeID: NodeID | null) {
if (entry != null) { if (entry != null) {
entry.nodesRan.add(runningNodeID) entry.nodesRan.add(runningNodeID)
} }
s.runningNodeID = parseInt(runningNodeID); s.runningNodeID = runningNodeID;
} }
else { else {
// Prompt finished executing. // Prompt finished executing.

View File

@@ -106,7 +106,7 @@ export function promptToGraphVis(prompt: SerializedPrompt): string {
return out return out
} }
export function getNodeInfo(nodeId: number): string { export function getNodeInfo(nodeId: NodeID): string {
let app = (window as any).app; let app = (window as any).app;
if (!app || !app.lGraph) if (!app || !app.lGraph)
return String(nodeId); return String(nodeId);