Anne31415 commited on
Commit
e7e2095
·
1 Parent(s): 12d891e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -116,7 +116,11 @@ def main():
116
  if "chat_history" not in st.session_state:
117
  st.session_state['chat_history'] = []
118
 
119
- display_chat_history(st.session_state['chat_history'])
 
 
 
 
120
 
121
  st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
122
  st.write("<div style='flex: 1;'></div>", unsafe_allow_html=True)
@@ -166,6 +170,9 @@ def main():
166
 
167
  loading_message.empty()
168
 
 
 
 
169
  # Clear the input field by setting the query variable to an empty string
170
  query = ""
171
 
 
116
  if "chat_history" not in st.session_state:
117
  st.session_state['chat_history'] = []
118
 
119
+ def display_chat_history(chat_history):
120
+ for chat in chat_history:
121
+ background_color = "#FFA07A" if chat[2] == "new" else "#acf" if chat[0] == "User" else "#caf"
122
+ st.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
123
+
124
 
125
  st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
126
  st.write("<div style='flex: 1;'></div>", unsafe_allow_html=True)
 
170
 
171
  loading_message.empty()
172
 
173
+ display_chat_history(st.session_state['chat_history'])
174
+
175
+
176
  # Clear the input field by setting the query variable to an empty string
177
  query = ""
178