- Replace the multi-root folder_paths.workflows workflow library with a scalar workflow_path setting (Settings > Library); remove the extra_folder_paths.workflows path and the standalone Model Paths editor. - Migrate pre-release settings.json files that still keep folder_paths.workflows / extra_folder_paths.workflows on startup, so an upgrade keeps the configured folder instead of silently losing it. - Add "Create LM-managed workflow" to the ComfyUI Graph menu and the File menu/command palette: it writes the serialized graph into the configured folder, stamps extra.lm_source and registers the entry in the scanner cache without forcing a rescan. - Attach the decode image of the client's last executed prompt as the workflow preview. The prompt id is sent with the create request and the backend only honors it while it is still the registry's current prompt, so a tab never borrows another tab's output; otherwise the card keeps the placeholder preview. - Detect library entries deleted/renamed while a graph still carries the marker: a link-status endpoint clears the stale extra.lm_source (on graph load, menu open and before create/update), and the write-back route returns 404 instead of recreating the document. - Collapse the workflows.noPaths standalone/ComfyUI split into a single description/hint; the folder is edited in Settings > Library in both modes, so the manual settings.json guidance and the standalone open-settings-folder fallback are gone. - Add the preview tensor conversion as a shared utility (reused by the recipe widget save path) and cover create, preview gating, link status, migration and menu injection with tests.
28 lines
936 B
Python
28 lines
936 B
Python
"""Tests for the shared decode-tensor to PNG conversion."""
|
|
|
|
import numpy as np
|
|
|
|
from py.utils.image_tensor import tensor_to_png_bytes
|
|
|
|
|
|
def test_tensor_to_png_bytes_accepts_float_and_uint8_arrays():
|
|
float_image = np.zeros((4, 4, 3), dtype=np.float32)
|
|
png = tensor_to_png_bytes(float_image)
|
|
assert png is not None
|
|
assert png.startswith(b"\x89PNG")
|
|
|
|
uint8_image = np.zeros((4, 4, 3), dtype=np.uint8)
|
|
assert tensor_to_png_bytes(uint8_image) is not None
|
|
|
|
|
|
def test_tensor_to_png_bytes_unwraps_tuples_and_batches():
|
|
batched = np.zeros((2, 4, 4, 3), dtype=np.float32)
|
|
assert tensor_to_png_bytes(batched) is not None
|
|
assert tensor_to_png_bytes((batched,)) is not None
|
|
|
|
|
|
def test_tensor_to_png_bytes_returns_none_for_unsupported_shapes():
|
|
assert tensor_to_png_bytes(None) is None
|
|
assert tensor_to_png_bytes(np.zeros((4, 4), dtype=np.float32)) is None
|
|
assert tensor_to_png_bytes((None,)) is None
|