Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nwaughachukwuma committed Oct 28, 2024
1 parent 655842e commit 2cee394
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/utils/chat_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ async def evaluate_final_response(ai_message: str, content_category: ContentCate
use_container_width=True,
on_click=UseAudiocast(summary, content_category).run,
):
pass
st.rerun()
with col2:
if st.button("Restart", use_container_width=True, on_click=reset_session):
pass
st.rerun()


class UseAudiocast:
Expand All @@ -110,7 +110,7 @@ def __init__(self, summary: str, content_category: ContentCategory):

def run(self):
"""
Start generating audiocast
Run command to start generating audiocast
"""
st.session_state.generating_audiocast = True

Expand Down Expand Up @@ -138,4 +138,3 @@ async def __use_audiocast_request(
)
print(f"Generate AudioCast Response: {audiocast_response}")
st.session_state.current_audiocast = audiocast_response
st.rerun()
8 changes: 5 additions & 3 deletions src/utils/session_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def init_session_state():


def reset_session():
"""Reset all session state"""
"""
Reset all session state.
#### Client must call st.rerun()
"""
st.session_state.messages = []
st.session_state.chat_session_id = str(uuid.uuid4())
st.session_state.current_audiocast = None
Expand All @@ -41,5 +45,3 @@ def reset_session():
st.session_state.prompt = None
st.session_state.generating_audiocast = False
st.cache_data.clear()

st.rerun()

0 comments on commit 2cee394

Please sign in to comment.