@lenml/char-card-reader - v1.0.6
    Preparing search index...

    Class CharacterCard

    Index

    Constructors

    Properties

    fallback_avatar: string = ""
    raw_data: CharRawData

    Accessors

    Methods

    • Creates a clone of the current CharacterCard instance in the specified version format.

      This method generates a new CharacterCard object with the data formatted to match the specified version's specification. It supports conversion to SpecV1, SpecV2, and SpecV3 formats by utilizing the respective toSpecV1, toSpecV2, and toSpecV3 methods.

      Parameters

      • version: "v1" | "v2" | "v3" = ...

        The specification version ("v1", "v2", or "v3") to clone the character card into. Defaults to "v3" if not specified.

      Returns CharacterCard

      A new CharacterCard instance formatted according to the specified version.

      Will throw an error if the specified version is unsupported.

    • Parameters

      • without_fallback: boolean = false

      Returns Promise<string>

    • Converts the current character card data to the SpecV1 format.

      This method constructs a SpecV1.TavernCard object by extracting the necessary fields from the current instance's raw data using a getter function. The function retrieves data from multiple sources, including instance properties, the raw data object, and its nested data object. The resulting object contains fields defined in the chara_card_v1 specification, such as name, description, personality, scenario, first message, and example messages.

      Returns TavernCard

      A SpecV1.TavernCard object representing the character card data in SpecV1 format.

    • Converts the current character card data to the SpecV2 format.

      This method constructs a SpecV2.TavernCardV2 object by extracting the necessary fields from the current instance's raw data using a getter function. The function retrieves data from multiple sources, including instance properties, the raw data object, and its nested data object. The resulting object contains fields defined in the chara_card_v2 specification, including additional fields introduced in later updates.

      Returns TavernCardV2

      A deep-cloned SpecV2.TavernCardV2 object representing the character card data in SpecV2 format.

    • Converts the current character card data to the SpecV3 format.

      This function utilizes a getter to retrieve properties from the character card's raw data and returns a deep-cloned object conforming to the SpecV3.CharacterCardV3 structure. It includes fields from the CCV2 specification, changes specific to CCV3, and new fields introduced in CCV3.

      Returns CharacterCardV3

      A deep-cloned object representing the character card data in SpecV3 format.