All files message.js

100% Statements 25/25
100% Branches 4/4
100% Functions 3/3
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 261x 1x 1x 1x 1x 1x 1x 1x 1x 47x 47x 47x 1x 1x 1x 17x 17x 1x 1x 1x 28x 28x 1x 1x 1x  
"use strict";
 
// Message class to encapsulate a message payload to be sent to OpenAI API.
// A message consists of a role and content.
class Message {
  // Initializes a new Message instance with a role and content.
  // The role can be 'user', 'assistant', or 'developer'.
  // The content is the actual message string.
  constructor(role, content) {
    this.role = role;
    this.content = content;
  }
 
  // Retrieve the role of the message.
  getRole() {
    return this.role;
  }
 
  // Retrieve the content of the message.
  getContent() {
    return this.content;
  }
}
 
export { Message as default };