Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Add a /history/{prompt_id} endpoint.

comfyanonymousaf91df85c27e
diff --git a/execution.py b/execution.py
index 218a84c36..fc9578bc8 100644
--- a/execution.py
+++ b/execution.py
@@ -728,9 +728,14 @@ class PromptQueue:
return True
return False
- def get_history(self):
+ def get_history(self, prompt_id=None):
with self.mutex:
- return copy.deepcopy(self.history)
+ if prompt_id is None:
+ return copy.deepcopy(self.history)
+ elif prompt_id in self.history:
+ return {prompt_id: copy.deepcopy(self.history[prompt_id])}
+ else:
+ return {}
def wipe_history(self):
with self.mutex:
diff --git a/server.py b/server.py
index 174d38af1..300221f6c 100644
--- a/server.py
+++ b/server.py
@@ -372,6 +372,11 @@ class PromptServer():
async def get_history(request):
return web.json_response(self.prompt_queue.get_history())
+ @routes.get("/history/{prompt_id}")
+ async def get_history(request):
+ prompt_id = request.match_info.get("prompt_id", None)
+ return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))
+
@routes.get("/queue")
async def get_queue(request):
queue_info = {}