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
178fc763
Commit
178fc763
authored
Apr 01, 2023
by
pythongosssss
Browse files
Added a queue for the queue action
parent
0d972b85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
19 deletions
+44
-19
web/scripts/app.js
web/scripts/app.js
+44
-19
No files found.
web/scripts/app.js
View file @
178fc763
...
...
@@ -5,6 +5,15 @@ import { defaultGraph } from "./defaultGraph.js";
import
{
getPngMetadata
,
importA1111
}
from
"
./pnginfo.js
"
;
class
ComfyApp
{
/**
* List of {number, batchCount} entries to queue
*/
#
queueItems
=
[];
/**
* If the queue is currently being processed
*/
#
processingQueue
=
false
;
constructor
()
{
this
.
ui
=
new
ComfyUI
(
this
);
this
.
extensions
=
[];
...
...
@@ -915,6 +924,18 @@ class ComfyApp {
}
async
queuePrompt
(
number
,
batchCount
=
1
)
{
this
.
#
queueItems
.
push
({
number
,
batchCount
});
// Only have one action process the items so each one gets a unique seed correctly
if
(
this
.
#
processingQueue
)
{
return
;
}
this
.
#
processingQueue
=
true
;
try
{
while
(
this
.
#
queueItems
.
length
)
{
({
number
,
batchCount
}
=
this
.
#
queueItems
.
pop
());
for
(
let
i
=
0
;
i
<
batchCount
;
i
++
)
{
const
p
=
await
this
.
graphToPrompt
();
...
...
@@ -922,7 +943,7 @@ class ComfyApp {
await
api
.
queuePrompt
(
number
,
p
);
}
catch
(
error
)
{
this
.
ui
.
dialog
.
show
(
error
.
response
||
error
.
toString
());
return
;
break
;
}
for
(
const
n
of
p
.
workflow
.
nodes
)
{
...
...
@@ -942,6 +963,10 @@ class ComfyApp {
await
this
.
ui
.
queue
.
update
();
}
}
}
finally
{
this
.
#
processingQueue
=
false
;
}
}
/**
* Loads workflow data from the specified file
...
...
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