Represents a chat sequence, which consists of segments and metadata, providing methods for accessing and modifying them.

ChatSequenceImpl

Implements

Constructors

  • Constructs a new sequence with the given source file and optional initial segments. If initial segments are provided, they are added to the sequence in order.

    Parameters

    • sourceFile: string

      {string} The source file of the sequence

    • initialSegments: ChatSegment[] = []

      {ChatSegment[]} An optional set of initial segments to add to the sequence

    Returns ChatSequenceImpl

Properties

id: string

The unique identifier of the sequence.

sourceFile: string

The source file of the sequence.

Accessors

  • get metadata(): SequenceMetadata
  • The metadata of the sequence. A copy is returned to prevent direct modification of the internal metadata object.

    Returns SequenceMetadata

    The metadata of the sequence

  • get segments(): ChatSegment[]
  • Gets the segments of the sequence. A copy is returned to prevent direct modification of the internal segments array.

    Returns ChatSegment[]

    A copy of the segments in the sequence

  • get totalSegments(): number
  • The total number of segments in the sequence

    Returns number

    The total number of segments in the sequence

Methods

  • Adds segments to the sequence, maintaining order by startIndex

    Parameters

    • newSegments: ChatSegment[]

      The segments to add to the sequence

    Returns void

  • Finds segments containing specific keywords

    Parameters

    • keywords: string[]

      {string[]} The keywords to search for

    Returns ChatSegment[]

  • Finds segments by participant

    Parameters

    • participant: string

      {string} The participant to search for

    Returns ChatSegment[]

    The segments containing the specified participant

  • Gets a segment by its index in the sequence

    Parameters

    • index: number

      The index of the segment to get

    Returns ChatSegment

    The segment at the given index, or undefined if the index is out of range