Data Model Manager

DataModelManager

Constructors

  • Creates a new data model manager with the given options. The options can include a maximum file size, a chunk size for parsing, and a timeout for parsing.

    Parameters

    Returns DataModelManager

Methods

  • Adds a chat segment to the data model. Currently, this method is not implemented and will throw an error. #TODO: Implement this method

    Parameters

    • segment: {
          content: string;
          id: string;
          metadata: { conversationId: string; model: string; userId: string };
          timestamp: Date;
      }

      The segment to add.

    Returns void

    Always throws an error, not implemented.

  • Adds a chat sequence to the data model. Currently, this method is not implemented and will throw an error. #TODO: Implement this method

    Parameters

    Returns void

    Always throws an error, not implemented.

  • Gets all segments across all sequences

    Returns ChatSegment[]

    An array of all segments.

  • Gets all sequences

    Returns ChatSequence[]

    An array of all sequences.

  • Gets the export data for the data model. This data can be used to persist the data model to a file or database.

    Returns any

    The export data.

    Always throws an error, not implemented.

  • Gets the next segment in sequence

    Parameters

    • currentSegmentId: string

      The ID of the current segment.

    Returns ChatSegment

    The next segment in the sequence, or undefined if the current segment is the last.

  • Gets the previous segment in sequence

    Parameters

    • currentSegmentId: string

      The ID of the current segment.

    Returns ChatSegment

    The previous segment in the sequence, or undefined if the current segment is the first.

  • Gets a segment by ID

    Parameters

    • id: string

      The ID of the segment to retrieve.

    Returns ChatSegment

    The segment with the given ID, or undefined if not found.

  • Returns all segments in the data model. #TODO: Implement this method

    Returns void

    An array of all segments in the data model.

    Always throws an error, not implemented.

  • Gets a sequence by ID

    Parameters

    • id: string

      The ID of the sequence to retrieve.

    Returns ChatSequence

    The sequence with the given ID, or undefined if not found.

  • Gets all segments for a sequence

    Parameters

    • sequenceId: string

      The ID of the sequence.

    Returns ChatSegment[]

    An array of all segments for the sequence.

  • Determines if the data model is initialized. #TODO: Implement this method

    Returns any

    True if initialized, false otherwise.

    Always throws an error, not implemented.

  • Subscribes to data model events

    Parameters

    • eventType: DataModelEventType

      The type of event to subscribe to.

    • listener: (event: any) => void

      The listener function to be called when the event occurs.

    Returns void

  • Processes a log file and creates a chat sequence

    Parameters

    • filePath: string

      The path to the log file.

    Returns Promise<ChatSequence>

    A promise that resolves to the created chat sequence.

    If the file cannot be read or parsed.

  • Processes a segment, adding it to the data model and emitting events.

    Parameters

    Returns void

  • Updates a segment's boundaries

    Parameters

    • segmentId: string

      The ID of the segment to update.

    • newStart: number

      The new start index of the segment.

    • newEnd: number

      The new end index of the segment.

    Returns Promise<void>

    A promise that resolves when the segment boundaries have been updated.