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
f6df7ce0
Commit
f6df7ce0
authored
Feb 17, 2023
by
m957ymj75urz
Browse files
Remove seed widget from nodes supporting dynamic prompting
parent
e2e5c4c5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
22 deletions
+1
-22
webshit/index.html
webshit/index.html
+1
-22
No files found.
webshit/index.html
View file @
f6df7ce0
...
...
@@ -176,14 +176,6 @@ function onObjectInfo(json) {
if
(
multiline
==
undefined
)
multiline
=
false
;
if
(
dynamic_prompt
==
undefined
)
dynamic_prompt
=
false
;
if
(
dynamic_prompt
)
{
w1
=
this
.
addWidget
(
"
number
"
,
"
seed
"
,
0
,
function
(
v
){
let
s
=
this
.
options
.
step
/
10
;
this
.
value
=
Math
.
round
(
v
/
s
)
*
s
;},
{
min
:
min_val
,
max
:
max_val
,
step
:
10.0
*
step_val
}
);
w2
=
this
.
addWidget
(
"
toggle
"
,
"
Random seed after every gen
"
,
true
,
function
(
v
){},
{
on
:
"
enabled
"
,
off
:
"
disabled
"
}
);
w2
.
to_randomize
=
w1
;
this
.
_widgets
+=
[
w1
,
w2
];
}
if
(
multiline
)
{
var
w
=
{
type
:
"
customtext
"
,
...
...
@@ -312,16 +304,6 @@ graph.onNodeRemoved = function(n) {
}
}
// from https://stackoverflow.com/a/47593316
function
rng_mulberry32
(
a
)
{
return
function
()
{
var
t
=
a
+=
0x6D2B79F5
;
t
=
Math
.
imul
(
t
^
t
>>>
15
,
t
|
1
);
t
^=
t
+
Math
.
imul
(
t
^
t
>>>
7
,
t
|
61
);
return
((
t
^
t
>>>
14
)
>>>
0
)
/
4294967296
;
}
}
function
graphToPrompt
()
{
let
s
=
graph
.
serialize
();
let
output
=
{};
...
...
@@ -337,9 +319,6 @@ function graphToPrompt() {
// find widgets declared as supporting dynamic prompting
var
supportedWidgets
=
n
.
widgets
.
filter
(
e
=>
e
.
dynamic_prompt
===
true
);
if
(
supportedWidgets
.
length
>
0
)
{
// find the seed widget to use for this node
var
seed
=
n
.
widgets
.
filter
(
e
=>
e
.
name
===
"
seed
"
)[
0
].
value
;
var
rng
=
rng_mulberry32
(
seed
);
// resolve dynamic prompts for all widgets supporting it in this node
for
(
let
i
in
supportedWidgets
)
...
...
@@ -359,7 +338,7 @@ function graphToPrompt() {
const
optionsString
=
prompt
.
substring
(
startIndex
+
1
,
endIndex
);
const
options
=
optionsString
.
split
(
'
|
'
);
const
randomIndex
=
Math
.
floor
(
rng
()
*
(
options
.
length
)
)
;
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
options
.
length
);
const
randomOption
=
options
[
randomIndex
];
prompt
=
prompt
.
substring
(
0
,
startIndex
)
+
randomOption
+
prompt
.
substring
(
endIndex
+
1
);
...
...
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