Abhlash commited on
Commit
798733f
1 Parent(s): ef81fa8

updated chat

Browse files
Files changed (1) hide show
  1. bot/chat.py +6 -1
bot/chat.py CHANGED
@@ -6,6 +6,7 @@ import random
6
  import logging
7
  from groq import AsyncGroq, InternalServerError, APIError
8
 
 
9
  # Add the project root directory to sys.path
10
  project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
11
  sys.path.insert(0, project_root)
@@ -15,6 +16,7 @@ from utils.weather import get_weather
15
  from utils.packing import generate_packing_list
16
  from utils.events import get_burning_man_dates
17
  from bot.data import burning_man_principles, faq, survival_tips
 
18
 
19
 
20
  # Set up logging
@@ -131,7 +133,10 @@ async def chat_interface(message, history):
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:
 
6
  import logging
7
  from groq import AsyncGroq, InternalServerError, APIError
8
 
9
+
10
  # Add the project root directory to sys.path
11
  project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
12
  sys.path.insert(0, project_root)
 
16
  from utils.packing import generate_packing_list
17
  from utils.events import get_burning_man_dates
18
  from bot.data import burning_man_principles, faq, survival_tips
19
+ from utils.weather import get_weather, format_weather_report
20
 
21
 
22
  # Set up logging
 
133
  elif "weather" in user_message:
134
  weather_forecast = get_weather()
135
  weather_report = format_weather_report(weather_forecast)
136
+ if weather_forecast:
137
+ context = f"Hey there, playa pal! You're asking about the weather, huh? Well, I've got the latest forecast straight from the desert winds. Here's what Mother Nature has in store for Black Rock City:\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!"
138
+ else:
139
+ context = "Oh no! It seems like the dust storm has interfered with my weather sensors. I couldn't fetch the latest forecast. But hey, that's part of the adventure, right? Always be prepared for anything on the playa - from scorching heat to chilly nights, and of course, those legendary dust storms. Pack for all conditions and embrace the unpredictable nature of the desert!"
140
  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}"
141
 
142
  elif "principles" in user_message: