1MR commited on
Commit
4cf25c0
·
verified ·
1 Parent(s): 1f54d58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -108,19 +108,27 @@ def handle_userinput(user_question):
108
 
109
  for i, message in enumerate(st.session_state.chat_history):
110
  if i % 2 == 0:
111
- # Display user messages
112
- st.write(user_template.replace("{{MSG}}", message["content"]), unsafe_allow_html=True)
113
  else:
114
- # Display assistant messages
115
- st.write(bot_template.replace("{{MSG}}", message["content"]), unsafe_allow_html=True)
116
-
117
  # for i, message in enumerate(st.session_state.chat_history):
118
  # if i % 2 == 0:
119
- # st.write(user_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
120
- # # st.write(f"<div style='color: gray;'>User: {message['content']}</div>", unsafe_allow_html=True)
121
  # else:
122
- # st.write(bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
123
- # # st.write(f"<div style='color: black;'>Bot: {message['content']}</div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
124
 
125
 
126
  def main():
 
108
 
109
  for i, message in enumerate(st.session_state.chat_history):
110
  if i % 2 == 0:
111
+ st.write(user_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
112
+ # st.write(f"<div style='color: gray;'>User: {message['content']}</div>", unsafe_allow_html=True)
113
  else:
114
+ st.write(bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
115
+ # st.write(f"<div style='color: black;'>Bot: {message['content']}</div>", unsafe_allow_html=True)
116
+
117
  # for i, message in enumerate(st.session_state.chat_history):
118
  # if i % 2 == 0:
119
+ # # Display user messages
120
+ # st.write(user_template.replace("{{MSG}}", message["content"]), unsafe_allow_html=True)
121
  # else:
122
+ # # Display assistant messages
123
+ # st.write(bot_template.replace("{{MSG}}", message["content"]), unsafe_allow_html=True)
124
+
125
+ for i, message in enumerate(st.session_state.chat_history):
126
+ if i % 2 == 0:
127
+ st.write(user_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
128
+ # st.write(f"<div style='color: gray;'>User: {message['content']}</div>", unsafe_allow_html=True)
129
+ else:
130
+ st.write(bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
131
+ # st.write(f"<div style='color: black;'>Bot: {message['content']}</div>", unsafe_allow_html=True)
132
 
133
 
134
  def main():