POLRAMBORA commited on
Commit
bd7d562
·
verified ·
1 Parent(s): 2f14634

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -127,7 +127,7 @@ def render_message(history):
127
  for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history:
128
  if user_message and ("user", user_message) not in seen_messages:
129
  seen_messages.add(("user", user_message))
130
- user_message_html = markdown.markdown(user_message, extensions=["fenced_code", "codehilite"])
131
  messages_html += f"""
132
  <div style='display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 10px;'>
133
  <img src='{user_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-bottom: 5px;'>
@@ -136,7 +136,7 @@ def render_message(history):
136
 
137
  if assistant_message and ("assistant", assistant_message) not in seen_messages:
138
  seen_messages.add(("assistant", assistant_message))
139
- assistant_message_html = markdown.markdown(assistant_message, extensions=["fenced_code", "codehilite"])
140
  messages_html += f"""
141
  <div style='display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 10px;'>
142
  <img src='{assistant_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-bottom: 5px;'>
 
127
  for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history:
128
  if user_message and ("user", user_message) not in seen_messages:
129
  seen_messages.add(("user", user_message))
130
+ user_message_html = markdown.markdown(escape_html(user_message), extensions=["fenced_code", "codehilite"])
131
  messages_html += f"""
132
  <div style='display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 10px;'>
133
  <img src='{user_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-bottom: 5px;'>
 
136
 
137
  if assistant_message and ("assistant", assistant_message) not in seen_messages:
138
  seen_messages.add(("assistant", assistant_message))
139
+ assistant_message_html = markdown.markdown(escape_html(assistant_message), extensions=["fenced_code", "codehilite"])
140
  messages_html += f"""
141
  <div style='display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 10px;'>
142
  <img src='{assistant_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-bottom: 5px;'>