debugging for trips assistant
This commit is contained in:
@@ -84,6 +84,11 @@ async def _places_search(query: str, near: str) -> list[dict]:
|
|||||||
params={"query": f"{query} {near}".strip(), "key": settings.google_maps_api_key},
|
params={"query": f"{query} {near}".strip(), "key": settings.google_maps_api_key},
|
||||||
)
|
)
|
||||||
data = r.json()
|
data = r.json()
|
||||||
|
status = data.get("status")
|
||||||
|
results = data.get("results", [])
|
||||||
|
logger.info(f"Places search '{query} {near}': status={status}, count={len(results)}")
|
||||||
|
if status not in ("OK", "ZERO_RESULTS"):
|
||||||
|
logger.warning(f"Places API error: {status} — {data.get('error_message', '')}")
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"name": p.get("name"),
|
"name": p.get("name"),
|
||||||
@@ -92,7 +97,7 @@ async def _places_search(query: str, near: str) -> list[dict]:
|
|||||||
"maps_link": f"https://www.google.com/maps/place/?q=place_id:{p.get('place_id')}",
|
"maps_link": f"https://www.google.com/maps/place/?q=place_id:{p.get('place_id')}",
|
||||||
"rating": p.get("rating"),
|
"rating": p.get("rating"),
|
||||||
}
|
}
|
||||||
for p in data.get("results", [])[:5]
|
for p in results[:5]
|
||||||
]
|
]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Places search in assistant failed: {e}")
|
logger.error(f"Places search in assistant failed: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user