Documentation
¶
Index ¶
- func GetPngMetadata(r io.Reader) (map[string]string, error)
- type ComfyClient
- func (c *ComfyClient) ClientID() string
- func (c *ComfyClient) EraseHistory() error
- func (c *ComfyClient) EraseHistoryItem(promptID string) error
- func (c *ComfyClient) GetEmbeddings() ([]string, error)
- func (c *ComfyClient) GetExtensions() ([]string, error)
- func (c *ComfyClient) GetImage(image_data DataOutputImages) (*[]byte, error)
- func (c *ComfyClient) GetObjectInfos() (*graphapi.NodeObjects, error)
- func (c *ComfyClient) GetPromptHistoryByID() (map[string]PromptHistoryItem, error)
- func (c *ComfyClient) GetPromptHistoryByIndex() ([]PromptHistoryItem, error)
- func (c *ComfyClient) GetQueueExecutionInfo() (*QueueExecInfo, error)
- func (c *ComfyClient) GetQueuedItem(prompt_id string) *QueueItem
- func (c *ComfyClient) GetSystemStats() (*SystemStats, error)
- func (c *ComfyClient) GetViewMetadata(folder string, file string) (string, error)
- func (c *ComfyClient) Init() error
- func (c *ComfyClient) Interrupt() error
- func (c *ComfyClient) IsInitialized() bool
- func (c *ComfyClient) NewGraphFromJsonFile(path string) (*graphapi.Graph, *[]string, error)
- func (c *ComfyClient) NewGraphFromJsonReader(r io.Reader) (*graphapi.Graph, *[]string, error)
- func (c *ComfyClient) NewGraphFromPNGFile(path string) (*graphapi.Graph, *[]string, error)
- func (c *ComfyClient) NewGraphFromPNGReader(r io.Reader) (*graphapi.Graph, *[]string, error)
- func (c *ComfyClient) OnWindowSocketMessage(msg string)
- func (c *ComfyClient) QueuePrompt(graph *graphapi.Graph) (*QueueItem, error)
- func (c *ComfyClient) UploadFileFromPath(filePath string, overwrite bool, filetype ImageType, subfolder string, ...) (string, error)
- func (c *ComfyClient) UploadFileFromReader(r io.Reader, filename string, overwrite bool, filetype ImageType, ...) (string, error)
- func (c *ComfyClient) UploadImage(img image.Image, filename string, overwrite bool, filetype ImageType, ...) (string, error)
- type ComfyClientCallbacks
- type DataOutputImages
- type GPU
- type ImageType
- type PrompErrorMessage
- type PromptError
- type PromptHistoryItem
- type PromptMessage
- func (p *PromptMessage) ToPromptMessageData() *PromptMessageData
- func (p *PromptMessage) ToPromptMessageExecuting() *PromptMessageExecuting
- func (p *PromptMessage) ToPromptMessageProgress() *PromptMessageProgress
- func (p *PromptMessage) ToPromptMessageQueued() *PromptMessageQueued
- func (p *PromptMessage) ToPromptMessageStarted() *PromptMessageStarted
- func (p *PromptMessage) ToPromptMessageStopped() *PromptMessageStopped
- type PromptMessageData
- type PromptMessageExecuting
- type PromptMessageProgress
- type PromptMessageQueued
- type PromptMessageStarted
- type PromptMessageStopped
- type PromptMessageStoppedException
- type QueueExecInfo
- type QueueItem
- type QueuedItemStoppedReason
- type System
- type SystemStats
- type WSCallback
- type WSMessageDataExecuted
- type WSMessageDataExecuting
- type WSMessageDataExecutionCached
- type WSMessageDataExecutionStart
- type WSMessageDataProgress
- type WSMessageDataStatus
- type WSMessageExecutionError
- type WSMessageExecutionInterrupted
- type WSStatusMessage
- type WebSocketConnection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComfyClient ¶
type ComfyClient struct {
// contains filtered or unexported fields
}
ComfyClient is the top level object that allows for interaction with the ComfyUI backend
func NewComfyClient ¶
func NewComfyClient(server_address string, server_port int, callbacks *ComfyClientCallbacks) *ComfyClient
NewComfyClient creates a new instance of a Comfy2go client
func (*ComfyClient) ClientID ¶
func (c *ComfyClient) ClientID() string
ClientID returns the unique client ID for the connection to the ComfyUI backend
func (*ComfyClient) EraseHistory ¶
func (c *ComfyClient) EraseHistory() error
func (*ComfyClient) EraseHistoryItem ¶
func (c *ComfyClient) EraseHistoryItem(promptID string) error
func (*ComfyClient) GetEmbeddings ¶
func (c *ComfyClient) GetEmbeddings() ([]string, error)
GetEmbeddings retrieves the list of Embeddings models installed on the ComfyUI server.
func (*ComfyClient) GetExtensions ¶
func (c *ComfyClient) GetExtensions() ([]string, error)
GetExtensions retrieves the list of extensions installed on the ComfyUI server.
func (*ComfyClient) GetImage ¶
func (c *ComfyClient) GetImage(image_data DataOutputImages) (*[]byte, error)
GetImage
func (*ComfyClient) GetObjectInfos ¶
func (c *ComfyClient) GetObjectInfos() (*graphapi.NodeObjects, error)
func (*ComfyClient) GetPromptHistoryByID ¶
func (c *ComfyClient) GetPromptHistoryByID() (map[string]PromptHistoryItem, error)
func (*ComfyClient) GetPromptHistoryByIndex ¶
func (c *ComfyClient) GetPromptHistoryByIndex() ([]PromptHistoryItem, error)
func (*ComfyClient) GetQueueExecutionInfo ¶
func (c *ComfyClient) GetQueueExecutionInfo() (*QueueExecInfo, error)
func (*ComfyClient) GetQueuedItem ¶
func (c *ComfyClient) GetQueuedItem(prompt_id string) *QueueItem
GetQueuedItem returns a QueueItem that was queued with the ComfyClient, that has not been processed yet or is currently being processed. Once a QueueItem has been processed, it will not be available with this method.
func (*ComfyClient) GetSystemStats ¶
func (c *ComfyClient) GetSystemStats() (*SystemStats, error)
func (*ComfyClient) GetViewMetadata ¶
func (c *ComfyClient) GetViewMetadata(folder string, file string) (string, error)
GetViewMetadata retrieves the '__metadata__' field in a safetensors file. checkpoints vae loras clip unet controlnet style_models clip_vision gligen configs hypernetworks upscale_models onnx fonts
func (*ComfyClient) Init ¶
func (c *ComfyClient) Init() error
Init starts the websocket connection (if not already connected) and retrieves the collection of node objects
func (*ComfyClient) Interrupt ¶
func (c *ComfyClient) Interrupt() error
func (*ComfyClient) IsInitialized ¶
func (c *ComfyClient) IsInitialized() bool
IsInitialized returns true if the client's websocket is connected
func (*ComfyClient) NewGraphFromJsonFile ¶
NewGraphFromJsonFile creates a new graph from a JSON file
func (*ComfyClient) NewGraphFromJsonReader ¶
NewGraphFromJsonReader creates a new graph from the data read from an io.Reader
func (*ComfyClient) NewGraphFromPNGFile ¶
NewGraphFromPNGReader extracts the workflow from PNG data read from a file and creates a new graph
func (*ComfyClient) NewGraphFromPNGReader ¶
NewGraphFromPNGReader extracts the workflow from PNG data read from an io.Reader and creates a new graph
func (*ComfyClient) OnWindowSocketMessage ¶
func (c *ComfyClient) OnWindowSocketMessage(msg string)
OnWindowSocketMessage processes each message received from the websocket connection to ComfyUI. The messages are parsed, and translated into PromptMessage structs and placed into the correct QueuedItem's message channel.
func (*ComfyClient) QueuePrompt ¶
func (c *ComfyClient) QueuePrompt(graph *graphapi.Graph) (*QueueItem, error)
func (*ComfyClient) UploadFileFromPath ¶
func (c *ComfyClient) UploadFileFromPath(filePath string, overwrite bool, filetype ImageType, subfolder string, targetProperty *graphapi.ImageUploadProperty) (string, error)
func (*ComfyClient) UploadFileFromReader ¶
func (*ComfyClient) UploadImage ¶
type ComfyClientCallbacks ¶
type ComfyClientCallbacks struct { ClientQueueCountChanged func(*ComfyClient, int) QueuedItemStarted func(*ComfyClient, *QueueItem) QueuedItemStopped func(*ComfyClient, *QueueItem, QueuedItemStoppedReason) QueuedItemDataAvailable func(*ComfyClient, *QueueItem, *PromptMessageData) }
type DataOutputImages ¶
type PrompErrorMessage ¶
type PrompErrorMessage struct { Error PromptError `json:"error"` NodeErrors []interface{} `json:"node_errors"` }
type PromptError ¶
type PromptHistoryItem ¶
type PromptMessage ¶
type PromptMessage struct { Type string Message interface{} }
func (*PromptMessage) ToPromptMessageData ¶
func (p *PromptMessage) ToPromptMessageData() *PromptMessageData
func (*PromptMessage) ToPromptMessageExecuting ¶
func (p *PromptMessage) ToPromptMessageExecuting() *PromptMessageExecuting
func (*PromptMessage) ToPromptMessageProgress ¶
func (p *PromptMessage) ToPromptMessageProgress() *PromptMessageProgress
func (*PromptMessage) ToPromptMessageQueued ¶
func (p *PromptMessage) ToPromptMessageQueued() *PromptMessageQueued
func (*PromptMessage) ToPromptMessageStarted ¶
func (p *PromptMessage) ToPromptMessageStarted() *PromptMessageStarted
func (*PromptMessage) ToPromptMessageStopped ¶
func (p *PromptMessage) ToPromptMessageStopped() *PromptMessageStopped
type PromptMessageData ¶
type PromptMessageData struct { NodeID int Images []DataOutputImages Gifs []DataOutputImages }
type PromptMessageExecuting ¶
type PromptMessageProgress ¶
type PromptMessageQueued ¶
type PromptMessageQueued struct { }
type PromptMessageStarted ¶
type PromptMessageStarted struct {
PromptID string `json:"prompt_id"`
}
type PromptMessageStopped ¶
type PromptMessageStopped struct { QueueItem *QueueItem Exception *PromptMessageStoppedException }
type QueueExecInfo ¶
type QueueExecInfo struct { ExecInfo struct { QueueRemaining int `json:"queue_remaining"` } `json:"exec_info"` }
type QueuedItemStoppedReason ¶
type QueuedItemStoppedReason string
const ( QueuedItemStoppedReasonFinished QueuedItemStoppedReason = "finished" QueuedItemStoppedReasonInterrupted QueuedItemStoppedReason = "interrupted" QueuedItemStoppedReasonError QueuedItemStoppedReason = "error" )
type SystemStats ¶
type WSCallback ¶
type WSCallback interface {
OnWindowSocketMessage(string)
}
type WSMessageDataExecuted ¶
type WSMessageDataExecuted struct { Node int `json:"node"` Output map[string]*[]DataOutputImages `json:"output"` // there may be other types of output besides "images" (hopefully text and latent images) PromptID string `json:"prompt_id"` }
func (*WSMessageDataExecuted) UnmarshalJSON ¶
func (mde *WSMessageDataExecuted) UnmarshalJSON(b []byte) error
type WSMessageDataExecuting ¶
func (*WSMessageDataExecuting) UnmarshalJSON ¶
func (mde *WSMessageDataExecuting) UnmarshalJSON(b []byte) error
type WSMessageDataExecutionCached ¶
type WSMessageDataExecutionCached struct { Nodes []interface{} `json:"nodes"` PromptID string `json:"prompt_id"` }
type WSMessageDataExecutionStart ¶
type WSMessageDataExecutionStart struct {
PromptID string `json:"prompt_id"`
}
type WSMessageDataProgress ¶
type WSMessageDataStatus ¶
type WSMessageDataStatus struct { Status struct { ExecInfo struct { QueueRemaining int `json:"queue_remaining"` } `json:"exec_info"` } `json:"status"` }
type WSMessageExecutionError ¶
type WSMessageExecutionError struct { PromptID string `json:"prompt_id"` Node string `json:"node_id"` NodeType string `json:"node_type"` Executed []string `json:"executed"` ExceptionMessage string `json:"exception_message"` ExceptionType string `json:"exception_type"` Traceback []string `json:"traceback"` CurrentInputs map[string]interface{} `json:"current_inputs"` CurrentOutputs map[int]interface{} `json:"current_outputs"` }
type WSStatusMessage ¶
type WSStatusMessage struct { Type string `json:"type"` Data interface{} `json:"Data"` }
func (*WSStatusMessage) UnmarshalJSON ¶
func (sm *WSStatusMessage) UnmarshalJSON(b []byte) error
type WebSocketConnection ¶
type WebSocketConnection struct { WebSocketURL string // The URL of the WebSocket Conn *websocket.Conn ConnectionDone chan bool IsConnected bool MaxRetry int RetryCount int Callback WSCallback // contains filtered or unexported fields }
func (*WebSocketConnection) Close ¶
func (w *WebSocketConnection) Close() error
Close the WebSocket connection
func (*WebSocketConnection) ConnectWithManager ¶
func (w *WebSocketConnection) ConnectWithManager() error
func (*WebSocketConnection) ConnectionManager ¶
func (w *WebSocketConnection) ConnectionManager()
Manage connection lifecycle
func (*WebSocketConnection) LockRead ¶
func (w *WebSocketConnection) LockRead()
func (*WebSocketConnection) UnlockRead ¶
func (w *WebSocketConnection) UnlockRead()