File size: 968 Bytes
513d7d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
814d837
513d7d9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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'] = []