Update session_state.py
Browse files- session_state.py +23 -27
session_state.py
CHANGED
@@ -1,28 +1,24 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
|
3 |
-
def initialize_session_state():
|
4 |
-
if 'initialized' not in st.session_state:
|
5 |
-
st.session_state.clear()
|
6 |
-
st.session_state.initialized = True
|
7 |
-
st.session_state.logged_in = False
|
8 |
-
st.session_state.page = 'login'
|
9 |
-
st.session_state.username = None
|
10 |
-
st.session_state.role = None
|
11 |
-
st.session_state.lang_code = 'es'
|
12 |
-
|
13 |
-
# Inicializar la estructura para el chat morfosintáctico
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
initialize_session_state()
|
25 |
-
st.session_state.logged_out = True # Añadimos esta bandera
|
26 |
-
|
27 |
-
# Exportar las funciones
|
28 |
__all__ = ['initialize_session_state', 'logout']
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def initialize_session_state():
|
4 |
+
if 'initialized' not in st.session_state:
|
5 |
+
st.session_state.clear()
|
6 |
+
st.session_state.initialized = True
|
7 |
+
st.session_state.logged_in = False
|
8 |
+
st.session_state.page = 'login'
|
9 |
+
st.session_state.username = None
|
10 |
+
st.session_state.role = None
|
11 |
+
st.session_state.lang_code = 'es'
|
12 |
+
|
13 |
+
# Inicializar la estructura para el chat morfosintáctico
|
14 |
+
st.session_state.morphosyntax_chat_history = []
|
15 |
+
st.session_state.morphosyntax_chat_input = ""
|
16 |
+
|
17 |
+
def logout():
|
18 |
+
for key in list(st.session_state.keys()):
|
19 |
+
del st.session_state[key]
|
20 |
+
initialize_session_state()
|
21 |
+
st.session_state.logged_out = True # Añadimos esta bandera
|
22 |
+
|
23 |
+
# Exportar las funciones
|
|
|
|
|
|
|
|
|
24 |
__all__ = ['initialize_session_state', 'logout']
|