resolve

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolOption

func BoolOption(g workflow.Graph, keys ...string) (bool, bool)

func ClampDuration added in v0.29.0

func ClampDuration(value, min, max float64) float64

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

func ExtractDuration(g workflow.Graph) (float64, bool)

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

func ExtractPrompt(g workflow.Graph) (string, error)

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 Float64Option

func Float64Option(g workflow.Graph, keys ...string) (float64, bool)

func IntOption

func IntOption(g workflow.Graph, keys ...string) (int, bool)

func MergeJSONOption added in v0.9.0

func MergeJSONOption(g workflow.Graph, dst map[string]any, keys ...string)

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

func NormalizeImageSize(supported []string, w, h int) string

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 NormalizeOpenAIImageSize

func NormalizeOpenAIImageSize(width, height int) string

func NormalizeVideoSize added in v0.29.0

func NormalizeVideoSize(supported []string, w, h int) (int, int)

NormalizeVideoSize snaps width/height to the nearest supported video dimensions.

func ResolveLinkString

func ResolveLinkString(g workflow.Graph, ref []any, seen map[string]bool) (string, bool, error)

func ResolveNodeString

func ResolveNodeString(g workflow.Graph, nodeID string, seen map[string]bool) (string, bool, error)

func ResolveValueString

func ResolveValueString(g workflow.Graph, value any, seen map[string]bool) (string, bool, error)

func StringOption

func StringOption(g workflow.Graph, keys ...string) (string, bool)

Types

type Dimensions added in v0.29.0

type Dimensions struct {
	Width  int
	Height int
}

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

func ExtractImageSizeSpec(g workflow.Graph) SizeSpec

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

func ExtractVideoSizeSpec(g workflow.Graph) SizeSpec

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

func ParseDimensions(w, h int) SizeSpec

ParseDimensions creates a SizeSpec from pixel dimensions, automatically deriving the simplified aspect ratio.

func ParseSize added in v0.29.0

func ParseSize(raw string) SizeSpec

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

func (s SizeSpec) IsZero() bool

IsZero returns true if the spec contains no usable size information.

func (SizeSpec) SnapTo added in v0.29.0

func (s SizeSpec) SnapTo(supported []string) SizeSpec

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

func (s SizeSpec) ToAspectRatio() string

ToAspectRatio returns the simplified aspect ratio (e.g. "16:9").

func (SizeSpec) ToResolution added in v0.29.0

func (s SizeSpec) ToResolution() string

ToResolution returns the resolution label (e.g. "720P", "1080P").

func (SizeSpec) ToWAsteriskH added in v0.29.0

func (s SizeSpec) ToWAsteriskH() string

ToWAsteriskH returns the "W*H" format (e.g. "1024*1024"). Empty if no dimensions.

func (SizeSpec) ToWidthHeight added in v0.29.0

func (s SizeSpec) ToWidthHeight() (int, int)

ToWidthHeight returns the pixel dimensions. Returns (0, 0) if unavailable.

func (SizeSpec) ToWxH added in v0.29.0

func (s SizeSpec) ToWxH() string

ToWxH returns the "WxH" format (e.g. "1024x1024"). Empty if no dimensions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL