Documentation ¶
Index ¶
- type BaseProperty
- func (b *BaseProperty) AttachSecondaryProperty(p Property)
- func (b *BaseProperty) GetAlias() string
- func (b *BaseProperty) GetTargetNode() *GraphNode
- func (b *BaseProperty) GetTargetWidget() int
- func (b *BaseProperty) GetValue() interface{}
- func (b *BaseProperty) Index() int
- func (b *BaseProperty) Serializable() bool
- func (b *BaseProperty) SetAlias(a string)
- func (b *BaseProperty) SetDirectValue(v *interface{})
- func (b *BaseProperty) SetIndex(index int)
- func (b *BaseProperty) SetSerializable(val bool)
- func (b *BaseProperty) SetTargetWidget(node *GraphNode, index int)
- func (b *BaseProperty) SetValue(v interface{}) error
- func (b *BaseProperty) TargetIndex() int
- func (b *BaseProperty) ToBoolProperty() (*BoolProperty, bool)
- func (b *BaseProperty) ToCascadeProperty() (*CascadingProperty, bool)
- func (b *BaseProperty) ToComboProperty() (*ComboProperty, bool)
- func (b *BaseProperty) ToFloatProperty() (*FloatProperty, bool)
- func (b *BaseProperty) ToImageUploadProperty() (*ImageUploadProperty, bool)
- func (b *BaseProperty) ToIntProperty() (*IntProperty, bool)
- func (b *BaseProperty) ToStringProperty() (*StringProperty, bool)
- func (b *BaseProperty) ToUnknownProperty() (*UnknownProperty, bool)
- func (b *BaseProperty) UpdateParent(parent Property)
- type BoolProperty
- type ByGraphOrdinal
- type CascadeGroup
- type CascadingProperty
- type CasdcadeEntry
- type ComboProperty
- type FloatProperty
- type Graph
- func (t *Graph) CreateNodeProperties(node_objects *NodeObjects) *[]string
- func (t *Graph) GetFirstNodeWithTitle(title string) *GraphNode
- func (t *Graph) GetGroupWithTitle(title string) *Group
- func (t *Graph) GetLinkById(id int) *Link
- func (t *Graph) GetNodeById(id int) *GraphNode
- func (t *Graph) GetNodesInGroup(g *Group) []*GraphNode
- func (t *Graph) GetNodesWithTitle(title string) []*GraphNode
- func (t *Graph) GetNodesWithType(nodeType string) []*GraphNode
- func (t *Graph) GetSimpleAPI(title *string) *SimpleAPI
- func (t *Graph) GraphToJSON() (string, error)
- func (t *Graph) GraphToPrompt(clientID string) (Prompt, error)
- func (t *Graph) ProcessSettableProperties(n *GraphNode, props *[]Property, pindex *int)
- func (t *Graph) SaveGraphToFile(path string) error
- func (t *Graph) UnmarshalJSON(b []byte) error
- type GraphNode
- func (n *GraphNode) ApplyToGraph()
- func (n *GraphNode) GetInputLink(slotIndex int) *Link
- func (n *GraphNode) GetInputWithName(name string) *Slot
- func (n *GraphNode) GetLinks() []int
- func (n *GraphNode) GetNodeForInput(slotIndex int) *GraphNode
- func (n *GraphNode) GetPropertiesByIndex() []Property
- func (n *GraphNode) GetPropertyWithName(name string) Property
- func (n *GraphNode) IsVirtual() bool
- func (n *GraphNode) IsWidgetValueArray() bool
- func (n *GraphNode) IsWidgetValueMap() bool
- func (n *GraphNode) WidgetValueCount() int
- func (n *GraphNode) WidgetValuesArray() []interface{}
- func (n *GraphNode) WidgetValuesMap() map[string]interface{}
- type Group
- type ImageUploadProperty
- type IntProperty
- type Link
- type NodeObject
- type NodeObjectInput
- type NodeObjects
- type Pos
- type Prompt
- type PromptExtraData
- type PromptNode
- type PromptWorkflow
- type Property
- type SimpleAPI
- type Size
- type Slot
- type StringProperty
- type UnknownProperty
- type Widget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseProperty ¶
type BaseProperty struct {
// contains filtered or unexported fields
}
func (*BaseProperty) AttachSecondaryProperty ¶
func (b *BaseProperty) AttachSecondaryProperty(p Property)
func (*BaseProperty) GetAlias ¶
func (b *BaseProperty) GetAlias() string
func (*BaseProperty) GetTargetNode ¶
func (b *BaseProperty) GetTargetNode() *GraphNode
func (*BaseProperty) GetTargetWidget ¶
func (b *BaseProperty) GetTargetWidget() int
func (*BaseProperty) GetValue ¶
func (b *BaseProperty) GetValue() interface{}
func (*BaseProperty) Index ¶
func (b *BaseProperty) Index() int
func (*BaseProperty) Serializable ¶
func (b *BaseProperty) Serializable() bool
func (*BaseProperty) SetAlias ¶
func (b *BaseProperty) SetAlias(a string)
func (*BaseProperty) SetDirectValue ¶
func (b *BaseProperty) SetDirectValue(v *interface{})
func (*BaseProperty) SetIndex ¶
func (b *BaseProperty) SetIndex(index int)
func (*BaseProperty) SetSerializable ¶
func (b *BaseProperty) SetSerializable(val bool)
func (*BaseProperty) SetTargetWidget ¶
func (b *BaseProperty) SetTargetWidget(node *GraphNode, index int)
func (*BaseProperty) SetValue ¶
func (b *BaseProperty) SetValue(v interface{}) error
SetValue calls the protocol implementation for valueFromString to get the actual value that will be set. valueFromString should perform conversion to its native type and constrain it when needed
func (*BaseProperty) TargetIndex ¶
func (b *BaseProperty) TargetIndex() int
func (*BaseProperty) ToBoolProperty ¶
func (b *BaseProperty) ToBoolProperty() (*BoolProperty, bool)
func (*BaseProperty) ToCascadeProperty ¶
func (b *BaseProperty) ToCascadeProperty() (*CascadingProperty, bool)
func (*BaseProperty) ToComboProperty ¶
func (b *BaseProperty) ToComboProperty() (*ComboProperty, bool)
func (*BaseProperty) ToFloatProperty ¶
func (b *BaseProperty) ToFloatProperty() (*FloatProperty, bool)
func (*BaseProperty) ToImageUploadProperty ¶
func (b *BaseProperty) ToImageUploadProperty() (*ImageUploadProperty, bool)
func (*BaseProperty) ToIntProperty ¶
func (b *BaseProperty) ToIntProperty() (*IntProperty, bool)
func (*BaseProperty) ToStringProperty ¶
func (b *BaseProperty) ToStringProperty() (*StringProperty, bool)
func (*BaseProperty) ToUnknownProperty ¶
func (b *BaseProperty) ToUnknownProperty() (*UnknownProperty, bool)
func (*BaseProperty) UpdateParent ¶
func (b *BaseProperty) UpdateParent(parent Property)
type BoolProperty ¶
type BoolProperty struct { BaseProperty Default bool LabelOn string LabelOff string }
func (*BoolProperty) Name ¶
func (p *BoolProperty) Name() string
func (*BoolProperty) Optional ¶
func (p *BoolProperty) Optional() bool
func (*BoolProperty) Settable ¶
func (p *BoolProperty) Settable() bool
func (*BoolProperty) TypeString ¶
func (p *BoolProperty) TypeString() string
type ByGraphOrdinal ¶
type ByGraphOrdinal []*GraphNode
allow us to order nodes by thier execution order (ordinality)
func (ByGraphOrdinal) Len ¶
func (a ByGraphOrdinal) Len() int
func (ByGraphOrdinal) Less ¶
func (a ByGraphOrdinal) Less(i, j int) bool
func (ByGraphOrdinal) Swap ¶
func (a ByGraphOrdinal) Swap(i, j int)
type CascadeGroup ¶
type CascadeGroup struct { Name string Entries []CasdcadeEntry }
func (*CascadeGroup) Properties ¶
func (c *CascadeGroup) Properties() []Property
type CascadingProperty ¶
type CascadingProperty struct { BaseProperty Groups []CascadeGroup SelectionIndex string }
func (*CascadingProperty) GetGroupByName ¶
func (p *CascadingProperty) GetGroupByName(name string) *CascadeGroup
func (*CascadingProperty) GroupNames ¶
func (p *CascadingProperty) GroupNames() []string
func (*CascadingProperty) Name ¶
func (p *CascadingProperty) Name() string
func (*CascadingProperty) Optional ¶
func (p *CascadingProperty) Optional() bool
func (*CascadingProperty) Settable ¶
func (p *CascadingProperty) Settable() bool
func (*CascadingProperty) TypeString ¶
func (p *CascadingProperty) TypeString() string
type CasdcadeEntry ¶
type ComboProperty ¶
type ComboProperty struct { BaseProperty Values []string IsBool bool }
func (*ComboProperty) Append ¶
func (p *ComboProperty) Append(newValue string)
Append will add the new value to the combo if it's not already available, and then sets the target property to the given value
func (*ComboProperty) Name ¶
func (p *ComboProperty) Name() string
func (*ComboProperty) Optional ¶
func (p *ComboProperty) Optional() bool
func (*ComboProperty) Settable ¶
func (p *ComboProperty) Settable() bool
func (*ComboProperty) TypeString ¶
func (p *ComboProperty) TypeString() string
type FloatProperty ¶
type FloatProperty struct { BaseProperty Default float64 Min float64 Max float64 Step float64 // contains filtered or unexported fields }
func (*FloatProperty) HasRange ¶
func (p *FloatProperty) HasRange() bool
func (*FloatProperty) HasStep ¶
func (p *FloatProperty) HasStep() bool
func (*FloatProperty) Name ¶
func (p *FloatProperty) Name() string
func (*FloatProperty) Optional ¶
func (p *FloatProperty) Optional() bool
func (*FloatProperty) Settable ¶
func (p *FloatProperty) Settable() bool
func (*FloatProperty) TypeString ¶
func (p *FloatProperty) TypeString() string
type Graph ¶
type Graph struct { Nodes []*GraphNode `json:"nodes"` Links []*Link `json:"links"` Groups []*Group `json:"groups"` LastNodeID int `json:"last_node_id"` LastLinkID int `json:"last_link_id"` Version float32 `json:"version"` NodesByID map[int]*GraphNode `json:"-"` LinksByID map[int]*Link `json:"-"` NodesInExecutionOrder []*GraphNode `json:"-"` HasErrors bool `json:"-"` }
func NewGraphFromJsonFile ¶
func NewGraphFromJsonFile(path string, node_objects *NodeObjects) (*Graph, *[]string, error)
func NewGraphFromJsonReader ¶
func NewGraphFromJsonString ¶
func NewGraphFromJsonString(data string, node_objects *NodeObjects) (*Graph, *[]string, error)
func (*Graph) CreateNodeProperties ¶
func (t *Graph) CreateNodeProperties(node_objects *NodeObjects) *[]string
CreateNodeProperties generates the properties required to allow setting values
Parameters:
- node_objects: NodeObjects returned from server
Returns:
- A pointer to an array of strings containing any missing nodes in the node_objects
func (*Graph) GetFirstNodeWithTitle ¶
GetFirstNodeWithTitle retrieves the first node from the graph based on a given title. If a node's title is not set, it falls back to matching against the node's display name.
Parameters:
- title: The title (or display name if title is absent) to filter nodes by.
Returns:
- A pointer to a GraphNode
func (*Graph) GetGroupWithTitle ¶
GetGroupWithTitle returns the 'first' group with the given title
func (*Graph) GetLinkById ¶
func (*Graph) GetNodeById ¶
func (*Graph) GetNodesInGroup ¶
func (*Graph) GetNodesWithTitle ¶
GetNodesWithTitle retrieves nodes from the graph based on a given title. If a node's title is not set, it falls back to matching against the node's display name.
Parameters:
- title: The title (or display name if title is absent) to filter nodes by.
Returns:
- A slice of pointers to GraphNodes that match the specified title or display name.
func (*Graph) GetNodesWithType ¶
GetNodesWithType retrieves all nodes in the graph that match a specified type.
Parameters:
- nodeType: The type of node to filter by.
Returns:
- A slice of pointers to GraphNodes that match the specified type.
func (*Graph) GetSimpleAPI ¶
GetSimpleAPI returns an instance of SimpleAPI SimpleAPI is a collection of nodes in the graph that are contained within a group with the given title. When title is nil, the default "API" group will be used
func (*Graph) GraphToJSON ¶
func (*Graph) ProcessSettableProperties ¶
func (*Graph) SaveGraphToFile ¶
func (*Graph) UnmarshalJSON ¶
type GraphNode ¶
type GraphNode struct { ID int `json:"id"` Type string `json:"type"` Position interface{} `json:"pos"` Size Size `json:"size"` Flags *interface{} `json:"flags"` Order int `json:"order"` Mode int `json:"mode"` Title string `json:"title"` InternalProperties *map[string]interface{} `json:"properties"` // node properties, not value properties! // widgets_values can be an array of values, or a map of values // maps of values can represent cascading style properties in which the setting // of one property makes certain other properties available WidgetValues interface{} `json:"widgets_values"` Color string `json:"color"` BGColor string `json:"bgcolor"` Inputs []Slot `json:"inputs,omitempty"` Outputs []Slot `json:"outputs,omitempty"` Graph *Graph `json:"-"` CustomData *interface{} `json:"-"` Widgets []*Widget `json:"-"` Properties map[string]Property `json:"-"` DisplayName string `json:"-"` Description string `json:"-"` IsOutput bool `json:"-"` }
GraphNode represents the encapsulation of an individual functionality within a Graph
func (*GraphNode) ApplyToGraph ¶
func (n *GraphNode) ApplyToGraph()
func (*GraphNode) GetInputLink ¶
func (*GraphNode) GetInputWithName ¶
func (*GraphNode) GetNodeForInput ¶
func (*GraphNode) GetPropertiesByIndex ¶
GetPropertesByIndex returns a slice of Properties ordered by thier order in the node desciption Because a properties index is for it's index in the node description, and not the index of the property in the node's properties, non-indexed properties will be nil in the returned slice
func (*GraphNode) GetPropertyWithName ¶
func (*GraphNode) IsWidgetValueArray ¶
func (*GraphNode) IsWidgetValueMap ¶
func (*GraphNode) WidgetValueCount ¶
func (*GraphNode) WidgetValuesArray ¶
func (n *GraphNode) WidgetValuesArray() []interface{}
func (*GraphNode) WidgetValuesMap ¶
type Group ¶
type Group struct { Title string `json:"title"` Bounding []int `json:"bounding"` Color string `json:"color"` }
func (*Group) IntersectsOrContains ¶
type ImageUploadProperty ¶
type ImageUploadProperty struct { BaseProperty TargetProperty *ComboProperty }
func (*ImageUploadProperty) Name ¶
func (p *ImageUploadProperty) Name() string
func (*ImageUploadProperty) Optional ¶
func (p *ImageUploadProperty) Optional() bool
func (*ImageUploadProperty) SetFilename ¶
func (p *ImageUploadProperty) SetFilename(filename string)
func (*ImageUploadProperty) Settable ¶
func (p *ImageUploadProperty) Settable() bool
func (*ImageUploadProperty) TypeString ¶
func (p *ImageUploadProperty) TypeString() string
type IntProperty ¶
type IntProperty struct { BaseProperty Default int64 Min int64 // optional Max int64 // optional Step int64 // optional // contains filtered or unexported fields }
func (*IntProperty) HasRange ¶
func (p *IntProperty) HasRange() bool
func (*IntProperty) HasStep ¶
func (p *IntProperty) HasStep() bool
func (*IntProperty) Name ¶
func (p *IntProperty) Name() string
func (*IntProperty) Optional ¶
func (p *IntProperty) Optional() bool
func (*IntProperty) Settable ¶
func (p *IntProperty) Settable() bool
func (*IntProperty) TypeString ¶
func (p *IntProperty) TypeString() string
type NodeObject ¶
type NodeObject struct { Input *NodeObjectInput `json:"input"` Output *[]interface{} `json:"output"` // output type OutputIsList *[]bool `json:"output_is_list"` OutputName *interface{} `json:"output_name"` Name string `json:"name"` DisplayName string `json:"display_name"` Description string `json:"description"` Category string `json:"category"` OutputNode bool `json:"output_node"` InputProperties []*Property `json:"-"` InputPropertiesByID map[string]*Property `json:"-"` }
NodeObject represents the metadata that describes how to generate an instance of a node for a graph.
func (*NodeObject) GetSettableProperties ¶
func (n *NodeObject) GetSettableProperties() []Property
GetSettablePropertiesByID returns a slice of Properties that are settable.
func (*NodeObject) GetSettablePropertiesByID ¶
func (n *NodeObject) GetSettablePropertiesByID() map[string]Property
GetSettablePropertiesByID returns a map of Properties that are settable.
type NodeObjectInput ¶
type NodeObjectInput struct { Required map[string]*interface{} `json:"required"` Optional map[string]*interface{} `json:"optional,omitempty"` OrderedRequired []string `json:"-"` OrderedOptional []string `json:"-"` }
func (*NodeObjectInput) UnmarshalJSON ¶
func (noi *NodeObjectInput) UnmarshalJSON(b []byte) error
NodeObjectInput custom UnmarshalJSON deserializtion maintains the order of the properties in the JSON
type NodeObjects ¶
type NodeObjects struct {
Objects map[string]*NodeObject
}
func (*NodeObjects) GetNodeObjectByName ¶
func (n *NodeObjects) GetNodeObjectByName(name string) *NodeObject
func (*NodeObjects) PopulateInputProperties ¶
func (n *NodeObjects) PopulateInputProperties()
type Prompt ¶
type Prompt struct { ClientID string `json:"client_id"` Nodes map[int]PromptNode `json:"prompt"` ExtraData PromptExtraData `json:"extra_data"` PID string `json:"pid"` }
Prompt is the data that is enqueued to an instance of ComfyUI
type PromptExtraData ¶
type PromptExtraData struct {
PngInfo PromptWorkflow `json:"extra_pnginfo"`
}
type PromptNode ¶
type PromptWorkflow ¶
type PromptWorkflow struct {
Workflow *Graph `json:"workflow"`
}
PromptWorkflow is the original Graph that was used to create the Prompt. It is added to generated PNG files such that the information needed to recreate the image is available.
type Property ¶
type Property interface { TypeString() string Optional() bool Settable() bool Name() string SetTargetWidget(node *GraphNode, index int) GetTargetWidget() int GetTargetNode() *GraphNode GetValue() interface{} SetValue(v interface{}) error Serializable() bool SetSerializable(bool) AttachSecondaryProperty(p Property) Index() int SetIndex(index int) TargetIndex() int SetAlias(string) GetAlias() string UpdateParent(parent Property) ToIntProperty() (*IntProperty, bool) ToFloatProperty() (*FloatProperty, bool) ToBoolProperty() (*BoolProperty, bool) ToStringProperty() (*StringProperty, bool) ToComboProperty() (*ComboProperty, bool) ToCascadeProperty() (*CascadingProperty, bool) ToImageUploadProperty() (*ImageUploadProperty, bool) ToUnknownProperty() (*UnknownProperty, bool) SetDirectValue(v *interface{}) // contains filtered or unexported methods }
Property is a node's input that can be a settable value Settable property types: "INT" an int64 "FLOAT" a float64 "STRING" a single line, or multiline string "COMBO" one of a given list of strings "BOOLEAN" a labeled bool value "IMAGEUPLOAD" image uploader "CASCADE" collection cascading style properties "UNKNOWN" everything else (unsettable)
type Size ¶
func (*Size) MarshalJSON ¶
it seems the json code can have either an array of values, or a dictionary of values when marshaling, we'll always output as an array.
func (*Size) UnmarshalJSON ¶
type Slot ¶
type Slot struct { Name string `json:"name"` // The name of the slot CustomType int `json:"-"` Node *GraphNode `json:"-"` // The node the slot belongs to Type string `json:"type"` // The type of the data the slot accepts Link int `json:"link,omitempty"` // Index of the link for an input slot Links *[]int `json:"links,omitempty"` // Array of links for output slots Widget *Widget `json:"widget,omitempty"` // Collection of widgets that allow setting properties Shape *int `json:"shape,omitempty"` SlotIndex *int `json:"slot_index,omitempty"` // Index of the Slot in relation to other Slots Property Property `json:"-"` // non-null for inputs that are exported widgets }
Slot represents a connection point within a GraphNode. It holds various properties that define the behavior and appearance of the connection, such as the name, type, associated widget, and more.
type StringProperty ¶
type StringProperty struct { BaseProperty Default string Multiline bool }
func (*StringProperty) Name ¶
func (p *StringProperty) Name() string
func (*StringProperty) Optional ¶
func (p *StringProperty) Optional() bool
func (*StringProperty) Settable ¶
func (p *StringProperty) Settable() bool
func (*StringProperty) TypeString ¶
func (p *StringProperty) TypeString() string
type UnknownProperty ¶
type UnknownProperty struct { BaseProperty TypeName string }
func (*UnknownProperty) Name ¶
func (p *UnknownProperty) Name() string
func (*UnknownProperty) Optional ¶
func (p *UnknownProperty) Optional() bool
func (*UnknownProperty) Settable ¶
func (p *UnknownProperty) Settable() bool
func (*UnknownProperty) TypeString ¶
func (p *UnknownProperty) TypeString() string