shawhin commited on
Commit
1b64e26
·
1 Parent(s): 03c592f

always requiring api key input

Browse files
Files changed (1) hide show
  1. src/main.py +8 -18
src/main.py CHANGED
@@ -20,28 +20,18 @@ async def run_streamlit_app():
20
  st.title("YouTube Agent")
21
  st.markdown("Upload YouTube videos and ask me anything!")
22
 
23
- # Get API key from environment or user input
24
- env_api_key = os.getenv("OPENAI_API_KEY")
25
 
26
- # Debug information
27
- st.write("🔍 **Debug Info:**")
28
- st.write(f"- `.env` file exists: {os.path.exists('.env')}")
29
- st.write(f"- Environment OPENAI_API_KEY: {'SET' if env_api_key else 'NOT SET'}")
30
- st.write(f"- Environment OPENAI_API_KEY value: {env_api_key[:10] + '...' if env_api_key else 'None'}")
31
-
32
- # Sidebar for API key (only show input if no env key)
33
  with st.sidebar:
34
  st.header("Configuration")
35
 
36
- if env_api_key:
37
- st.success(" API key loaded from .env file")
38
- api_key = env_api_key
39
- else:
40
- api_key = st.text_input(
41
- "OpenAI API Key",
42
- type="password",
43
- help="Enter your OpenAI API key to use the agent"
44
- )
45
 
46
  if st.button("Clear Chat"):
47
  st.session_state.messages = []
 
20
  st.title("YouTube Agent")
21
  st.markdown("Upload YouTube videos and ask me anything!")
22
 
23
+ # Force users to enter their own API key (ignore environment)
24
+ # This ensures the app works as intended for public use
25
 
26
+ # Sidebar for API key input
 
 
 
 
 
 
27
  with st.sidebar:
28
  st.header("Configuration")
29
 
30
+ api_key = st.text_input(
31
+ "OpenAI API Key",
32
+ type="password",
33
+ help="Enter your OpenAI API key to use the agent"
34
+ )
 
 
 
 
35
 
36
  if st.button("Clear Chat"):
37
  st.session_state.messages = []