Save accumulator without rerunning workflow
This commit is contained in:
+11
-15
@@ -594,26 +594,22 @@ async function clearStore(node) {
|
||||
}
|
||||
|
||||
async function saveBatch(node) {
|
||||
const saveWidget = widget(node, "save_batch");
|
||||
if (!saveWidget) {
|
||||
alert("Missing save_batch widget.");
|
||||
const key = storeKey(node);
|
||||
if (!key) {
|
||||
alert("Set the same explicit store_key on the Accumulator and Accumulator Preview first.");
|
||||
return;
|
||||
}
|
||||
setWidgetValue(node, "finished", true);
|
||||
setWidgetValue(node, "save_batch", true);
|
||||
node.setDirtyCanvas?.(true, true);
|
||||
try {
|
||||
try {
|
||||
await app.queuePrompt(0, 1);
|
||||
} catch (_err) {
|
||||
await app.queuePrompt(0);
|
||||
}
|
||||
const data = await postJson("/sxcp/accumulator/save", actionPayload(node, {
|
||||
store_key: key,
|
||||
save_path: widget(node, "save_path")?.value || "sxcp_accumulator",
|
||||
filename_prefix: widget(node, "filename_prefix")?.value || "sxcp_accum",
|
||||
clear_after_save: !!widget(node, "clear_after_save")?.value,
|
||||
}));
|
||||
applyData(node, data, data.status || `saved=${data.saved || 0}`);
|
||||
} catch (err) {
|
||||
console.error(`[${EXTENSION}] save queue failed`, err);
|
||||
console.error(`[${EXTENSION}] direct save failed`, err);
|
||||
alert(`Save failed: ${err}`);
|
||||
} finally {
|
||||
setWidgetValue(node, "save_batch", false);
|
||||
node.setDirtyCanvas?.(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user