Summary
After adding the if statement in my clear chat history function, I now see some markdown code above the title as shown (i.e. None) This is after pressing the button:
What Iβm trying to do is update a doc in firestore whenever logged in users clear their own chat history. The markdown also appears when logged in or not.
Steps to reproduce
Code snippet:
def clear():
st.session_state.chat_history = [{""}] #left blank intentionally
if 'user_id' in st.session_state:
st.session_state.get('user_id') and db.collection("users").document(st.session_state.user_id.replace(
"/", "-")).update({"chat_history": st.session_state.chat_history})
Expected behavior:
No markdown code should appear above the title.
Actual behavior:
Before adding that line of markdown code the code above the title never appeared when clearing chat history. Iβm trying to not have the app crash when it tries to find the user_id whenever theyβre logged in or not.
Debug info
- Streamlit version: 1.26.0
- Python version: 3.10.12
- OS version: EC2 Ubuntu 23.04
- Browser version: Chrome 116.0.5845.179
Links
- Link to your deployed app: App