Browse Source

Add a /history/{prompt_id} endpoint.

pull/764/head
comfyanonymous 1 year ago
parent
commit
af91df85c2
  1. 9
      execution.py
  2. 5
      server.py

9
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:

5
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 = {}

Loading…
Cancel
Save