chore: Load environment variables on startup and set them after saving

This commit is contained in:
ajaysi (aider)
2024-10-06 12:26:31 +05:30
parent 8deba8ec4e
commit 4cee9f0293

View File

@@ -1,5 +1,6 @@
import os import os
import streamlit as st import streamlit as st
from dotenv import load_dotenv
@st.cache_data @st.cache_data
def check_api_keys(): def check_api_keys():
@@ -7,6 +8,7 @@ def check_api_keys():
Checks if the required API keys are present in the environment variables. Checks if the required API keys are present in the environment variables.
Prompts the user to enter missing keys and saves them in the .env file. Prompts the user to enter missing keys and saves them in the .env file.
""" """
load_dotenv()
api_keys = { api_keys = {
"METAPHOR_API_KEY": "https://dashboard.exa.ai/login", "METAPHOR_API_KEY": "https://dashboard.exa.ai/login",
"TAVILY_API_KEY": "https://tavily.com/#api", "TAVILY_API_KEY": "https://tavily.com/#api",