pkg

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyParameters

func ApplyParameters(client *client.ComfyClient, options *ComfyOptions, graph *graphapi.Graph, simple_api *graphapi.SimpleAPI, parameters []CLIParameter) (bool, error)

func CloneRepo added in v0.5.0

func CloneRepo(repoURL, repoPath string, showoutput bool) (*git.Repository, error)

func CopyFile

func CopyFile(src, dst string) (int64, error)

func DownloadFile

func DownloadFile(url string, targetPath string, max_redirects int, feedback kinda.CreateEnvironmentOptions) error

downloadFile downloads a file from the specified URL and saves it to the given target path. It also handles redirects with custom logic.

func ExpectImage

func ExpectImage(reader *bufio.Reader) (image.Image, error)

ExpectImage tries to read an image from the given reader and returns it.

func FindAvailableEphemeralPort

func FindAvailableEphemeralPort() (int, error)

FindAvailableEphemeralPort finds an available ephemeral port on the local loopback device. It returns the port number if found, or an error otherwise.

func GetWorkflowsAsync added in v0.6.0

func GetWorkflowsAsync(options *ComfyOptions, workflowpath string, parameters []CLIParameter) chan interface{}

GetWorkflowsAsync returns a channel of WorkflowQueueProcessor that can be used to get the workflows asynchronously nil is returned if there was an error creating the client

func HandleDataOutput added in v0.6.0

func HandleDataOutput(client *client.ComfyClient, options *ComfyOptions, output map[string][]client.DataOutput)

func ListFiles

func ListFiles(path string, topOnly bool, relative bool) ([]string, error)

func LoadData

func LoadData(path string) (*[]byte, error)

func OneOf

func OneOf(values []string, default_index int) (string, error)

OneOf - given a list of options, prompt the user to select one, if default is -1 then there is no default selection

func OutputInlineToStd

func OutputInlineToStd(data *[]byte, name string, width int, height int)

func ProcessQueue

func ProcessQueue(options *ComfyOptions, workflowpath string, parameters []CLIParameter) (bool, error)

func ProcessWorkerQueue added in v0.6.0

func ProcessWorkerQueue(worker *WorkflowQueueProcessor, options *ComfyOptions, parameters []CLIParameter, workers chan *WorkflowQueueProcessor, workitem int, dataitems chan WorkflowQueueDataOutputItems)

func ReadAndDeserializeJSON

func ReadAndDeserializeJSON(dst interface{}, jsonInput string) error

func SaveData

func SaveData(data *[]byte, path string) error

func ScanJsonFromReader

func ScanJsonFromReader(r io.Reader, scanner *bufio.Scanner) (interface{}, *bufio.Scanner, error)

func SetGenericPropertValue

func SetGenericPropertValue(c *client.ComfyClient, options *ComfyOptions, prop graphapi.Property, value interface{}) (bool, error)

func SetfileUploadPropertyValue

func SetfileUploadPropertyValue(c *client.ComfyClient, options *ComfyOptions, prop graphapi.Property, value interface{}) (bool, error)

func StopFileServer added in v0.6.0

func StopFileServer(fs *FileServer) error

func TestParametersHasPipeLoop added in v0.6.0

func TestParametersHasPipeLoop(options *ComfyOptions, parameters []CLIParameter) (bool, error)

func ToJson

func ToJson(obj interface{}, purty bool) (string, error)

func UnionStringSlices

func UnionStringSlices(s1 []string, s2 []string) []string

create a slice of strings that contains all the unique strings from s1 and s2

func YesNo

func YesNo(prompt string, default_yes bool) (bool, error)

YesNo - prompt the user for a yes or no response

Types

type CLIParameter

type CLIParameter struct {
	NodeID    int    // -1 for unset
	NodeTitle string // empty for unset
	API       bool   // is true if the parameter is an API parameter
	Name      string // the name of the parameter
	Value     string // the value of the parameter
}

func ParseParameters

func ParseParameters(params []string) []CLIParameter

type ComfyOptions

type ComfyOptions struct {
	Host           []string
	Port           []int
	Json           bool
	PrettyJson     bool
	API            string
	APIValues      string
	GraphOutPath   string
	InlineImages   bool
	NoSaveData     bool
	DataToStdout   bool
	HomePath       string
	RecipesPath    string
	RecipesRepos   string
	Yes            bool // Automatically answer yes on prompted questions
	GetVersion     bool
	OutputNodes    string
	NoSharedModels bool
	// path to a file to read from stdin
	StdinFile string
	// API sub command options
	APIValuesOnly    bool // only output the values of the API nodes
	Stdin            *bufio.Reader
	Clients          []*client.ComfyClient
	JsonScanner      *bufio.Scanner
	JsonScannerMutex *sync.Mutex
}

func (*ComfyOptions) ApplyEnvironment

func (o *ComfyOptions) ApplyEnvironment()

func (*ComfyOptions) GetStdinReader

func (o *ComfyOptions) GetStdinReader() *bufio.Reader

func (*ComfyOptions) SetStdinReader added in v0.6.0

func (o *ComfyOptions) SetStdinReader(r *bufio.Reader)

type FileServer added in v0.6.0

type FileServer struct {
	Server      *http.Server
	Port        int
	RootPath    string
	StoragePath string
	AuthToken   string
	CertFile    string
	KeyFile     string
	SelfSigned  bool
}

func StartFileServer added in v0.6.0

func StartFileServer(options FileServerOptions) (*FileServer, error)

type FileServerOptions added in v0.6.0

type FileServerOptions struct {
	Port        int
	RootPath    string
	StoragePath string
	AuthToken   string
	CertFile    string
	KeyFile     string
	SelfSigned  bool
}

type Workflow added in v0.6.0

type Workflow struct {
	ClientIndex int
	Client      *client.ComfyClient
	Graph       *graphapi.Graph
	SimpleAPI   *graphapi.SimpleAPI
}

func ClientWithWorkflow

func ClientWithWorkflow(client_index int, options *ComfyOptions, workflowpath string, parameters []CLIParameter, callbacks *client.ComfyClientCallbacks, applyparams bool) (*Workflow, bool, *[]string, error)

func GetFullWorkflow

func GetFullWorkflow(client_index int, options *ComfyOptions, workflow string, cb *client.ComfyClientCallbacks) (*Workflow, *[]string, error)

type WorkflowQueueDataOutputItems added in v0.6.0

type WorkflowQueueDataOutputItems struct {
	WorkItem int
	Outputs  []map[string][]client.DataOutput
	Client   *client.ComfyClient
}

type WorkflowQueueProcessor added in v0.6.0

type WorkflowQueueProcessor struct {
	Workflow *Workflow
	HasLoop  bool
	Missing  *[]string
}

func GetWorkflows added in v0.6.0

func GetWorkflows(options *ComfyOptions, workflowpath string, parameters []CLIParameter) []*WorkflowQueueProcessor

Jump to

Keyboard shortcuts

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