fix(chat): stabilize assistant add flow and location routing
This commit is contained in:
@@ -49,9 +49,19 @@ def background_geocode_and_assign(location_id: str):
|
||||
if country:
|
||||
location.country = country
|
||||
|
||||
# Save updated location info
|
||||
update_fields = ["region", "city", "country"]
|
||||
display_name = (result.get("display_name") or "").strip()
|
||||
if display_name:
|
||||
max_length = Location._meta.get_field("location").max_length
|
||||
if max_length:
|
||||
display_name = display_name[:max_length]
|
||||
|
||||
if location.location != display_name:
|
||||
location.location = display_name
|
||||
update_fields.append("location")
|
||||
|
||||
# Save updated location info, skip geocode threading
|
||||
location.save(update_fields=["region", "city", "country"], _skip_geocode=True)
|
||||
location.save(update_fields=update_fields, _skip_geocode=True)
|
||||
|
||||
except Exception as e:
|
||||
# Optional: log or print the error
|
||||
|
||||
@@ -346,6 +346,7 @@ When chat context includes a trip collection:
|
||||
- Treat context as itinerary-wide (potentially multiple stops), not a single destination
|
||||
- Use get_trip_details first when you need complete collection context before searching for places
|
||||
- Ground place searches in trip stops and dates from the provided trip context
|
||||
- Only call search_places when you have a concrete, non-empty location string; if location is missing or unclear, ask a clarifying question to obtain it first
|
||||
|
||||
Be conversational, helpful, and enthusiastic about travel. Keep responses concise but informative."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user