From ef9ba6308b482fbec7c028a6362fe21440a46fca Mon Sep 17 00:00:00 2001 From: Zak Lee Date: Tue, 22 Oct 2024 12:49:26 -0700 Subject: [PATCH] fixup session state --- computer-use-demo/computer_use_demo/streamlit.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/computer-use-demo/computer_use_demo/streamlit.py b/computer-use-demo/computer_use_demo/streamlit.py index 6d0dbe43..6750029c 100644 --- a/computer-use-demo/computer_use_demo/streamlit.py +++ b/computer-use-demo/computer_use_demo/streamlit.py @@ -61,8 +61,6 @@ def setup_state(): st.session_state.api_key = load_from_storage("api_key") or os.getenv( "ANTHROPIC_API_KEY", "" ) - if "api_key_input" not in st.session_state: - st.session_state.api_key_input = st.session_state.api_key if "provider" not in st.session_state: st.session_state.provider = ( os.getenv("API_PROVIDER", "anthropic") or APIProvider.ANTHROPIC @@ -124,14 +122,10 @@ def _reset_api_provider(): if st.session_state.provider == APIProvider.ANTHROPIC: st.text_input( "Anthropic API Key", - value=st.session_state.api_key, type="password", - key="api_key_input", - on_change=lambda: save_to_storage( - "api_key", st.session_state.api_key_input - ), + key="api_key", + on_change=lambda: save_to_storage("api_key", st.session_state.api_key), ) - st.session_state.api_key = st.session_state.api_key_input st.number_input( "Only send N most recent images",