Abhlash commited on
Commit
ad84152
1 Parent(s): 34853f6

updated chat interface in chat

Browse files
Files changed (1) hide show
  1. bot/chat.py +46 -4
bot/chat.py CHANGED
@@ -103,8 +103,49 @@ async def chat_interface(message, history):
103
  current_year_info = get_current_year_info()
104
  logger.info(f"Received message: {user_message}")
105
 
106
- # Inject current year information into the prompt
107
- prompt = f"{current_year_info}\n\nUser: {message}\n\nAssistant:"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
  bot_message = await chat_with_groq(prompt, history)
110
 
@@ -116,8 +157,9 @@ async def chat_interface(message, history):
116
  except Exception as e:
117
  logger.error(f"Error in chat_interface: {str(e)}")
118
  burner_error_message = (
119
- "Yikes! The playa winds are strong today, and it seems our connection got a bit dusty. "
120
- "But don't worry, let's give it another go! Radical self-expression, right?"
 
121
  )
122
  return burner_error_message
123
 
 
103
  current_year_info = get_current_year_info()
104
  logger.info(f"Received message: {user_message}")
105
 
106
+ if "packing list" in user_message:
107
+ # Extract preferences from the user message
108
+ preferences = []
109
+ if "art" in user_message:
110
+ preferences.append("art")
111
+ if "music" in user_message:
112
+ preferences.append("music")
113
+
114
+ # Determine duration and transportation
115
+ duration = 7 # Default duration
116
+ if "week" in user_message:
117
+ duration = 7
118
+ elif "weekend" in user_message:
119
+ duration = 3
120
+
121
+ transportation = "car" # Default transportation
122
+ if "fly" in user_message or "plane" in user_message:
123
+ transportation = "plane"
124
+ elif "rideshare" in user_message:
125
+ transportation = "rideshare"
126
+
127
+ packing_list = generate_packing_list(duration, preferences, transportation)
128
+ context = f"Hey there, dusty friend! I hear you're gearing up for a {duration}-day adventure on the playa. That's awesome! I've put together a packing list tailored just for you, considering your love for {', '.join(preferences)} and your plan to get there by {transportation}. Remember, this is just a starting point - you know yourself best!\n\nHere's what I'd suggest packing:\n\n" + "\n".join(f"- {item}" for item in packing_list) + "\n\nRemember, the playa provides, but it's always better to be prepared. Don't forget to bring your radical self-reliance along with everything else!"
129
+ prompt = f"{current_year_info}\n\nUser asked for a packing list. Respond with this information, maintaining the friendly tone and adding your personal touch: {context}"
130
+
131
+ elif "weather" in user_message:
132
+ weather_forecast = get_weather()
133
+ weather_report = format_weather_report(weather_forecast)
134
+ context = f"Hey there, playa pal! You're asking about the weather, huh? Well, let me tell you, it's as unpredictable as a dust devil, but I'll do my best to give you the lowdown.\n\n{weather_report}\n\nNow, remember, weather on the playa is like a wild art car - it can change direction at any moment! Always be prepared for heat, cold, dust, and maybe even a little rain. Embrace the elements, but stay safe out there!"
135
+ prompt = f"{current_year_info}\n\nUser asked about the weather. Respond with this information, maintaining the friendly tone and adding your personal touch: {context}"
136
+
137
+ elif "principles" in user_message:
138
+ principles_info = "\n".join([f"{principle}: {description}" for principle, description in burning_man_principles.items()])
139
+ context = f"Ah, the 10 Principles! The very heart and soul of Burning Man. These aren't just rules, my dusty friend, they're a way of life on and off the playa. Let me break them down for you in true Burner style:\n\n{principles_info}\n\nRemember, these principles aren't just for Burning Man - they're a blueprint for building a better world. Which one resonates with you the most?"
140
+ prompt = f"{current_year_info}\n\nUser asked about the Burning Man principles. Respond with this information, maintaining the friendly tone and adding your personal touch: {context}"
141
+
142
+ elif "survival tips" in user_message:
143
+ tips = "\n".join([f"- {tip}" for tip in survival_tips])
144
+ context = f"Alright, future dusty warrior! Surviving and thriving on the playa is an art form, and I'm here to help you master it. Here are some tried-and-true survival tips from a seasoned Burner:\n\n{tips}\n\nRemember, the key to survival is preparation, but the key to thriving is participation. Embrace the dust, the heat, and the beautiful chaos. You've got this!"
145
+ prompt = f"{current_year_info}\n\nUser asked for survival tips. Respond with this information, maintaining the friendly tone and adding your personal touch: {context}"
146
+
147
+ else:
148
+ prompt = f"{current_year_info}\n\nUser: {message}\n\nAssistant:"
149
 
150
  bot_message = await chat_with_groq(prompt, history)
151
 
 
157
  except Exception as e:
158
  logger.error(f"Error in chat_interface: {str(e)}")
159
  burner_error_message = (
160
+ "Whoa there, dusty friend! Looks like a sandstorm just hit our connection. "
161
+ "But no worries - we Burners are all about adapting to challenges. "
162
+ "Why don't you try asking your question again? Remember, persistence is key on the playa!"
163
  )
164
  return burner_error_message
165