File size: 935 Bytes
254eff8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

def initialize_session_state():
    if 'initialized' not in st.session_state:
        st.session_state.clear()
        st.session_state.initialized = True
        st.session_state.logged_in = False
        st.session_state.page = 'login'
        st.session_state.username = None
        st.session_state.role = None
        st.session_state.lang_code = 'es'

        # Inicializar la estructura para el chat morfosintáctico
        if 'morphosyntax' not in st.session_state:
            st.session_state.morphosyntax = {
                'chat': {
                    'input': 'chatbot'
                }
            }

def logout():
    for key in list(st.session_state.keys()):
        del st.session_state[key]
    initialize_session_state()
    st.session_state.logged_out = True  # Añadimos esta bandera

# Exportar las funciones
__all__ = ['initialize_session_state', 'logout']