Add a /history/{prompt_id} endpoint.
This commit is contained in:
parent
67833c83d8
commit
af91df85c2
|
@ -728,9 +728,14 @@ class PromptQueue:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_history(self):
|
def get_history(self, prompt_id=None):
|
||||||
with self.mutex:
|
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):
|
def wipe_history(self):
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
|
|
|
@ -372,6 +372,11 @@ class PromptServer():
|
||||||
async def get_history(request):
|
async def get_history(request):
|
||||||
return web.json_response(self.prompt_queue.get_history())
|
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")
|
@routes.get("/queue")
|
||||||
async def get_queue(request):
|
async def get_queue(request):
|
||||||
queue_info = {}
|
queue_info = {}
|
||||||
|
|
Loading…
Reference in New Issue