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
e14b79c1
"...resnet50_tensorflow.git" did not exist on "14f78b2cbd9424638d76e1c8ae09390e2213e637"
Commit
e14b79c1
authored
Mar 03, 2023
by
pythongosssss
Browse files
Changed to store resolved prompt in workflow info
parent
4ef4cf91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
web/extensions/core/dynamicPrompts.js
web/extensions/core/dynamicPrompts.js
+4
-4
web/scripts/app.js
web/scripts/app.js
+4
-3
No files found.
web/extensions/core/dynamicPrompts.js
View file @
e14b79c1
...
@@ -6,9 +6,6 @@ import { app } from "../../scripts/app.js";
...
@@ -6,9 +6,6 @@ import { app } from "../../scripts/app.js";
app
.
registerExtension
({
app
.
registerExtension
({
name
:
"
Comfy.DynamicPrompts
"
,
name
:
"
Comfy.DynamicPrompts
"
,
nodeCreated
(
node
)
{
nodeCreated
(
node
)
{
// TODO: Change this to replace the value and restore it after posting
if
(
node
.
widgets
)
{
if
(
node
.
widgets
)
{
// Locate dynamic prompt text widgets
// Locate dynamic prompt text widgets
// Include any widgets with dynamicPrompts set to true, and customtext
// Include any widgets with dynamicPrompts set to true, and customtext
...
@@ -17,7 +14,7 @@ app.registerExtension({
...
@@ -17,7 +14,7 @@ app.registerExtension({
);
);
for
(
const
widget
of
widgets
)
{
for
(
const
widget
of
widgets
)
{
// Override the serialization of the value to resolve dynamic prompts for all widgets supporting it in this node
// Override the serialization of the value to resolve dynamic prompts for all widgets supporting it in this node
widget
.
serializeValue
=
()
=>
{
widget
.
serializeValue
=
(
workflowNode
,
widgetIndex
)
=>
{
let
prompt
=
widget
.
value
;
let
prompt
=
widget
.
value
;
while
(
prompt
.
replace
(
"
\\
{
"
,
""
).
includes
(
"
{
"
)
&&
prompt
.
replace
(
"
\\
}
"
,
""
).
includes
(
"
}
"
))
{
while
(
prompt
.
replace
(
"
\\
{
"
,
""
).
includes
(
"
{
"
)
&&
prompt
.
replace
(
"
\\
}
"
,
""
).
includes
(
"
}
"
))
{
const
startIndex
=
prompt
.
replace
(
"
\\
{
"
,
"
00
"
).
indexOf
(
"
{
"
);
const
startIndex
=
prompt
.
replace
(
"
\\
{
"
,
"
00
"
).
indexOf
(
"
{
"
);
...
@@ -32,6 +29,9 @@ app.registerExtension({
...
@@ -32,6 +29,9 @@ app.registerExtension({
prompt
=
prompt
.
substring
(
0
,
startIndex
)
+
randomOption
+
prompt
.
substring
(
endIndex
+
1
);
prompt
=
prompt
.
substring
(
0
,
startIndex
)
+
randomOption
+
prompt
.
substring
(
endIndex
+
1
);
}
}
// Overwrite the value in the serialized workflow pnginfo
workflowNode
.
widgets_values
[
widgetIndex
]
=
prompt
;
return
prompt
;
return
prompt
;
};
};
}
}
...
...
web/scripts/app.js
View file @
e14b79c1
...
@@ -589,9 +589,10 @@ class ComfyApp {
...
@@ -589,9 +589,10 @@ class ComfyApp {
// Store all widget values
// Store all widget values
if
(
widgets
)
{
if
(
widgets
)
{
for
(
const
widget
of
widgets
)
{
for
(
const
i
in
widgets
)
{
const
widget
=
widgets
[
i
];
if
(
!
widget
.
options
||
widget
.
options
.
serialize
!==
false
)
{
if
(
!
widget
.
options
||
widget
.
options
.
serialize
!==
false
)
{
inputs
[
widget
.
name
]
=
widget
.
serializeValue
?
widget
.
serializeValue
()
:
widget
.
value
;
inputs
[
widget
.
name
]
=
widget
.
serializeValue
?
widget
.
serializeValue
(
n
,
i
)
:
widget
.
value
;
}
}
}
}
}
}
...
@@ -619,7 +620,7 @@ class ComfyApp {
...
@@ -619,7 +620,7 @@ class ComfyApp {
}
else
{
}
else
{
link
=
node
.
getInputLink
(
i
);
link
=
node
.
getInputLink
(
i
);
}
}
if
(
link
)
{
if
(
link
)
{
inputs
[
node
.
inputs
[
i
].
name
]
=
[
String
(
link
.
origin_id
),
parseInt
(
link
.
origin_slot
)];
inputs
[
node
.
inputs
[
i
].
name
]
=
[
String
(
link
.
origin_id
),
parseInt
(
link
.
origin_slot
)];
}
}
...
...
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