CasperDylan commited on
Commit
5067cdb
·
verified ·
1 Parent(s): e86aaf4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -8,8 +8,12 @@ subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'groq'])
8
 
9
  from groq import Groq
10
 
11
- # 初始化 Groq 客戶端
12
  groq_key = os.getenv("groq_key")
 
 
 
 
13
  client = Groq(api_key=groq_key)
14
 
15
  def chatbot_response(user_message):
 
8
 
9
  from groq import Groq
10
 
11
+ # 從環境變數中獲取 Groq API 密鑰
12
  groq_key = os.getenv("groq_key")
13
+ if not groq_key:
14
+ raise ValueError("Please set the groq_key environment variable.")
15
+
16
+ # 初始化 Groq 客戶端
17
  client = Groq(api_key=groq_key)
18
 
19
  def chatbot_response(user_message):