Shubham170793 commited on
Commit
6bf254d
Β·
verified Β·
1 Parent(s): 03ee985

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +19 -4
src/streamlit_app.py CHANGED
@@ -108,7 +108,7 @@ h1, h2, h3 {color: #f3f4f6; font-weight: 600;}
108
  """, unsafe_allow_html=True)
109
 
110
  # ==========================================================
111
- # 🧭 SIDEBAR β€” SIMPLE
112
  # ==========================================================
113
  with st.sidebar:
114
  st.markdown("### 🧭 Response Mode")
@@ -120,8 +120,23 @@ with st.sidebar:
120
  )
121
 
122
  st.markdown("---")
123
- show_advanced = st.checkbox("Show advanced settings (for developers)", value=False)
124
- if show_advanced:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  st.markdown("### Developer Settings")
126
  chunk_size = st.slider("Chunk Size (characters)", 200, 1500, 1000, step=50)
127
  overlap = st.slider("Chunk Overlap (characters)", 50, 200, 120, step=10)
@@ -133,7 +148,7 @@ with st.sidebar:
133
  st.caption("✨ Built by Shubham Sharma")
134
 
135
  # ==========================================================
136
- # 🧠 SESSION STATE
137
  # ==========================================================
138
  for key, val in {
139
  "user_query_input": "",
 
108
  """, unsafe_allow_html=True)
109
 
110
  # ==========================================================
111
+ # 🧭 SIDEBAR β€” STABLE, NO RERUN
112
  # ==========================================================
113
  with st.sidebar:
114
  st.markdown("### 🧭 Response Mode")
 
120
  )
121
 
122
  st.markdown("---")
123
+
124
+ # 🧠 Advanced settings β€” persistent, no rerun
125
+ if "show_advanced" not in st.session_state:
126
+ st.session_state.show_advanced = False
127
+
128
+ show_advanced_now = st.checkbox(
129
+ "Show advanced settings (for developers)",
130
+ value=st.session_state.show_advanced,
131
+ key="show_adv_checkbox"
132
+ )
133
+
134
+ # Detect toggle change without triggering full rerun
135
+ if show_advanced_now != st.session_state.show_advanced:
136
+ st.session_state.show_advanced = show_advanced_now
137
+ st.stop() # βœ… Prevents full rerun β€” keeps doc & state intact
138
+
139
+ if st.session_state.show_advanced:
140
  st.markdown("### Developer Settings")
141
  chunk_size = st.slider("Chunk Size (characters)", 200, 1500, 1000, step=50)
142
  overlap = st.slider("Chunk Overlap (characters)", 50, 200, 120, step=10)
 
148
  st.caption("✨ Built by Shubham Sharma")
149
 
150
  # ==========================================================
151
+ # 🧠 SESSION STATE INITIALIZATION
152
  # ==========================================================
153
  for key, val in {
154
  "user_query_input": "",