Hierarchy

  • CachedApi
    • ControlNetApi

Constructors

Properties

_cache: Record<string, {
    data: any;
    expires: number;
}> = ...

Type declaration

  • data: any
  • expires: number
options: CachedApiOptions

Accessors

Methods

  • Type Parameters

    • T

    Parameters

    • key: string

    Returns Promise<null | T>

  • Type Parameters

    • T

    Parameters

    • key: string
    • fetch: (() => Promise<T>)
        • (): Promise<T>
        • Returns Promise<T>

    Returns Promise<T>

  • Retrieves a list of models from the controlnet API.

    Returns Promise<string[]>

    A promise that resolves to an array of model names.

  • Retrieves the version of the controlnet API.

    Returns Promise<number>

    A promise that resolves to the version number.

  • Type Parameters

    • T

    Parameters

    • key: string
    • data: T

    Returns Promise<void>

  • Clears the cache by resetting the _cache object to an empty object.

    Returns void

  • Retrieves the details of all modules from the cache if caching is enabled, otherwise makes a request to the controlnet API.

    Returns Promise<ModuleListResponse>

    A promise that resolves to an object containing the details of all modules.

  • Retrieves a list of models from the controlnet API, caching the result if caching is enabled.

    Returns Promise<string[]>

    A promise that resolves to an array of model names.

  • Retrieves the detail of a module from the cache if caching is enabled, otherwise makes a request to the controlnet API.

    Parameters

    • module: string

      The name of the module to retrieve the detail for.

    Returns Promise<ModuleListResponse>

    A promise that resolves to the module detail.

  • Retrieves the version of the controlnet API.

    Returns Promise<number>

    A promise that resolves to the version number.

  • Asynchronously sends an image to the server for processing and returns the processed image and information.

    Parameters

    Returns Promise<{
        image: string;
        images: string[];
        info: GenerationResponseInfo;
    }>

    The processed image and information.

    Throws

    If no image is returned from the server.

  • Asynchronously creates a batch of image-to-image generations and returns the batch object.

    Parameters

    • param: {
          options: {
              batchSize: number;
              manual?: boolean;
              numBatches: number;
          };
          params: Img2imgProcessParams;
          units: ControlNetUnitRequest[];
      }

      The parameters for the batch generation.

      • options: {
            batchSize: number;
            manual?: boolean;
            numBatches: number;
        }

        The options for the batch generation.

        • batchSize: number
        • Optional manual?: boolean
        • numBatches: number
      • params: Img2imgProcessParams

        The image processing parameters.

      • units: ControlNetUnitRequest[]

        The control network units for the batch generation.

    Returns Promise<Img2imgBatchGeneration>

    A promise that resolves to the batch object.

  • Removes a cache entry with the specified key.

    Parameters

    • key: string

      The key of the cache entry to remove.

    Returns void

  • Asynchronously sends a text to the server for processing and returns the processed image and information.

    Parameters

    Returns Promise<{
        image: string;
        images: string[];
        info: GenerationResponseInfo;
    }>

    The processed image and information.

    Throws

    If no image is returned from the server.

  • Asynchronously sends a text to the server for processing and returns the processed image and information.

    Parameters

    • options: {
          options: {
              batchSize: number;
              manual?: boolean;
              numBatches: number;
          };
          params: Txt2imgProcessParams;
          units: ControlNetUnitRequest[];
      }

      The options for the text to image processing.

      • options: {
            batchSize: number;
            manual?: boolean;
            numBatches: number;
        }

        The options for the text to image processing.

        • batchSize: number
        • Optional manual?: boolean
        • numBatches: number
      • params: Txt2imgProcessParams

        The parameters for the text to image processing.

      • units: ControlNetUnitRequest[]

        The control net units for the batch generation.

    Returns Promise<Txt2imgBatchGeneration>

    A promise that resolves to the batch object.