1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-04 07:52:46 +08:00

Merge branch 'master' into v3-definition

This commit is contained in:
Jedrzej Kosinski
2025-07-29 12:49:16 -07:00
19 changed files with 1534 additions and 239 deletions

View File

@@ -1176,7 +1176,7 @@ class PromptQueue:
return True
return False
def get_history(self, prompt_id=None, max_items=None, offset=-1):
def get_history(self, prompt_id=None, max_items=None, offset=-1, map_function=None):
with self.mutex:
if prompt_id is None:
out = {}
@@ -1185,13 +1185,21 @@ class PromptQueue:
offset = len(self.history) - max_items
for k in self.history:
if i >= offset:
out[k] = self.history[k]
p = self.history[k]
if map_function is not None:
p = map_function(p)
out[k] = p
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])}
p = self.history[prompt_id]
if map_function is None:
p = copy.deepcopy(p)
else:
p = map_function(p)
return {prompt_id: p}
else:
return {}