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
cf6e1efb
"examples/vscode:/vscode.git/clone" did not exist on "3fd31eef518b73ee592f82435f3d370a716ead4f"
Unverified
Commit
cf6e1efb
authored
May 14, 2024
by
freakabcd
Committed by
GitHub
May 13, 2024
Browse files
Show message on error when loading wf from file (works on drag and drop) (#3466)
parent
ece5acb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
web/scripts/app.js
web/scripts/app.js
+30
-18
No files found.
web/scripts/app.js
View file @
cf6e1efb
...
@@ -2157,6 +2157,14 @@ export class ComfyApp {
...
@@ -2157,6 +2157,14 @@ export class ComfyApp {
api
.
dispatchEvent
(
new
CustomEvent
(
"
promptQueued
"
,
{
detail
:
{
number
,
batchCount
}
}));
api
.
dispatchEvent
(
new
CustomEvent
(
"
promptQueued
"
,
{
detail
:
{
number
,
batchCount
}
}));
}
}
showErrorOnFileLoad
(
file
)
{
this
.
ui
.
dialog
.
show
(
$el
(
"
div
"
,
[
$el
(
"
p
"
,
{
textContent
:
`Unable to find workflow in
${
file
.
name
}
`
})
]).
outerHTML
);
}
/**
/**
* Loads workflow data from the specified file
* Loads workflow data from the specified file
* @param {File} file
* @param {File} file
...
@@ -2164,27 +2172,27 @@ export class ComfyApp {
...
@@ -2164,27 +2172,27 @@ export class ComfyApp {
async
handleFile
(
file
)
{
async
handleFile
(
file
)
{
if
(
file
.
type
===
"
image/png
"
)
{
if
(
file
.
type
===
"
image/png
"
)
{
const
pngInfo
=
await
getPngMetadata
(
file
);
const
pngInfo
=
await
getPngMetadata
(
file
);
if
(
pngInfo
)
{
if
(
pngInfo
?.
workflow
)
{
if
(
pngInfo
.
workflow
)
{
await
this
.
loadGraphData
(
JSON
.
parse
(
pngInfo
.
workflow
)
);
await
this
.
loadGraphData
(
JSON
.
parse
(
pngInfo
.
workflow
));
}
else
if
(
pngInfo
?.
prompt
)
{
}
else
if
(
pngInfo
.
prompt
)
{
this
.
loadApiJson
(
JSON
.
parse
(
pngInfo
.
prompt
)
);
this
.
loadApiJson
(
JSON
.
parse
(
pngInfo
.
p
rompt
));
}
else
if
(
pngInfo
?
.
p
arameters
)
{
}
else
if
(
pngInfo
.
parameters
)
{
importA1111
(
this
.
graph
,
pngInfo
.
parameters
)
;
importA1111
(
this
.
graph
,
pngInfo
.
parameters
);
}
else
{
}
this
.
showErrorOnFileLoad
(
file
);
}
}
}
else
if
(
file
.
type
===
"
image/webp
"
)
{
}
else
if
(
file
.
type
===
"
image/webp
"
)
{
const
pngInfo
=
await
getWebpMetadata
(
file
);
const
pngInfo
=
await
getWebpMetadata
(
file
);
if
(
pngInfo
)
{
// Support loading workflows from that webp custom node.
if
(
pngInfo
.
workflow
)
{
const
workflow
=
pngInfo
?
.
workflow
||
pngInfo
?.
Workflow
;
this
.
loadGraphData
(
JSON
.
parse
(
pngInfo
.
workflow
))
;
const
prompt
=
pngInfo
?.
prompt
||
pngInfo
?.
Prompt
;
}
else
if
(
pngInfo
.
Workflow
)
{
this
.
loadGraphData
(
JSON
.
parse
(
pngInfo
.
Workflow
));
// Support loading workflows from that webp custom node.
if
(
workflow
)
{
}
else
if
(
pngInfo
.
prompt
)
{
this
.
loadGraphData
(
JSON
.
parse
(
workflow
));
this
.
loadApiJson
(
JSON
.
parse
(
pngInfo
.
prompt
)
);
}
else
if
(
prompt
)
{
}
else
if
(
pngInfo
.
P
rompt
)
{
this
.
loadApiJson
(
JSON
.
parse
(
p
rompt
)
);
this
.
loadApiJson
(
JSON
.
parse
(
pngInfo
.
Prompt
));
// Support loading prompts from that webp custom node.
}
else
{
}
this
.
showErrorOnFileLoad
(
file
);
}
}
}
else
if
(
file
.
type
===
"
application/json
"
||
file
.
name
?.
endsWith
(
"
.json
"
))
{
}
else
if
(
file
.
type
===
"
application/json
"
||
file
.
name
?.
endsWith
(
"
.json
"
))
{
const
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
...
@@ -2205,7 +2213,11 @@ export class ComfyApp {
...
@@ -2205,7 +2213,11 @@ export class ComfyApp {
await
this
.
loadGraphData
(
JSON
.
parse
(
info
.
workflow
));
await
this
.
loadGraphData
(
JSON
.
parse
(
info
.
workflow
));
}
else
if
(
info
.
prompt
)
{
}
else
if
(
info
.
prompt
)
{
this
.
loadApiJson
(
JSON
.
parse
(
info
.
prompt
));
this
.
loadApiJson
(
JSON
.
parse
(
info
.
prompt
));
}
else
{
this
.
showErrorOnFileLoad
(
file
);
}
}
}
else
{
this
.
showErrorOnFileLoad
(
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