Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,14 +41,12 @@ def chatbot_response(user_message, chat_history):
|
|
| 41 |
temperature=1,
|
| 42 |
max_tokens=1024,
|
| 43 |
top_p=1,
|
| 44 |
-
stream=
|
| 45 |
stop=None,
|
| 46 |
)
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
bot_response =
|
| 50 |
-
for chunk in completion:
|
| 51 |
-
bot_response += chunk.choices[0].delta.content or ""
|
| 52 |
|
| 53 |
# 更新聊天記錄
|
| 54 |
chat_history.append(("user", user_message))
|
|
|
|
| 41 |
temperature=1,
|
| 42 |
max_tokens=1024,
|
| 43 |
top_p=1,
|
| 44 |
+
stream=False, # 不使用流式回應以簡化處理
|
| 45 |
stop=None,
|
| 46 |
)
|
| 47 |
|
| 48 |
+
# 獲取 Groq 的回應
|
| 49 |
+
bot_response = completion.choices[0].message['content']
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# 更新聊天記錄
|
| 52 |
chat_history.append(("user", user_message))
|