Browse Source

changed to store history by uniqueid

fixed removing history items
pull/17/head
pythongosssss 2 years ago committed by GitHub
parent
commit
9f391ab656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      main.py
  2. 12
      webshit/index.html

5
main.py

@ -335,10 +335,11 @@ class PromptQueue:
def task_done(self, item_id, outputs):
with self.mutex:
self.history[item_id] = { "prompt": self.currently_running.pop(item_id), "outputs": {} }
prompt = self.currently_running.pop(item_id)
self.history[prompt[1]] = { "prompt": prompt, "outputs": {} }
for o in outputs:
if "ui" in outputs[o]:
self.history[item_id]["outputs"][o] = outputs[o]["ui"]
self.history[prompt[1]]["outputs"][o] = outputs[o]["ui"]
self.server.queue_updated()
def get_current_queue(self):

12
webshit/index.html

@ -790,7 +790,7 @@ function loadItems(type) {
button.style.fontSize = "10px";
button.delete_id = id;
button.onclick = function(event) {
deleteQueueElement(type, event.target.delete_id, loadItems);
deleteQueueElement(type, event.target.delete_id, () => loadItems(type));
};
append_to_element.appendChild(button);
}
@ -807,11 +807,11 @@ function loadItems(type) {
if(type === "queue") {
items = data.queue_pending;
} else {
items = Object.values(data).map(d => d.prompt);
items = Object.values(data);
}
items.sort((a, b) => a[0] - b[0]);
for (let i in items) {
append_to_list(items[i], queuecontents, true, type === "queue"? null : data[i].outputs);
for (let i of items) {
append_to_list(type === "queue" ? i : i.prompt, queuecontents, true, i.outputs);
}
}).catch((response) => {console.log(response)});
}
@ -891,7 +891,7 @@ function clearItems(type) {
<br>
</div>
<span style="padding: 5px;display:inline-block;">
<button style="font-size: 12px;" onclick="clearQueue()">Clear Queue</button>
<button style="font-size: 12px;" onclick="clearItems('queue')">Clear Queue</button>
<button style="font-size: 12px;" onclick="loadQueue()">Refresh</button>
</span>
</div>
@ -901,7 +901,7 @@ function clearItems(type) {
<div id="historycontents" style="overflow-y: scroll;height: 100px;background-color: #d0d0d0;padding: 5px;">
</div>
<span style="padding: 5px;display:inline-block;">
<button style="font-size: 12px;" onclick="clearHistory()">Clear History</button>
<button style="font-size: 12px;" onclick="clearItems('history')">Clear History</button>
<button style="font-size: 12px;" onclick="loadHistory()">Refresh</button>
</span>
</div>

Loading…
Cancel
Save