baxin commited on
Commit
9e16f56
·
1 Parent(s): 247a8eb

fix clear history issue

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -112,15 +112,10 @@ if "selected_model" not in st.session_state:
112
  st.session_state.selected_model = None
113
 
114
 
115
- # --- Clear history if model changes ---
116
  if st.session_state.selected_model != model_option:
117
- st.session_state.messages = []
118
- st.session_state.current_image_prompt_text = ""
119
- # --- MODIFICATION START ---
120
- # Clear the list of generated images when model changes
121
- st.session_state.generated_images_list = []
122
- # --- MODIFICATION END ---
123
  st.session_state.selected_model = model_option
 
124
  st.rerun()
125
 
126
  # --- Define Main Columns ---
 
112
  st.session_state.selected_model = None
113
 
114
 
115
+ # --- Track selected model, but do not clear chat or image state on model change ---
116
  if st.session_state.selected_model != model_option:
 
 
 
 
 
 
117
  st.session_state.selected_model = model_option
118
+ # Optionally rerun to update UI, but do not clear messages or images
119
  st.rerun()
120
 
121
  # --- Define Main Columns ---