Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,8 +8,12 @@ subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'groq'])
|
|
8 |
|
9 |
from groq import Groq
|
10 |
|
11 |
-
#
|
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):
|