mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 16:54:03 +00:00
@@ -1,3 +1,6 @@
|
||||
import { HistoryTaskItem, PendingTaskItem, RunningTaskItem } from "/types/apiTypes";
|
||||
|
||||
|
||||
interface QueuePromptRequestBody {
|
||||
client_id: string;
|
||||
// Mapping from node id to node info + input values
|
||||
@@ -268,7 +271,7 @@ class ComfyApi extends EventTarget {
|
||||
* Gets the current state of the queue
|
||||
* @returns The currently running and queued items
|
||||
*/
|
||||
async getQueue() {
|
||||
async getQueue(): Promise<{ Running: RunningTaskItem[], Pending: PendingTaskItem[] }>{
|
||||
try {
|
||||
const res = await this.fetchApi("/queue");
|
||||
const data = await res.json();
|
||||
@@ -290,7 +293,7 @@ class ComfyApi extends EventTarget {
|
||||
* Gets the prompt execution history
|
||||
* @returns Prompt history including node outputs
|
||||
*/
|
||||
async getHistory(max_items = 200) {
|
||||
async getHistory(max_items: number = 200): Promise<{History: HistoryTaskItem[]}> {
|
||||
try {
|
||||
const res = await this.fetchApi(`/history?max_items=${max_items}`);
|
||||
return { History: Object.values(await res.json()) };
|
||||
|
||||
@@ -3,6 +3,7 @@ import { ComfyDialog as _ComfyDialog } from "./ui/dialog";
|
||||
import { toggleSwitch } from "./ui/toggleSwitch";
|
||||
import { ComfySettingsDialog } from "./ui/settings";
|
||||
import { ComfyApp, app } from "./app";
|
||||
import { TaskItem } from "/types/apiTypes";
|
||||
|
||||
export const ComfyDialog = _ComfyDialog;
|
||||
|
||||
@@ -221,9 +222,9 @@ class ComfyList {
|
||||
textContent: section,
|
||||
}),
|
||||
$el("div.comfy-list-items", [
|
||||
...(this.#reverse ? items[section].reverse() : items[section]).map((item) => {
|
||||
...(this.#reverse ? items[section].reverse() : items[section]).map((item: TaskItem) => {
|
||||
// Allow items to specify a custom remove action (e.g. for interrupt current prompt)
|
||||
const removeAction = item.remove || {
|
||||
const removeAction = "remove" in item ? item.remove : {
|
||||
name: "Delete",
|
||||
cb: () => api.deleteItem(this.#type, item.prompt[1]),
|
||||
};
|
||||
@@ -232,7 +233,7 @@ class ComfyList {
|
||||
textContent: "Load",
|
||||
onclick: async () => {
|
||||
await app.loadGraphData(item.prompt[3].extra_pnginfo.workflow, true, false);
|
||||
if (item.outputs) {
|
||||
if ("outputs" in item) {
|
||||
app.nodeOutputs = item.outputs;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user