Documentation
¶
Index ¶
- func BoolOption(g workflow.Graph, keys ...string) (bool, bool)
- func ClampDuration(value, min, max float64) float64
- func ExtractDuration(g workflow.Graph) (float64, bool)
- func ExtractPrompt(g workflow.Graph) (string, error)
- func Float64Option(g workflow.Graph, keys ...string) (float64, bool)
- func IntOption(g workflow.Graph, keys ...string) (int, bool)
- func MergeJSONOption(g workflow.Graph, dst map[string]any, keys ...string)
- func NormalizeImageSize(supported []string, w, h int) string
- func NormalizeOpenAIImageSize(width, height int) string
- func NormalizeVideoSize(supported []string, w, h int) (int, int)
- func ResolveLinkString(g workflow.Graph, ref []any, seen map[string]bool) (string, bool, error)
- func ResolveNodeString(g workflow.Graph, nodeID string, seen map[string]bool) (string, bool, error)
- func ResolveValueString(g workflow.Graph, value any, seen map[string]bool) (string, bool, error)
- func StringOption(g workflow.Graph, keys ...string) (string, bool)
- type Dimensions
- type SizeSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClampDuration ¶ added in v0.29.0
ClampDuration constrains a duration value within [min, max] seconds. If max <= 0, no upper bound is applied. If min <= 0, no lower bound is applied.
func ExtractDuration ¶ added in v0.29.0
ExtractDuration extracts the video/audio duration from the workflow graph. Priority: VideoOptions node > global option. Returns 0, false if no duration is found.
func ExtractPrompt ¶ added in v0.9.0
ExtractPrompt extracts a text prompt from the workflow graph. It first checks CLIPTextEncode nodes (with link resolution), then falls back to common option keys: "prompt", "text", "value".
func MergeJSONOption ¶ added in v0.9.0
MergeJSONOption searches for JSON-string inputs in the graph under the given keys and merges them into dst.
func NormalizeImageSize ¶ added in v0.29.0
NormalizeImageSize snaps width/height to the nearest supported image size string ("WxH"). This is the replacement for the legacy NormalizeOpenAIImageSize when a supported list is available.
func NormalizeVideoSize ¶ added in v0.29.0
NormalizeVideoSize snaps width/height to the nearest supported video dimensions.
func ResolveLinkString ¶
func ResolveNodeString ¶
func ResolveValueString ¶
Types ¶
type Dimensions ¶ added in v0.29.0
Dimensions represents pixel width and height.
type SizeSpec ¶ added in v0.29.0
type SizeSpec struct {
Dimensions *Dimensions
AspectRatio string // "W:H" (e.g. "16:9")
Resolution string // "720P", "1080P", etc.
}
SizeSpec is the canonical representation of size-related information extracted from a workflow graph. Engines use it to convert between formats.
func ExtractImageSizeSpec ¶ added in v0.29.0
ExtractImageSizeSpec extracts a unified SizeSpec for image tasks from the graph. Priority: ImageOptions node > global "size" option > EmptyLatentImage dimensions.
func ExtractVideoSizeSpec ¶ added in v0.29.0
ExtractVideoSizeSpec extracts a unified SizeSpec for video tasks from the graph. Priority: VideoOptions node > global options > EmptyLatentImage dimensions.
func ParseDimensions ¶ added in v0.29.0
ParseDimensions creates a SizeSpec from pixel dimensions, automatically deriving the simplified aspect ratio.
func ParseSize ¶ added in v0.29.0
ParseSize parses any known size format into a SizeSpec. Supported formats: "1024x1024", "1024*1024", "16:9", "720P", "720p".
func (SizeSpec) IsZero ¶ added in v0.29.0
IsZero returns true if the spec contains no usable size information.
func (SizeSpec) SnapTo ¶ added in v0.29.0
SnapTo finds the nearest supported size from the given list. Distance metric: aspect-ratio angle difference (primary), pixel area difference (secondary). Returns the original spec if supported is empty or no valid entry is found.
func (SizeSpec) ToAspectRatio ¶ added in v0.29.0
ToAspectRatio returns the simplified aspect ratio (e.g. "16:9").
func (SizeSpec) ToResolution ¶ added in v0.29.0
ToResolution returns the resolution label (e.g. "720P", "1080P").
func (SizeSpec) ToWAsteriskH ¶ added in v0.29.0
ToWAsteriskH returns the "W*H" format (e.g. "1024*1024"). Empty if no dimensions.
func (SizeSpec) ToWidthHeight ¶ added in v0.29.0
ToWidthHeight returns the pixel dimensions. Returns (0, 0) if unavailable.