class MessagerViewer { constructor(message) { this.message = message; this.create_elements(); } create_elements() { this.container = $("
") .addClass("mt-2 row no-gutters message-viewer") .addClass(`message-${this.message.role}`); this.create_role_displayer(); this.create_content_displayer(); this.create_button_group(); this.container .append(this.role_displayer) .append(this.content_displayer) .append(this.button_group); } create_role_displayer() { this.role_displayer = $("
") .addClass("col-2 p-2") .addClass("role-displayer"); if (this.message.role === "user") { this.role_displayer.append("You"); } else { this.role_displayer.append(this.message.model); } } create_content_displayer() { this.content_displayer = $("
") .addClass("col-8 p-2") .addClass("content-displayer") .addClass(`chat-${this.message.role}`) .append(this.message.content); this.content_displayer.data("raw_content", ""); } create_button_group() { this.button_group = $("
") .addClass("col-2") .addClass("button-group"); this.edit_button = $("