Spaces:
Running
Running
always requiring api key input
Browse files- 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 |
-
#
|
| 24 |
-
|
| 25 |
|
| 26 |
-
#
|
| 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 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 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 = []
|