lanna_lalala;- commited on
Commit
92481b6
·
1 Parent(s): 08e67e4

feat: remove dotenv, and env

Browse files
Files changed (3) hide show
  1. app.py +0 -3
  2. phase/Student_view/chatbot.py +2 -7
  3. requirements.txt +0 -1
app.py CHANGED
@@ -14,11 +14,8 @@ from phase.Teacher_view import classmanage,studentlist,contentmanage
14
  from phase.Student_view.games import profitpuzzle
15
  from utils import db
16
  import os
17
- from dotenv import load_dotenv
18
 
19
 
20
- load_dotenv()
21
-
22
 
23
  # --- SESSION STATE INITIALIZATION ---
24
  for key, default in [("user", None), ("current_page", "Welcome"),
 
14
  from phase.Student_view.games import profitpuzzle
15
  from utils import db
16
  import os
 
17
 
18
 
 
 
19
 
20
  # --- SESSION STATE INITIALIZATION ---
21
  for key, default in [("user", None), ("current_page", "Welcome"),
phase/Student_view/chatbot.py CHANGED
@@ -2,16 +2,11 @@ import streamlit as st
2
  import datetime
3
  import os
4
  from openai import OpenAI
5
- from dotenv import load_dotenv
6
 
7
- # Load environment variables from .env file if present
8
- load_dotenv()
9
-
10
- # Ensure OPENAI_API_KEY is set
11
  api_key = os.getenv("OPENAI_API_KEY")
12
  if not api_key:
13
- st.error("⚠️ Please set the OPENAI_API_KEY environment variable or .env file before running the app.")
14
-
15
  client = OpenAI(api_key=api_key)
16
 
17
  # --- Helper to add message ---
 
2
  import datetime
3
  import os
4
  from openai import OpenAI
 
5
 
6
+ # Read from Space Secrets (Settings Variables & secrets)
 
 
 
7
  api_key = os.getenv("OPENAI_API_KEY")
8
  if not api_key:
9
+ st.error("⚠️ OPENAI_API_KEY is not set. In your Space, add a Secret named OPENAI_API_KEY.")
 
10
  client = OpenAI(api_key=api_key)
11
 
12
  # --- Helper to add message ---
requirements.txt CHANGED
@@ -23,7 +23,6 @@ pydantic>=2.7.4,<3.0
23
  pydantic-core>=2.18.4,<3.0
24
 
25
  # ---- Utilities ----
26
- python-dotenv==1.0.1
27
  tenacity>=8.2.3
28
  requests>=2.32.0
29
  markdownify>=0.12.1
 
23
  pydantic-core>=2.18.4,<3.0
24
 
25
  # ---- Utilities ----
 
26
  tenacity>=8.2.3
27
  requests>=2.32.0
28
  markdownify>=0.12.1