Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,7 +45,7 @@ def weather_chat(city, custom_city, user_query):
|
|
| 45 |
alert = "⚠️ You may want to postpone any outdoor events." if "rain" in condition or "storm" in condition else ""
|
| 46 |
aqi_info = get_air_quality(lat, lon)
|
| 47 |
messages = [
|
| 48 |
-
{"role": "system", "content": "You are a helpful weather assistant. Give Celsius responses. "},
|
| 49 |
{"role": "user", "content": f"{report}\nTime: {time_context}\n{aqi_info}\n{alert}\nUser asked: {user_query}"}
|
| 50 |
]
|
| 51 |
try:
|
|
@@ -72,6 +72,7 @@ def get_recommendation(city, custom_city):
|
|
| 72 |
messages=[{"role": "system", "content": system_msg}, {"role": "user", "content": user_msg}],
|
| 73 |
temperature=0.3,
|
| 74 |
max_tokens=300
|
|
|
|
| 75 |
)
|
| 76 |
return f"{aqi}\n\n{response.choices[0].message.content}"
|
| 77 |
except Exception as e:
|
|
|
|
| 45 |
alert = "⚠️ You may want to postpone any outdoor events." if "rain" in condition or "storm" in condition else ""
|
| 46 |
aqi_info = get_air_quality(lat, lon)
|
| 47 |
messages = [
|
| 48 |
+
{"role": "system", "content": """"""You are a helpful weather assistant. Give Celsius responses.Do not answer questions not related to waether.""""},
|
| 49 |
{"role": "user", "content": f"{report}\nTime: {time_context}\n{aqi_info}\n{alert}\nUser asked: {user_query}"}
|
| 50 |
]
|
| 51 |
try:
|
|
|
|
| 72 |
messages=[{"role": "system", "content": system_msg}, {"role": "user", "content": user_msg}],
|
| 73 |
temperature=0.3,
|
| 74 |
max_tokens=300
|
| 75 |
+
stop=["BYE"],
|
| 76 |
)
|
| 77 |
return f"{aqi}\n\n{response.choices[0].message.content}"
|
| 78 |
except Exception as e:
|