TangSan003 commited on
Commit
15ebcb5
·
1 Parent(s): 1b4c061

update requirements

Browse files
Files changed (2) hide show
  1. .gitignore +1 -1
  2. ai_agent.py +4 -2
.gitignore CHANGED
@@ -1 +1 @@
1
- .env
 
1
+ # .env
ai_agent.py CHANGED
@@ -47,11 +47,13 @@ def translate_back(text, target_lang):
47
  return text
48
 
49
  def load_llm():
50
- load_dotenv()
 
 
51
  return ChatGoogleGenerativeAI(
52
  model="gemini-1.5-flash",
53
  temperature=0.7,
54
- google_api_key=os.environ.get("GEMINI_API_KEY") # ✅ Truyền trực tiếp tại đây
55
  )
56
 
57
  # def load_llm():
 
47
  return text
48
 
49
  def load_llm():
50
+ key = os.environ.get("GEMINI_API_KEY")
51
+ if not key:
52
+ raise ValueError("❌ GEMINI_API_KEY chưa được thiết lập trong biến môi trường.")
53
  return ChatGoogleGenerativeAI(
54
  model="gemini-1.5-flash",
55
  temperature=0.7,
56
+ google_api_key=key
57
  )
58
 
59
  # def load_llm():