Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
40963b5a
"...data/git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "42fe769cca0f9f922e3f4a4564fa1b6357c8a7db"
Commit
40963b5a
authored
Oct 26, 2023
by
comfyanonymous
Browse files
Apply primitive nodes to graph before serializing workflow.
parent
723847f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
17 deletions
+25
-17
web/scripts/app.js
web/scripts/app.js
+10
-4
web/scripts/ui.js
web/scripts/ui.js
+15
-13
No files found.
web/scripts/app.js
View file @
40963b5a
...
@@ -1586,6 +1586,16 @@ export class ComfyApp {
...
@@ -1586,6 +1586,16 @@ export class ComfyApp {
* @returns The workflow and node links
* @returns The workflow and node links
*/
*/
async
graphToPrompt
()
{
async
graphToPrompt
()
{
for
(
const
node
of
this
.
graph
.
computeExecutionOrder
(
false
))
{
if
(
node
.
isVirtualNode
)
{
// Don't serialize frontend only nodes but let them make changes
if
(
node
.
applyToGraph
)
{
node
.
applyToGraph
();
}
continue
;
}
}
const
workflow
=
this
.
graph
.
serialize
();
const
workflow
=
this
.
graph
.
serialize
();
const
output
=
{};
const
output
=
{};
// Process nodes in order of execution
// Process nodes in order of execution
...
@@ -1593,10 +1603,6 @@ export class ComfyApp {
...
@@ -1593,10 +1603,6 @@ export class ComfyApp {
const
n
=
workflow
.
nodes
.
find
((
n
)
=>
n
.
id
===
node
.
id
);
const
n
=
workflow
.
nodes
.
find
((
n
)
=>
n
.
id
===
node
.
id
);
if
(
node
.
isVirtualNode
)
{
if
(
node
.
isVirtualNode
)
{
// Don't serialize frontend only nodes but let them make changes
if
(
node
.
applyToGraph
)
{
node
.
applyToGraph
(
workflow
);
}
continue
;
continue
;
}
}
...
...
web/scripts/ui.js
View file @
40963b5a
...
@@ -719,20 +719,22 @@ export class ComfyUI {
...
@@ -719,20 +719,22 @@ export class ComfyUI {
filename
+=
"
.json
"
;
filename
+=
"
.json
"
;
}
}
}
}
const
json
=
JSON
.
stringify
(
app
.
graph
.
serialize
(),
null
,
2
);
// convert the data to a JSON string
app
.
graphToPrompt
().
then
(
p
=>
{
const
blob
=
new
Blob
([
json
],
{
type
:
"
application/json
"
});
const
json
=
JSON
.
stringify
(
p
.
workflow
,
null
,
2
);
// convert the data to a JSON string
const
url
=
URL
.
createObjectURL
(
blob
);
const
blob
=
new
Blob
([
json
],
{
type
:
"
application/json
"
});
const
a
=
$el
(
"
a
"
,
{
const
url
=
URL
.
createObjectURL
(
blob
);
href
:
url
,
const
a
=
$el
(
"
a
"
,
{
download
:
filename
,
href
:
url
,
style
:
{
display
:
"
none
"
},
download
:
filename
,
parent
:
document
.
body
,
style
:
{
display
:
"
none
"
},
parent
:
document
.
body
,
});
a
.
click
();
setTimeout
(
function
()
{
a
.
remove
();
window
.
URL
.
revokeObjectURL
(
url
);
},
0
);
});
});
a
.
click
();
setTimeout
(
function
()
{
a
.
remove
();
window
.
URL
.
revokeObjectURL
(
url
);
},
0
);
},
},
}),
}),
$el
(
"
button
"
,
{
$el
(
"
button
"
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment