Documentation
¶
Index ¶
- type Client
- func (c *Client) ConnectAndListen()
- func (c *Client) DeleteAllHistories() error
- func (c *Client) DeleteAllQueues() error
- func (c *Client) DeleteHistoryByPromptID(promptID string) error
- func (c *Client) DeleteQueueByPromptID(promptID string) error
- func (c *Client) GetAllHistories() ([]*PromptHistoryItem, error)
- func (c *Client) GetEmbeddings() ([]string, error)
- func (c *Client) GetExtensions() ([]string, error)
- func (c *Client) GetFile(image *DataOutputFile) (*[]byte, error)
- func (c *Client) GetHistoryByPromptID(promptID string) (*PromptHistoryItem, error)
- func (c *Client) GetObjectInfoByNodeName(name string) (*NodeObject, error)
- func (c *Client) GetObjectInfos() (map[string]*NodeObject, error)
- func (c *Client) GetQueueCount() int
- func (c *Client) GetQueueInfo() (*QueueInfo, error)
- func (c *Client) GetQueueRemaining() (uint64, error)
- func (c *Client) GetSystemStats() (*SystemStats, error)
- func (c *Client) GetTaskStatus() chan *WSMessage
- func (c *Client) GetViewMetadata(folderName string, fileName string) ([]byte, error)
- func (c *Client) Handle(msg string) error
- func (c *Client) InterruptExecution() error
- func (c *Client) IsInitialized() bool
- func (c *Client) QueuePromptByNodes(nodes map[string]PromptNode, extraDataString string) (*QueuePromptResp, error)
- func (c *Client) QueuePromptByString(workflow string, extraDataString string) (*QueuePromptResp, error)
- func (c *Client) SendTaskStatus(w *WSMessage) error
- func (c *Client) UploadImage(reader io.Reader, fileName string, overwrite bool, filetype ImageType, ...) (*UploadFile, error)
- func (c *Client) UploadMask(reader io.Reader, fileName string, overwrite bool, filetype ImageType, ...) (*UploadFile, error)
- type DataOutputFile
- type EndPoint
- type GPU
- type Handler
- type ImageType
- type NodeInfo
- type NodeObject
- type NodeObjectInput
- type PromptHistoryItem
- type PromptHistoryMember
- type PromptHistoryMemberImages
- type PromptNode
- type QueueExecInfo
- type QueueInfo
- type QueuePromptResp
- type Router
- type System
- type SystemStats
- type TaskStatusType
- type UploadFile
- type WSMessage
- type WSMessageDataExecuted
- type WSMessageDataExecuting
- type WSMessageDataExecutionCached
- type WSMessageDataExecutionStart
- type WSMessageDataProgress
- type WSMessageDataStatus
- type WSMessageExecutionError
- type WSMessageExecutionInterrupted
- type WebSocketConnection
- type WsMessageType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
ID string
// contains filtered or unexported fields
}
func NewDefaultClient ¶
func NewDefaultClientStr ¶
func (*Client) ConnectAndListen ¶
func (c *Client) ConnectAndListen()
func (*Client) DeleteAllHistories ¶
DeleteAllHistories deletes all histories
func (*Client) DeleteAllQueues ¶
DeleteAllQueues deletes all prompts in queue Delete all prompts in queue with this client sent, or it will not work
func (*Client) DeleteHistoryByPromptID ¶
DeleteHistoryByPromptID deletes history by promptID
func (*Client) DeleteQueueByPromptID ¶
DeleteQueueByPromptID deletes prompt in queue by promptID You must input promptID with this client sent, or it will not work
func (*Client) GetAllHistories ¶
func (c *Client) GetAllHistories() ([]*PromptHistoryItem, error)
GetAllHistories returns all histories
func (*Client) GetEmbeddings ¶
GetEmbeddings returns embeddings
func (*Client) GetExtensions ¶
GetExtensions returns extensions for frontend
func (*Client) GetFile ¶
func (c *Client) GetFile(image *DataOutputFile) (*[]byte, error)
GetFile returns file byte data
func (*Client) GetHistoryByPromptID ¶
func (c *Client) GetHistoryByPromptID(promptID string) (*PromptHistoryItem, error)
GetHistoryByPromptID returns history info by promptID
func (*Client) GetObjectInfoByNodeName ¶
func (c *Client) GetObjectInfoByNodeName(name string) (*NodeObject, error)
GetObjectInfoByNodeName returns node info by nodeName
func (*Client) GetObjectInfos ¶
func (c *Client) GetObjectInfos() (map[string]*NodeObject, error)
GetObjectInfos returns node infos in workflow
func (*Client) GetQueueCount ¶
func (*Client) GetQueueInfo ¶
GetQueueInfo returns queue info
func (*Client) GetQueueRemaining ¶
GetQueueRemaining returns queue remaining
func (*Client) GetSystemStats ¶
func (c *Client) GetSystemStats() (*SystemStats, error)
GetSystemStats returns system stats
func (*Client) GetTaskStatus ¶
func (*Client) GetViewMetadata ¶
GetViewMetadata returns view metadata
func (*Client) InterruptExecution ¶
InterruptExecution interrupts execution
func (*Client) IsInitialized ¶
func (*Client) QueuePromptByNodes ¶
func (c *Client) QueuePromptByNodes(nodes map[string]PromptNode, extraDataString string) (*QueuePromptResp, error)
QueuePromptByNodes queues a prompt and starts execution by workflow which type is map[string]PromptNode extraData must be a json string
func (*Client) QueuePromptByString ¶
func (c *Client) QueuePromptByString(workflow string, extraDataString string) (*QueuePromptResp, error)
QueuePromptByString queues a prompt and starts execution by workflow which type is string workflow must be a json string extraDataString must be a json string
func (*Client) SendTaskStatus ¶
type DataOutputFile ¶
type DataOutputFile struct {
Filename string `json:"filename"`
SubFolder string `json:"subfolder"`
Type string `json:"type"`
}
DataOutputFile export data address, name and type
type EndPoint ¶
func NewEndPoint ¶
type GPU ¶
type GPU struct {
Name string `json:"name"`
Type string `json:"type"`
Index int `json:"index"`
VRAMTotal int64 `json:"vram_total"`
VRAMFree int64 `json:"vram_free"`
TorchVRAMTotal int64 `json:"torch_vram_total"`
TorchVRAMFree int64 `json:"torch_vram_free"`
}
GPU contains gpu info
type NodeInfo ¶
type NodeInfo struct {
Num uint64
PromptID string
Prompt map[string]PromptNode `json:"prompt"`
ExtraData json.RawMessage // extra data is just for user's custom data
OutputNodeIDs []string
}
NodeInfo contains the node info
func (*NodeInfo) UnmarshalJSON ¶
type NodeObject ¶
type NodeObject struct {
Input *NodeObjectInput `json:"input"`
Output []string `json:"output"`
OutputIsList []bool `json:"output_is_list"`
OutputName []string `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"`
}
NodeObject is a part of workflow
type NodeObjectInput ¶
type NodeObjectInput struct {
Required map[string]interface{} `json:"required"`
Optional map[string]interface{} `json:"optional,omitempty"`
}
NodeObjectInput exposes the input information of a node
type PromptHistoryItem ¶
type PromptHistoryItem struct {
PromptID string
PromptHistoryMember
}
PromptHistoryItem contains prompt id, WorkFlow, output info
type PromptHistoryMember ¶
type PromptHistoryMember struct {
NodeInfo *NodeInfo `json:"prompt"`
Outputs map[string]PromptHistoryMemberImages `json:"outputs"`
}
PromptHistoryMember is part of prompt history
type PromptHistoryMemberImages ¶
type PromptHistoryMemberImages struct {
Images *[]DataOutputFile `json:"images"`
}
type PromptNode ¶
type PromptNode struct {
Inputs map[string]interface{} `json:"inputs"`
ClassType string `json:"class_type"`
}
PromptNode is the data that inputs into ComfyUI
type QueueExecInfo ¶
type QueueExecInfo struct {
ExecInfo struct {
QueueRemaining uint64 `json:"queue_remaining"`
} `json:"exec_info"`
}
QueueExecInfo contains queue remaining number
type QueueInfo ¶
type QueueInfo struct {
QueueRunning []*NodeInfo `json:"queue_running"`
QueuePending []*NodeInfo `json:"queue_pending"`
}
QueueInfo exposes the queue info
type QueuePromptResp ¶
type QueuePromptResp struct {
PromptID string `json:"prompt_id"`
Number int `json:"number"`
NodeErrors map[string]interface{} `json:"node_errors"`
}
QueuePromptResp contains prompt id, number and node errors
type Router ¶
type Router string
const ( PromptRouter Router = "/prompt" HistoryRouter Router = "/history" ViewRouter Router = "/view" ViewMetadataRouter Router = "/view_metadata" EmbeddingsRouter Router = "/embeddings" ExtensionsRouter Router = "/extensions" SystemStatsRouter Router = "/system_stats" InterruptRouter Router = "/interrupt" QueueRouter Router = "/queue" ObjectInfoRouter Router = "/object_info" UploadImageRouter Router = "/upload/image" UploadMaskRouter Router = "/upload/mask" )
type System ¶
type System struct {
OS string `json:"os"`
PythonVersion string `json:"python_version"`
EmbeddedPython bool `json:"embedded_python"`
}
System contains system info
type SystemStats ¶
SystemStats contains a system info and gpu infos
type TaskStatusType ¶
type TaskStatusType = WsMessageType
type UploadFile ¶
type UploadFile struct {
Filename string `json:"name"`
SubFolder string `json:"subfolder"`
Type string `json:"type"`
}
UploadFile export data address, name and type
type WSMessage ¶
type WSMessage struct {
Type WsMessageType `json:"type"`
Data interface{} `json:"data"`
}
func (*WSMessage) UnmarshalJSON ¶
type WSMessageDataExecuted ¶
type WSMessageDataExecuted struct {
Node string `json:"node"`
PromptID string `json:"prompt_id"`
Output map[string][]*DataOutputFile
}
type WSMessageDataExecuting ¶
WSMessageDataExecuting json {"type": "executing", "data": {"node": "12", "prompt_id": "ed986d60-2a27-4d28-8871-2fdb36582902"}}
type WSMessageDataExecutionCached ¶
type WSMessageDataExecutionCached struct {
Nodes []string `json:"nodes"`
PromptID string `json:"prompt_id"`
}
WSMessageDataExecutionCached json {"type": "execution_cached", "data": {"nodes": [], "prompt_id": "ed986d60-2a27-4d28-8871-2fdb36582902"}}
type WSMessageDataExecutionStart ¶
type WSMessageDataExecutionStart struct {
PromptID string `json:"prompt_id"`
}
WSMessageDataExecutionStart Json {"type": "execution_start", "data": {"prompt_id": "ed986d60-2a27-4d28-8871-2fdb36582902"}}
type WSMessageDataProgress ¶
WSMessageDataProgress
{
"type": "progress",
"data": {
"value": 18,
"max": 20
}
}
type WSMessageDataStatus ¶
type WSMessageDataStatus struct {
Status struct {
ExecInfo struct {
QueueRemaining int `json:"queue_remaining"`
} `json:"exec_info"`
} `json:"status"`
SID string `json:"sid"`
}
WSMessageDataStatus
Json {"type": "status", "data": {"status": {"exec_info": {"queue_remaining": 1}}}}
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 WSMessageExecutionInterrupted ¶
type WSMessageExecutionInterrupted struct {
PromptID string `json:"prompt_id"`
NodeID string `json:"node_id"`
NodeType string `json:"node_type"`
Executed []string `json:"executed"`
}
WSMessageExecutionInterrupted
{"type": "execution_interrupted", "data": {"prompt_id": "dc7093d7-980a-4fe6-bf0c-f6fef932c74b", "node_id": "19", "node_type": "SaveImage", "executed": ["5", "17", "10", "11"]}}
type WebSocketConnection ¶
type WebSocketConnection struct {
URL string
Conn *websocket.Conn
MaxRetry int
// contains filtered or unexported fields
}
func NewDefaultWebSocketConnection ¶
func NewDefaultWebSocketConnection(url string, handler Handler) *WebSocketConnection
func NewWebSocketConnection ¶
func NewWebSocketConnection(url string, maxRetry int, handler Handler) *WebSocketConnection
func (*WebSocketConnection) Close ¶
func (w *WebSocketConnection) Close() error
func (*WebSocketConnection) Connect ¶
func (w *WebSocketConnection) Connect() error
func (*WebSocketConnection) ConnectAndListen ¶
func (w *WebSocketConnection) ConnectAndListen()
ConnectAndListen connects to the websocket and listens for messages
func (*WebSocketConnection) GetIsConnected ¶
func (w *WebSocketConnection) GetIsConnected() bool
func (*WebSocketConnection) SetIsConnected ¶
func (w *WebSocketConnection) SetIsConnected(iConnected bool)
type WsMessageType ¶
type WsMessageType string
const ( Status WsMessageType = "status" Progress WsMessageType = "progress" Executed WsMessageType = "executed" Executing WsMessageType = "executing" ExecutionStart WsMessageType = "execution_start" ExecutionError WsMessageType = "execution_error" ExecutionCached WsMessageType = "execution_cached" ExecutionInterrupted WsMessageType = "execution_interrupted" )