Spaces:
Sleeping
Sleeping
Update app.py
Browse filesdebugging the itenirary and changed how its working
app.py
CHANGED
|
@@ -145,6 +145,8 @@ def respond(destination, transportation, date, preference, include_options, mino
|
|
| 145 |
- **Additional Info:** {', '.join(include_options) if include_options else 'None'}
|
| 146 |
Provide a detailed travel guide based on these details.
|
| 147 |
"""
|
|
|
|
|
|
|
| 148 |
return prompt
|
| 149 |
|
| 150 |
|
|
@@ -158,11 +160,15 @@ def respond(destination, transportation, date, preference, include_options, mino
|
|
| 158 |
# return f"An error occurred: {e}"
|
| 159 |
|
| 160 |
def chatbot_respond(messages, chat_history):
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
if not travel_guide_output:
|
| 163 |
-
|
| 164 |
|
| 165 |
-
|
| 166 |
You are an AI travel assistant. The user has already generated a travel guide. Use the following details to assist them:
|
| 167 |
|
| 168 |
{travel_guide_output}
|
|
@@ -173,7 +179,7 @@ def chatbot_respond(messages, chat_history):
|
|
| 173 |
"""
|
| 174 |
|
| 175 |
try:
|
| 176 |
-
response = client.chat_completion(messages=[{"role": "
|
| 177 |
return response['choices'][0]['message']['content'].strip()
|
| 178 |
except Exception as e:
|
| 179 |
return f"An error occurred: {e}"
|
|
|
|
| 145 |
- **Additional Info:** {', '.join(include_options) if include_options else 'None'}
|
| 146 |
Provide a detailed travel guide based on these details.
|
| 147 |
"""
|
| 148 |
+
|
| 149 |
+
travel_guide_output = prompt
|
| 150 |
return prompt
|
| 151 |
|
| 152 |
|
|
|
|
| 160 |
# return f"An error occurred: {e}"
|
| 161 |
|
| 162 |
def chatbot_respond(messages, chat_history):
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
|
| 168 |
if not travel_guide_output:
|
| 169 |
+
travel_guide_output = "No travel guide has been generated yet. Please enter your travel details first."
|
| 170 |
|
| 171 |
+
system_message = f"""
|
| 172 |
You are an AI travel assistant. The user has already generated a travel guide. Use the following details to assist them:
|
| 173 |
|
| 174 |
{travel_guide_output}
|
|
|
|
| 179 |
"""
|
| 180 |
|
| 181 |
try:
|
| 182 |
+
response = client.chat_completion(messages=[{"role": "system", "content": system_message}])
|
| 183 |
return response['choices'][0]['message']['content'].strip()
|
| 184 |
except Exception as e:
|
| 185 |
return f"An error occurred: {e}"
|