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
2dd5b4dd
"mmdet3d/evaluation/vscode:/vscode.git/clone" did not exist on "c2c5abd6133a08fea84eb2abf78825a81ea49a21"
Commit
2dd5b4dd
authored
Nov 20, 2023
by
comfyanonymous
Browse files
Only show last 200 elements in the UI history tab.
parent
a03dde19
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
execution.py
execution.py
+12
-2
server.py
server.py
+4
-1
web/scripts/api.js
web/scripts/api.js
+1
-1
No files found.
execution.py
View file @
2dd5b4dd
...
...
@@ -750,10 +750,20 @@ class PromptQueue:
return
True
return
False
def
get_history
(
self
,
prompt_id
=
None
):
def
get_history
(
self
,
prompt_id
=
None
,
max_items
=
None
,
offset
=-
1
):
with
self
.
mutex
:
if
prompt_id
is
None
:
return
copy
.
deepcopy
(
self
.
history
)
out
=
{}
i
=
0
if
offset
<
0
and
max_items
is
not
None
:
offset
=
len
(
self
.
history
)
-
max_items
for
k
in
self
.
history
:
if
i
>=
offset
:
out
[
k
]
=
self
.
history
[
k
]
if
max_items
is
not
None
and
len
(
out
)
>=
max_items
:
break
i
+=
1
return
out
elif
prompt_id
in
self
.
history
:
return
{
prompt_id
:
copy
.
deepcopy
(
self
.
history
[
prompt_id
])}
else
:
...
...
server.py
View file @
2dd5b4dd
...
...
@@ -431,7 +431,10 @@ class PromptServer():
@
routes
.
get
(
"/history"
)
async
def
get_history
(
request
):
return
web
.
json_response
(
self
.
prompt_queue
.
get_history
())
max_items
=
request
.
rel_url
.
query
.
get
(
"max_items"
,
None
)
if
max_items
is
not
None
:
max_items
=
int
(
max_items
)
return
web
.
json_response
(
self
.
prompt_queue
.
get_history
(
max_items
=
max_items
))
@
routes
.
get
(
"/history/{prompt_id}"
)
async
def
get_history
(
request
):
...
...
web/scripts/api.js
View file @
2dd5b4dd
...
...
@@ -256,7 +256,7 @@ class ComfyApi extends EventTarget {
*/
async
getHistory
()
{
try
{
const
res
=
await
this
.
fetchApi
(
"
/history
"
);
const
res
=
await
this
.
fetchApi
(
"
/history
?max_items=200
"
);
return
{
History
:
Object
.
values
(
await
res
.
json
())
};
}
catch
(
error
)
{
console
.
error
(
error
);
...
...
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