Spaces:
Sleeping
Sleeping
Update app_web.py
Browse files- app_web.py +6 -9
app_web.py
CHANGED
|
@@ -29,18 +29,15 @@ def cg_admin():
|
|
| 29 |
except Exception as e:
|
| 30 |
print("User is not logged in or the token is invalid:", e)
|
| 31 |
orgs = []
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
return True, orgs
|
| 35 |
-
|
| 36 |
-
return False, orgs
|
| 37 |
|
| 38 |
# 1. Force a clean state wipe on first load of the browser session
|
| 39 |
-
if "
|
| 40 |
st.session_state.clear() # Wipes out any residual states
|
| 41 |
-
st.session_state["
|
| 42 |
|
| 43 |
-
st.write(
|
| 44 |
# ββ Session initialisation βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 45 |
def init_session():
|
| 46 |
"""Initialise st.session_state with messages list, cfg, and last_retrieval."""
|
|
@@ -69,7 +66,7 @@ def render_sidebar():
|
|
| 69 |
cfg = st.session_state.cfg
|
| 70 |
|
| 71 |
with st.sidebar:
|
| 72 |
-
if
|
| 73 |
st.header("Settings")
|
| 74 |
|
| 75 |
# --- Provider dropdown ---
|
|
|
|
| 29 |
except Exception as e:
|
| 30 |
print("User is not logged in or the token is invalid:", e)
|
| 31 |
orgs = []
|
| 32 |
+
|
| 33 |
+
return orgs
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# 1. Force a clean state wipe on first load of the browser session
|
| 36 |
+
if "orgs" in st.session_state:
|
| 37 |
st.session_state.clear() # Wipes out any residual states
|
| 38 |
+
st.session_state["orgs"] = cg_admin()
|
| 39 |
|
| 40 |
+
st.write(st.session_state.orgs)
|
| 41 |
# ββ Session initialisation βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 42 |
def init_session():
|
| 43 |
"""Initialise st.session_state with messages list, cfg, and last_retrieval."""
|
|
|
|
| 66 |
cfg = st.session_state.cfg
|
| 67 |
|
| 68 |
with st.sidebar:
|
| 69 |
+
if "CGIAR" in st.session_state.orgs:
|
| 70 |
st.header("Settings")
|
| 71 |
|
| 72 |
# --- Provider dropdown ---
|