Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- core/prompts.py +1 -1
- services/orchestrator.py +17 -1
core/prompts.py
CHANGED
|
@@ -6,7 +6,7 @@ def get_system_prompt(simulation_mode: str) -> str:
|
|
| 6 |
"ex": "You are a toxic, highly emotional ex-partner. The user is trying to talk to you. You are defensive, you twist their words, and you bring up past mistakes. You are very difficult to reason with.",
|
| 7 |
"vc": "You are a deeply skeptical VC or hostile board member. You interrupt often, you challenge the user's revenue numbers, and you demand hyper-specific metrics. Refuse to be easily convinced.",
|
| 8 |
"networking": "You are an executive at a networking event. The user is trying to introduce themselves to you. You are busy, slightly dismissive, and have a very short attention span. Make them work hard to earn your 60 seconds.",
|
| 9 |
-
"default": "You are Soara, an advanced
|
| 10 |
}
|
| 11 |
|
| 12 |
if simulation_mode == "default":
|
|
|
|
| 6 |
"ex": "You are a toxic, highly emotional ex-partner. The user is trying to talk to you. You are defensive, you twist their words, and you bring up past mistakes. You are very difficult to reason with.",
|
| 7 |
"vc": "You are a deeply skeptical VC or hostile board member. You interrupt often, you challenge the user's revenue numbers, and you demand hyper-specific metrics. Refuse to be easily convinced.",
|
| 8 |
"networking": "You are an executive at a networking event. The user is trying to introduce themselves to you. You are busy, slightly dismissive, and have a very short attention span. Make them work hard to earn your 60 seconds.",
|
| 9 |
+
"default": "You are Soara, an advanced AI model developed by Soaravox. Answer the user's questions clearly, accurately, and concisely. DO NOT use emojis. DO NOT provide generic menus or lists of things you can do. Do not offer unsolicited help or ask follow-up questions unless necessary to clarify their intent."
|
| 10 |
}
|
| 11 |
|
| 12 |
if simulation_mode == "default":
|
services/orchestrator.py
CHANGED
|
@@ -27,11 +27,27 @@ class Orchestrator:
|
|
| 27 |
elif client_lat and client_lon:
|
| 28 |
try:
|
| 29 |
import urllib.request, json
|
|
|
|
|
|
|
| 30 |
url = f"https://api.open-meteo.com/v1/forecast?latitude={client_lat}&longitude={client_lon}¤t_weather=true"
|
| 31 |
res = await asyncio.to_thread(urllib.request.urlopen, url)
|
| 32 |
data = json.loads(res.read())
|
| 33 |
cw = data.get("current_weather", {})
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
except Exception as e:
|
| 36 |
print(f"Weather API failed: {e}")
|
| 37 |
|
|
|
|
| 27 |
elif client_lat and client_lon:
|
| 28 |
try:
|
| 29 |
import urllib.request, json
|
| 30 |
+
|
| 31 |
+
# Get weather
|
| 32 |
url = f"https://api.open-meteo.com/v1/forecast?latitude={client_lat}&longitude={client_lon}¤t_weather=true"
|
| 33 |
res = await asyncio.to_thread(urllib.request.urlopen, url)
|
| 34 |
data = json.loads(res.read())
|
| 35 |
cw = data.get("current_weather", {})
|
| 36 |
+
|
| 37 |
+
# Try to reverse geocode to get city name
|
| 38 |
+
city_name = "Unknown City"
|
| 39 |
+
try:
|
| 40 |
+
req = urllib.request.Request(f"https://nominatim.openstreetmap.org/reverse?format=json&lat={client_lat}&lon={client_lon}&zoom=10", headers={'User-Agent': 'SoaravoxBot/1.0'})
|
| 41 |
+
geo_res = await asyncio.to_thread(urllib.request.urlopen, req)
|
| 42 |
+
geo_data = json.loads(geo_res.read())
|
| 43 |
+
if "name" in geo_data:
|
| 44 |
+
city_name = geo_data["name"]
|
| 45 |
+
elif "address" in geo_data:
|
| 46 |
+
city_name = geo_data["address"].get("city", geo_data["address"].get("town", geo_data["address"].get("county", "Unknown City")))
|
| 47 |
+
except Exception as ge:
|
| 48 |
+
print(f"Geocoding failed: {ge}")
|
| 49 |
+
|
| 50 |
+
context_blocks.append(f"--- USER'S EXACT LOCAL WEATHER ({city_name}) ---\nTemperature: {cw.get('temperature')} C\nWind Speed: {cw.get('windspeed')} km/h\n")
|
| 51 |
except Exception as e:
|
| 52 |
print(f"Weather API failed: {e}")
|
| 53 |
|