Save accumulator without rerunning workflow
This commit is contained in:
@@ -317,6 +317,31 @@ def accumulator_delete_entries(
|
||||
return result
|
||||
|
||||
|
||||
def accumulator_save_entries(
|
||||
store_key: str,
|
||||
save_path: str = "sxcp_accumulator",
|
||||
filename_prefix: str = "sxcp_accum",
|
||||
clear_after_save: bool = False,
|
||||
preview_limit: int = 0,
|
||||
) -> dict[str, Any]:
|
||||
key = str(store_key or "").strip()
|
||||
if not key:
|
||||
raise ValueError("store_key is required for accumulator save")
|
||||
store = _ACCUMULATOR_STORES.setdefault(key, [])
|
||||
saved_paths = _save_images_to_folder(store, save_path, filename_prefix, None, None)
|
||||
if saved_paths and bool(clear_after_save):
|
||||
store.clear()
|
||||
result = accumulator_list_entries(key, preview_limit=preview_limit)
|
||||
result["saved_paths"] = saved_paths
|
||||
result["saved"] = len(saved_paths)
|
||||
result["cleared_after_save"] = bool(saved_paths and clear_after_save)
|
||||
result["status"] = (
|
||||
f"{result.get('status', '')}; saved={len(saved_paths)}"
|
||||
f"{'; cleared_after_save' if saved_paths and clear_after_save else ''}"
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
def accumulator_move_entry(
|
||||
store_key: str,
|
||||
preview_key: str = "",
|
||||
|
||||
Reference in New Issue
Block a user