fionasu commited on
Commit
45040ea
·
verified ·
1 Parent(s): 319bc19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -16
app.py CHANGED
@@ -118,47 +118,68 @@ def respond(message, history, use_spanish, chatbot_mode, destinations, trip_leng
118
  lang = "Spanish" if use_spanish else "English"
119
  ctx = (
120
  f"Language: {lang}\n"
121
- f"Destination: {', '.join(destinations)}\n"
122
- f"Trip Length: {trip_length} {trip_unit}\n"
123
- f"Luggage: {', '.join(luggage_types)} of size {luggage_size}\n"
124
- f"Food: {', '.join(food_prefs)}\n"
125
  )
126
 
 
127
  chatbot_purpose = f"Chatbot Mode: {chatbot_mode or 'Not specified'}"
128
  print(chatbot_purpose)
129
 
130
  # if chatbot_mode == "Packing":
131
- # messages = [{"role": "system", "content": f"You're a friendly and gen z chatbot. Base your response on the provided context: {top_weather} and {top_luggage}."}]
 
 
 
 
 
 
132
  # elif chatbot_mode == "Food/Attractions":
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
  # else:
135
- # messages = [{"role": "system", "content": f"You're a friendly and gen z chatbot helping travellers plan their trip to San Francisco and/or Los Angeles."}]
136
-
 
 
 
 
 
 
 
137
 
138
  if chatbot_mode == "Packing":
139
  messages = [{
140
  "role": "system",
141
  "content": (
142
- f"You're a friendly and Gen Z chatbot. Base your response on the provided context:\n"
143
- f"{str_top_weather}\n\n{str_top_luggage}"
 
144
  )
145
  }]
146
  elif chatbot_mode == "Food/Attractions":
147
  messages = [{
148
  "role": "system",
149
  "content": (
150
- f"You're a friendly and Gen Z chatbot. Base your response on the provided context:\n"
151
- f"{str_top_food}\n\n{str_top_attraction}"
 
152
  )
153
  }]
154
  else:
155
- # Default mode: general travel assistant
156
  messages = [{
157
  "role": "system",
158
  "content": (
159
- f"You're a friendly and Gen Z chatbot helping travelers plan their trip. "
160
- f"You can help with luggage, weather, food, and attractions. "
161
- f"Use any relevant context provided."
162
  )
163
  }]
164
 
 
118
  lang = "Spanish" if use_spanish else "English"
119
  ctx = (
120
  f"Language: {lang}\n"
121
+ f"Destination: {', '.join(destinations) if destinations else 'Not specified'}\n"
122
+ f"Trip Length: {trip_length} {trip_unit or ''}\n"
123
+ f"Luggage: {', '.join(luggage_types) if luggage_types else 'Not specified'}, Size: {luggage_size}L\n"
124
+ f"Food Preferences: {', '.join(food_prefs) if food_prefs else 'Not specified'}\n"
125
  )
126
 
127
+
128
  chatbot_purpose = f"Chatbot Mode: {chatbot_mode or 'Not specified'}"
129
  print(chatbot_purpose)
130
 
131
  # if chatbot_mode == "Packing":
132
+ # messages = [{
133
+ # "role": "system",
134
+ # "content": (
135
+ # f"You're a friendly and Gen Z chatbot. Base your response on the provided context:\n"
136
+ # f"{str_top_weather}\n\n{str_top_luggage}"
137
+ # )
138
+ # }]
139
  # elif chatbot_mode == "Food/Attractions":
140
+ # messages = [{
141
+ # "role": "system",
142
+ # "content": (
143
+ # f"You're a friendly and Gen Z chatbot. Base your response on the provided context:\n"
144
+ # f"{str_top_food}\n\n{str_top_attraction}"
145
+ # )
146
+ # }]
147
  # else:
148
+ # # Default mode: general travel assistant
149
+ # messages = [{
150
+ # "role": "system",
151
+ # "content": (
152
+ # f"You're a friendly and Gen Z chatbot helping travelers plan their trip. "
153
+ # f"You can help with luggage, weather, food, and attractions. "
154
+ # f"Use any relevant context provided."
155
+ # )
156
+ # }]
157
 
158
  if chatbot_mode == "Packing":
159
  messages = [{
160
  "role": "system",
161
  "content": (
162
+ f"You are a friendly and Gen Z travel chatbot helping with packing advice.\n\n"
163
+ f"{ctx}\n"
164
+ f"Relevant context:\n{str_top_weather}\n{str_top_luggage}"
165
  )
166
  }]
167
  elif chatbot_mode == "Food/Attractions":
168
  messages = [{
169
  "role": "system",
170
  "content": (
171
+ f"You are a friendly and Gen Z travel chatbot recommending food and attractions.\n\n"
172
+ f"{ctx}\n"
173
+ f"Relevant context:\n{str_top_food}\n{str_top_attraction}"
174
  )
175
  }]
176
  else:
 
177
  messages = [{
178
  "role": "system",
179
  "content": (
180
+ f"You are a friendly and Gen Z travel chatbot helping travelers plan trips to San Francisco and/or Los Angeles.\n\n"
181
+ f"{ctx}\n"
182
+ f"Use relevant context:\n{str_top_weather}\n{str_top_luggage}\n{str_top_food}\n{str_top_attraction}"
183
  )
184
  }]
185