POLRAMBORA commited on
Commit
c765a59
·
verified ·
1 Parent(s): 4f30ba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -166,8 +166,10 @@ def render_message(history):
166
 
167
 
168
  def escape_html(unsafe_text):
169
- return unsafe_text.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
 
170
 
 
171
  css="""
172
  .chatbox {height: 400px; overflow: auto; border: 1px solid #262626; padding: 10px; background-color: #171717; display: flex; flex-direction: column-reverse;}
173
  """
 
166
 
167
 
168
  def escape_html(unsafe_text):
169
+ escaped_text = ''.join(f"&#{ord(char)};" if char not in ('\n', '\r') else '<br>' for char in unsafe_text)
170
+ return escaped_text
171
 
172
+
173
  css="""
174
  .chatbox {height: 400px; overflow: auto; border: 1px solid #262626; padding: 10px; background-color: #171717; display: flex; flex-direction: column-reverse;}
175
  """