harry-lu-0708 commited on
Commit
5c70ff1
·
1 Parent(s): 1c3b9c7

Fix case study file browser state when switching conversations

Browse files
Files changed (1) hide show
  1. streamlit-client/app.py +3 -1
streamlit-client/app.py CHANGED
@@ -578,12 +578,14 @@ if st.session_state.view_mode == "case_study":
578
  case_dir = selected_path.parent
579
  ws_dir = case_dir / "workspace"
580
  browse_path = ws_dir if ws_dir.exists() else case_dir
 
 
581
  with st.expander("📂 Workspace Files (Agent Code)", expanded=False):
582
  st.caption(f"Browsing: `{browse_path.resolve()}`")
583
  if st_file_browser is not None:
584
  st_file_browser(
585
  str(browse_path.resolve()),
586
- key="case_study_file_browser",
587
  show_choose_file=True,
588
  show_download_file=True,
589
  show_delete_file=False,
 
578
  case_dir = selected_path.parent
579
  ws_dir = case_dir / "workspace"
580
  browse_path = ws_dir if ws_dir.exists() else case_dir
581
+ # Use a case-specific key so switching case study resets browser state correctly
582
+ fb_key = f"case_study_file_browser_{case_dir.name}"
583
  with st.expander("📂 Workspace Files (Agent Code)", expanded=False):
584
  st.caption(f"Browsing: `{browse_path.resolve()}`")
585
  if st_file_browser is not None:
586
  st_file_browser(
587
  str(browse_path.resolve()),
588
+ key=fb_key,
589
  show_choose_file=True,
590
  show_download_file=True,
591
  show_delete_file=False,