Spaces:
Build error
Build error
Update app.py
Browse files125 unmodified lines1261271281291291301311322 unmodified lines1351361371381381391401412 unmodified lines144145146147147148149149150151152153154155150151152153154125 unmodified lines for user_message, assistant_message, user_profile, assistant_profile, user_pic, assistant_pic in history: if user_message and user_message not in seen_messages: seen_messages.add(user_message) user_message_html = markdown.markdown(escape_html(user_message), extensions=["fenced_code", "codehilite"]) user_message_html = escape_html(user_message) messages_html += f""" <div style='display: flex; align-items: center; margin-bottom: 10px;'> <img src='{user_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>2 unmodified lines
if assistant_message and assistant_message not in seen_messages: seen_messages.add(assistant_message) assistant_message_html = markdown.markdown(escape_html(assistant_message), extensions=["fenced_code", "codehilite"]) assistant_message_html = escape_html(assistant_message) messages_html += f""" <div style='display: flex; align-items: center; margin-bottom: 10px;'> <img src='{assistant_pic}' style='width: 40px; height: 40px; border-radius: 50%; margin-right: 10px;'>2 unmodified lines
messages_html += "</div></div>" return messages_html
def escape_html(unsafe_text): return ( unsafe_text.replace("&", "&") .replace("<", "<") .replace(">", ">") .replace('"', """) .replace("'", "'") ) return ''.join(f"&#{ord(char)};" for char in unsafe_text)
css=""".chatbox {height: 400px; overflow: auto; border: 1px solid #262626; padding: 10px; background-color: #171717; display: flex; flex-direction: column-reverse;}app.py+6-10