uyen13 commited on
Commit
2591a41
1 Parent(s): 15b68b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -126,10 +126,11 @@ if submit_button and user_input:
126
  st.session_state['generated'].append(output)
127
 
128
  # Display chat history within the container
129
- with chat_history_container:
130
- for i in range(len(st.session_state['generated'])):
131
- message(st.session_state["past"][i], is_user=True, key=str(i) + '_user', avatar_style="big-smile")
132
- message(st.session_state["generated"][i], key=str(i), avatar_style="thumbs")
 
133
 
134
  # Ensure chat history is always scrollable
135
  st.markdown("""
 
126
  st.session_state['generated'].append(output)
127
 
128
  # Display chat history within the container
129
+ if st.session_state['generated']:
130
+ with chat_history_container:
131
+ for i in range(len(st.session_state['generated'])):
132
+ message(st.session_state["past"][i], is_user=True, key=str(i) + '_user', avatar_style="big-smile")
133
+ message(st.session_state["generated"][i], key=str(i), avatar_style="thumbs")
134
 
135
  # Ensure chat history is always scrollable
136
  st.markdown("""