Aditya Bakshi commited on
Commit
dc387c3
·
unverified ·
1 Parent(s): 902f8d2

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