Spaces:
Runtime error
Runtime error
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -292,12 +292,18 @@ class Tools:
|
|
| 292 |
location = location[0]
|
| 293 |
elif location and isinstance(location, list):
|
| 294 |
# No matching spaces found in the API, len of 0
|
| 295 |
-
location
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
if location and isinstance(location, dict):
|
| 297 |
# Weird response from the API, likely a timeout error, disable geoloc
|
| 298 |
location = None
|
| 299 |
if location and isinstance(location, str):
|
| 300 |
-
place_name += " , " + location
|
| 301 |
elif (
|
| 302 |
isinstance(place_name, dict)
|
| 303 |
and "results" in place_name
|
|
|
|
| 292 |
location = location[0]
|
| 293 |
elif location and isinstance(location, list):
|
| 294 |
# No matching spaces found in the API, len of 0
|
| 295 |
+
if len(location) == 0:
|
| 296 |
+
location = None
|
| 297 |
+
elif len(location) == 2:
|
| 298 |
+
# Likely a latitude and longitude tuple
|
| 299 |
+
location = f"lat: {location[0]}, long: {location[1]}"
|
| 300 |
+
else:
|
| 301 |
+
location = None
|
| 302 |
if location and isinstance(location, dict):
|
| 303 |
# Weird response from the API, likely a timeout error, disable geoloc
|
| 304 |
location = None
|
| 305 |
if location and isinstance(location, str):
|
| 306 |
+
place_name += " , " + location
|
| 307 |
elif (
|
| 308 |
isinstance(place_name, dict)
|
| 309 |
and "results" in place_name
|