Spaces:
Build error
Build error
| import streamlit as st | |
| def initialize_session_state(): | |
| """Initialize all session state variables""" | |
| if 'tutor_context' not in st.session_state: | |
| st.session_state.tutor_context = { | |
| 'chat_history': [], | |
| 'current_topic': None, | |
| 'difficulty_level': 'intermediate', | |
| 'learning_style': 'interactive', | |
| 'engagement_metrics': [] | |
| } | |
| if 'user_progress' not in st.session_state: | |
| st.session_state.user_progress = { | |
| 'completed_modules': [], | |
| 'achievements': [], | |
| 'learning_streak': 0, | |
| 'last_active': None | |
| } | |
| def get_tutor_context(): | |
| """Get the tutor context from session state""" | |
| if 'tutor_context' not in st.session_state: | |
| initialize_session_state() | |
| return st.session_state.tutor_context | |
| def clear_chat_history(): | |
| """Clear the chat history""" | |
| context = get_tutor_context() | |
| context['chat_history'] = [] |