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
b9daf4e3
Commit
b9daf4e3
authored
May 19, 2023
by
comfyanonymous
Browse files
Add a /object_info/{node_class} route to get only the info of one node.
parent
e6e1999f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
+24
-13
server.py
server.py
+24
-13
No files found.
server.py
View file @
b9daf4e3
...
@@ -261,23 +261,34 @@ class PromptServer():
...
@@ -261,23 +261,34 @@ class PromptServer():
async
def
get_prompt
(
request
):
async
def
get_prompt
(
request
):
return
web
.
json_response
(
self
.
get_queue_info
())
return
web
.
json_response
(
self
.
get_queue_info
())
@
routes
.
get
(
"/object_info"
)
def
node_info
(
node_class
):
async
def
get_object_info
(
request
):
obj_class
=
nodes
.
NODE_CLASS_MAPPINGS
[
node_class
]
out
=
{}
for
x
in
nodes
.
NODE_CLASS_MAPPINGS
:
obj_class
=
nodes
.
NODE_CLASS_MAPPINGS
[
x
]
info
=
{}
info
=
{}
info
[
'input'
]
=
obj_class
.
INPUT_TYPES
()
info
[
'input'
]
=
obj_class
.
INPUT_TYPES
()
info
[
'output'
]
=
obj_class
.
RETURN_TYPES
info
[
'output'
]
=
obj_class
.
RETURN_TYPES
info
[
'output_is_list'
]
=
obj_class
.
OUTPUT_IS_LIST
if
hasattr
(
obj_class
,
'OUTPUT_IS_LIST'
)
else
[
False
]
*
len
(
obj_class
.
RETURN_TYPES
)
info
[
'output_is_list'
]
=
obj_class
.
OUTPUT_IS_LIST
if
hasattr
(
obj_class
,
'OUTPUT_IS_LIST'
)
else
[
False
]
*
len
(
obj_class
.
RETURN_TYPES
)
info
[
'output_name'
]
=
obj_class
.
RETURN_NAMES
if
hasattr
(
obj_class
,
'RETURN_NAMES'
)
else
info
[
'output'
]
info
[
'output_name'
]
=
obj_class
.
RETURN_NAMES
if
hasattr
(
obj_class
,
'RETURN_NAMES'
)
else
info
[
'output'
]
info
[
'name'
]
=
x
info
[
'name'
]
=
node_class
info
[
'display_name'
]
=
nodes
.
NODE_DISPLAY_NAME_MAPPINGS
[
x
]
if
x
in
nodes
.
NODE_DISPLAY_NAME_MAPPINGS
.
keys
()
else
x
info
[
'display_name'
]
=
nodes
.
NODE_DISPLAY_NAME_MAPPINGS
[
node_class
]
if
node_class
in
nodes
.
NODE_DISPLAY_NAME_MAPPINGS
.
keys
()
else
node_class
info
[
'description'
]
=
''
info
[
'description'
]
=
''
info
[
'category'
]
=
'sd'
info
[
'category'
]
=
'sd'
if
hasattr
(
obj_class
,
'CATEGORY'
):
if
hasattr
(
obj_class
,
'CATEGORY'
):
info
[
'category'
]
=
obj_class
.
CATEGORY
info
[
'category'
]
=
obj_class
.
CATEGORY
out
[
x
]
=
info
return
info
@
routes
.
get
(
"/object_info"
)
async
def
get_object_info
(
request
):
out
=
{}
for
x
in
nodes
.
NODE_CLASS_MAPPINGS
:
out
[
x
]
=
node_info
(
x
)
return
web
.
json_response
(
out
)
@
routes
.
get
(
"/object_info/{node_class}"
)
async
def
get_object_info_node
(
request
):
node_class
=
request
.
match_info
.
get
(
"node_class"
,
None
)
out
=
{}
if
(
node_class
is
not
None
)
and
(
node_class
in
nodes
.
NODE_CLASS_MAPPINGS
):
out
[
node_class
]
=
node_info
(
node_class
)
return
web
.
json_response
(
out
)
return
web
.
json_response
(
out
)
@
routes
.
get
(
"/history"
)
@
routes
.
get
(
"/history"
)
...
...
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