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
21553316
Commit
21553316
authored
Mar 09, 2023
by
m957ymj75urz
Browse files
add batch count to the menu
parent
4ed39cf0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
web/scripts/app.js
web/scripts/app.js
+21
-19
web/scripts/ui.js
web/scripts/ui.js
+7
-2
No files found.
web/scripts/app.js
View file @
21553316
...
@@ -641,31 +641,33 @@ class ComfyApp {
...
@@ -641,31 +641,33 @@ class ComfyApp {
return
{
workflow
,
output
};
return
{
workflow
,
output
};
}
}
async
queuePrompt
(
number
)
{
async
queuePrompt
(
number
,
batchCount
=
1
)
{
const
p
=
await
this
.
graphToPrompt
();
for
(
let
i
=
0
;
i
<
batchCount
;
i
++
)
{
const
p
=
await
this
.
graphToPrompt
();
try
{
try
{
await
api
.
queuePrompt
(
number
,
p
);
await
api
.
queuePrompt
(
number
,
p
);
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
ui
.
dialog
.
show
(
error
.
response
||
error
.
toString
());
this
.
ui
.
dialog
.
show
(
error
.
response
||
error
.
toString
());
return
;
return
;
}
}
for
(
const
n
of
p
.
workflow
.
nodes
)
{
for
(
const
n
of
p
.
workflow
.
nodes
)
{
const
node
=
graph
.
getNodeById
(
n
.
id
);
const
node
=
graph
.
getNodeById
(
n
.
id
);
if
(
node
.
widgets
)
{
if
(
node
.
widgets
)
{
for
(
const
widget
of
node
.
widgets
)
{
for
(
const
widget
of
node
.
widgets
)
{
// Allow widgets to run callbacks after a prompt has been queued
// Allow widgets to run callbacks after a prompt has been queued
// e.g. random seed after every gen
// e.g. random seed after every gen
if
(
widget
.
afterQueued
)
{
if
(
widget
.
afterQueued
)
{
widget
.
afterQueued
();
widget
.
afterQueued
();
}
}
}
}
}
}
}
}
this
.
canvas
.
draw
(
true
,
true
);
this
.
canvas
.
draw
(
true
,
true
);
await
this
.
ui
.
queue
.
update
();
await
this
.
ui
.
queue
.
update
();
}
}
}
/**
/**
...
...
web/scripts/ui.js
View file @
21553316
...
@@ -254,9 +254,14 @@ export class ComfyUI {
...
@@ -254,9 +254,14 @@ export class ComfyUI {
$el
(
"
span
"
,
{
$
:
(
q
)
=>
(
this
.
queueSize
=
q
)
}),
$el
(
"
span
"
,
{
$
:
(
q
)
=>
(
this
.
queueSize
=
q
)
}),
$el
(
"
button.comfy-settings-btn
"
,
{
textContent
:
"
⚙️
"
,
onclick
:
()
=>
this
.
settings
.
show
()
}),
$el
(
"
button.comfy-settings-btn
"
,
{
textContent
:
"
⚙️
"
,
onclick
:
()
=>
this
.
settings
.
show
()
}),
]),
]),
$el
(
"
button.comfy-queue-btn
"
,
{
textContent
:
"
Queue Prompt
"
,
onclick
:
()
=>
app
.
queuePrompt
(
0
)
}),
$el
(
"
div
"
,
{
style
:
{
width
:
"
100%
"
}},
[
$el
(
"
label
"
,
{
innerHTML
:
"
Batch count
"
},
[
$el
(
"
input
"
,
{
type
:
"
number
"
,
value
:
"
1
"
,
min
:
"
1
"
,
style
:
{
width
:
"
30%
"
,
"
margin-left
"
:
"
0.4em
"
},
onchange
:
(
i
)
=>
this
.
batchCount
=
i
.
target
.
value
})
]),
]),
$el
(
"
button.comfy-queue-btn
"
,
{
textContent
:
"
Queue Prompt
"
,
onclick
:
()
=>
app
.
queuePrompt
(
0
,
this
.
batchCount
)
}),
$el
(
"
div.comfy-menu-btns
"
,
[
$el
(
"
div.comfy-menu-btns
"
,
[
$el
(
"
button
"
,
{
textContent
:
"
Queue Front
"
,
onclick
:
()
=>
app
.
queuePrompt
(
-
1
)
}),
$el
(
"
button
"
,
{
textContent
:
"
Queue Front
"
,
onclick
:
()
=>
app
.
queuePrompt
(
-
1
,
this
.
batchCount
)
}),
$el
(
"
button
"
,
{
$el
(
"
button
"
,
{
$
:
(
b
)
=>
(
this
.
queue
.
button
=
b
),
$
:
(
b
)
=>
(
this
.
queue
.
button
=
b
),
textContent
:
"
View Queue
"
,
textContent
:
"
View Queue
"
,
...
...
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