Aditya Bakshi commited on
Commit
0b8e886
·
1 Parent(s): ad12a51

some comments for new chat button and use single quotes

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -149,7 +149,7 @@ def reset_chat_history():
149
  del st.session_state['pdf_file']
150
  if DOWNLOAD_FILE_KEY in st.session_state:
151
  del st.session_state[DOWNLOAD_FILE_KEY]
152
- st.rerun()
153
 
154
 
155
  APP_TEXT = _load_strings()
@@ -167,7 +167,8 @@ texts = list(GlobalConfig.PPTX_TEMPLATE_FILES.keys())
167
  captions = [GlobalConfig.PPTX_TEMPLATE_FILES[x]['caption'] for x in texts]
168
 
169
  # CSS to reduce spacing around the new chat button
170
- st.markdown("""
 
171
  <style>
172
  div[data-testid="stHorizontalBlock"] {
173
  position: absolute;
@@ -175,16 +176,17 @@ st.markdown("""
175
  width: 100% !important;
176
  }
177
  </style>
178
- """, unsafe_allow_html=True)
 
179
 
180
  with st.sidebar:
181
  # New Chat button at the top of sidebar
182
  col1, col2, col3 = st.columns([1, 2, 1])
183
  with col2:
184
- if st.button("New Chat 💬", help="Start a new conversation", key="new_chat_button"):
185
- reset_chat_history()
186
 
187
- st.markdown("---") # Separator
188
 
189
  # The PPT templates
190
  pptx_template = st.sidebar.radio(
 
149
  del st.session_state['pdf_file']
150
  if DOWNLOAD_FILE_KEY in st.session_state:
151
  del st.session_state[DOWNLOAD_FILE_KEY]
152
+ st.rerun() # Reload the app
153
 
154
 
155
  APP_TEXT = _load_strings()
 
167
  captions = [GlobalConfig.PPTX_TEMPLATE_FILES[x]['caption'] for x in texts]
168
 
169
  # CSS to reduce spacing around the new chat button
170
+ st.markdown(
171
+ """
172
  <style>
173
  div[data-testid="stHorizontalBlock"] {
174
  position: absolute;
 
176
  width: 100% !important;
177
  }
178
  </style>
179
+ """,
180
+ unsafe_allow_html=True)
181
 
182
  with st.sidebar:
183
  # New Chat button at the top of sidebar
184
  col1, col2, col3 = st.columns([1, 2, 1])
185
  with col2:
186
+ if st.button('New Chat 💬', help='Start a new conversation', key='new_chat_button'):
187
+ reset_chat_history() # Reset the chat history when the button is clicked
188
 
189
+ st.markdown('---') # Separator
190
 
191
  # The PPT templates
192
  pptx_template = st.sidebar.radio(