pipe to create a workflow

Type Parameters

  • CTX extends PipeContext = PipeContext

Hierarchy (view full)

Constructors

Properties

_disposed: boolean = false
_disposed_cbs: any[] = ...
_invoked?: Promise<InvokedWorkflow<unknown>>
_workflow: Workflow = ...
context: CTX
defaultContext: PipeContext = ...

Methods

  • Parameters

    • cb: (() => void)
        • (): void
        • Returns void

    Returns void

  • Updates the context with the provided batch size and returns the current instance of the class for method chaining.

    Parameters

    • batch_size: number

      The batch size to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided cfg value.

    Parameters

    • cfg: number

      The cfg value to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided denoise value and returns the current instance of the class for method chaining.

    Parameters

    • denoise: number

      The denoise value to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided image buffer.

    Parameters

    • image: Buffer

      The image buffer to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided mask buffer.

    Parameters

    • image: Buffer

      The mask buffer to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided model checkpoint name.

    Parameters

    • ckpt_name: string

      The name of the model checkpoint to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided text as the negative prompt.

    Parameters

    • text: string

      The text to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided text as the positive prompt.

    Parameters

    • text: string

      The text to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Parameters

    Returns Promise<{
        data: ArrayBuffer;
        mime: string;
    }[]>

  • Updates the context with the provided sampler name and returns the current instance of the class for method chaining.

    Parameters

    • sampler_name: "euler" | "euler_cfg_pp" | "euler_ancestral" | "euler_ancestral_cfg_pp" | "heun" | "heunpp2" | "dpm_2" | "dpm_2_ancestral" | "lms" | "dpm_fast" | "dpm_adaptive" | "dpmpp_2s_ancestral" | "dpmpp_sde" | "dpmpp_sde_gpu" | "dpmpp_2m" | "dpmpp_2m_sde" | "dpmpp_2m_sde_gpu" | "dpmpp_3m_sde" | "dpmpp_3m_sde_gpu" | "ddpm" | "lcm" | "ipndm" | "ipndm_v" | "deis" | "ddim" | "uni_pc" | "uni_pc_bh2" | {} & string

      The sampler name to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Saves the workflow by invoking the workflow instance and enqueuing it.

    Parameters

    • Optional filename_prefix: string

      The prefix for the saved filename. if not provided, the workflow will be saved as a websocket connection.

    Returns BasePipe<CTX>

    • Returns the instance of the class for method chaining.

    Throws

    • Throws an error if the client is not defined.
  • Updates the context with the provided scheduler value and returns the current instance of the class for method chaining.

    Parameters

    • scheduler: "normal" | "karras" | "exponential" | "sgm_uniform" | "simple" | "ddim_uniform" | "beta" | {} & string

      The scheduler value to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided seed value or generates a random seed value if none is provided.

    Parameters

    • Optional seed: number = ...

      The seed value to update the context with. If not provided, a random seed value will be generated.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided width and height, and returns the current instance of the class for method chaining.

    Parameters

    • w: number

      The width to update the context with.

    • h: number

      The height to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Updates the context with the provided steps and returns the current instance of the class for method chaining.

    Parameters

    • steps: number

      The number of steps to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Waits for the workflow to complete and returns the result and the images.

    Returns Promise<{
        images: {
            data: ArrayBuffer;
            mime: string;
        }[];
        result: WorkflowOutput;
    }>

    • A promise that resolves to an object containing the result of the workflow and the images.

    Throws

    • Throws an error if the workflow has not been invoked.
  • Waits for the workflow to complete and returns the result and the images.

    *This function does not rely on WebSocket Events, so it maybe will lose events output by WebSocket node

    Returns Promise<{
        images: {
            data: ArrayBuffer;
            mime: string;
        }[];
        result: WorkflowOutput;
    }>

    • A promise that resolves to an object containing the result of the workflow and the images.

    Throws

    • Throws an error if the workflow has not been invoked.
  • Updates the context with the provided client and returns the current instance of the class for method chaining.

    Parameters

    • client: Client

      The client to update the context with.

    Returns BasePipe<CTX>

    The current instance of the class for method chaining.

  • Generates a random seed value.

    Returns number

    A random integer seed value between 0 and 2^32 - 1.