feat: Collect all missing API keys using a Streamlit form.
This commit is contained in:
21
alwrity.py
21
alwrity.py
@@ -218,21 +218,12 @@ def main():
|
||||
setup_environment_paths()
|
||||
sidebar_configuration()
|
||||
|
||||
missing_keys = check_api_keys()
|
||||
if missing_keys:
|
||||
st.warning(f"API keys not found: {', '.join(missing_keys)}. Please provide them below. Restart the app after saving the keys.")
|
||||
with st.form(key='api_keys_form'):
|
||||
for key in missing_keys:
|
||||
st.text_input(f"{key}:", type="password", key=key)
|
||||
if st.form_submit_button("Save Keys"):
|
||||
with open(".env", "a") as env_file:
|
||||
for key in missing_keys:
|
||||
key_value = st.session_state[key]
|
||||
env_file.write(f"{key}={key_value}\n")
|
||||
st.success("API keys saved successfully! Please restart the application.")
|
||||
else:
|
||||
setup_tabs()
|
||||
modify_prompts_sidebar()
|
||||
if not check_api_keys():
|
||||
st.stop()
|
||||
if not check_llm_environs():
|
||||
st.stop()
|
||||
setup_tabs()
|
||||
modify_prompts_sidebar()
|
||||
|
||||
|
||||
def setup_environment_paths():
|
||||
|
||||
Reference in New Issue
Block a user