Skip to content

Commit e3e62cb

Browse files
committed
Fix button related bug
1 parent b6a4740 commit e3e62cb

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/ChatUI_streamlit/app.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,13 @@ def get_last_modified_time(folder_path):
140140
st.write(f"Response generated in {response_time:.2f} seconds.")
141141
message = {"role": "assistant", "content": full_response}
142142
conversation["messages"].append(message)
143-
144-
if st.button("New Conversation"):
143+
144+
if 'run_button' in st.session_state and st.session_state.run_button == True:
145+
st.session_state.running = True
146+
else:
147+
st.session_state.running = False
148+
149+
if st.button("New Conversation", disabled=st.session_state.running, key='run_button'):
145150
# Clear chat messages
146151
st.session_state.conversations = [{"title": "Default Conversation", "messages": [{"role": "assistant", "content": "How may I assist you today?"}]}]
147152
# Trigger a rerun

0 commit comments

Comments
 (0)