Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -132,8 +132,13 @@ def respond(message, history, use_spanish, chatbot_mode, destinations, season, l
|
|
| 132 |
elif "Food/Attractions" in chatbot_mode:
|
| 133 |
messages = [{"role": "system", "content": f"You're a friendly and gen z chatbot. Base your response on the provided context: {top_food} and {top_attraction}."}]
|
| 134 |
|
|
|
|
|
|
|
|
|
|
| 135 |
if history:
|
| 136 |
-
|
|
|
|
|
|
|
| 137 |
|
| 138 |
messages.append({"role": "user", "content": message})
|
| 139 |
|
|
@@ -143,7 +148,12 @@ def respond(message, history, use_spanish, chatbot_mode, destinations, season, l
|
|
| 143 |
temperature = 1
|
| 144 |
)
|
| 145 |
|
| 146 |
-
reply = response['choices'][0]['message']['content'].strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
history.append((message, reply))
|
| 148 |
return history, ""
|
| 149 |
|
|
|
|
| 132 |
elif "Food/Attractions" in chatbot_mode:
|
| 133 |
messages = [{"role": "system", "content": f"You're a friendly and gen z chatbot. Base your response on the provided context: {top_food} and {top_attraction}."}]
|
| 134 |
|
| 135 |
+
# if history:
|
| 136 |
+
# messages.extend(history)
|
| 137 |
+
|
| 138 |
if history:
|
| 139 |
+
for user_msg, bot_reply in history:
|
| 140 |
+
messages.append({"role": "user", "content": user_msg})
|
| 141 |
+
messages.append({"role": "assistant", "content": bot_reply})
|
| 142 |
|
| 143 |
messages.append({"role": "user", "content": message})
|
| 144 |
|
|
|
|
| 148 |
temperature = 1
|
| 149 |
)
|
| 150 |
|
| 151 |
+
#reply = response['choices'][0]['message']['content'].strip()
|
| 152 |
+
if isinstance(response, dict):
|
| 153 |
+
reply = response['choices'][0]['message']['content'].strip()
|
| 154 |
+
else:
|
| 155 |
+
reply = response.strip()
|
| 156 |
+
|
| 157 |
history.append((message, reply))
|
| 158 |
return history, ""
|
| 159 |
|