Hansimov commited on
Commit
b9716d2
1 Parent(s): 2ced09a

:zap: [Enhance] Do not render user input, and keep line breaks

Browse files
Files changed (2) hide show
  1. components/messager.js +2 -2
  2. css/default.css +1 -0
components/messager.js CHANGED
@@ -32,8 +32,8 @@ class MessagerViewer {
32
  this.content_displayer = $("<div>")
33
  .addClass("col-12 px-2 pt-4")
34
  .addClass("content-displayer")
35
- .addClass(`chat-${this.message.role}`)
36
- .append(this.message.content);
37
  this.content_displayer.data("raw_content", this.message.content);
38
  }
39
  create_button_group() {
 
32
  this.content_displayer = $("<div>")
33
  .addClass("col-12 px-2 pt-4")
34
  .addClass("content-displayer")
35
+ .addClass(`chat-${this.message.role}`);
36
+ this.content_displayer.text(this.message.content);
37
  this.content_displayer.data("raw_content", this.message.content);
38
  }
39
  create_button_group() {
css/default.css CHANGED
@@ -28,6 +28,7 @@
28
  color: black;
29
  border: lightgray 1px solid;
30
  background-color: #eafaf1;
 
31
  }
32
 
33
  .chat-assistant {
 
28
  color: black;
29
  border: lightgray 1px solid;
30
  background-color: #eafaf1;
31
+ white-space: pre-wrap;
32
  }
33
 
34
  .chat-assistant {