fix(chat): clean up tool output and embedded UX

This commit is contained in:
2026-03-09 21:12:46 +00:00
parent bb54503235
commit d8c8ecf2bd
13 changed files with 588 additions and 198 deletions

View File

@@ -398,7 +398,9 @@ def get_trip_details(user, collection_id: str | None = None):
}
}
except Collection.DoesNotExist:
return {"error": "Trip not found"}
return {
"error": "collection_id is required and must reference a trip you can access"
}
except Exception:
logger.exception("get_trip_details failed")
return {"error": "An unexpected error occurred while fetching trip details"}
@@ -598,7 +600,7 @@ def get_weather(user, latitude=None, longitude=None, dates=None):
dates = dates or []
if not isinstance(dates, list) or not dates:
return {"error": "dates must be a non-empty list"}
return {"error": "dates is required"}
results = [
_fetch_temperature_for_date(latitude, longitude, date_value)

View File

@@ -337,7 +337,8 @@ When suggesting places:
- Group suggestions logically (by area, by type, by day)
When modifying itineraries:
- Always confirm with the user before adding items
- Confirm with the user before the first add_to_itinerary action in a conversation
- After the user clearly approves adding items (for example: "yes", "go ahead", "add them", "just add things there"), stop re-confirming and call add_to_itinerary directly for subsequent additions in that conversation
- Suggest logical ordering based on geography
- Consider travel time between locations

View File

@@ -253,6 +253,10 @@ class ChatViewSet(viewsets.ModelViewSet):
pass
if collection:
context_parts.append(
"Collection UUID (use this exact collection_id for get_trip_details and add_to_itinerary): "
f"{collection.id}"
)
itinerary_stops = []
seen_stops = set()
for location in collection.locations.select_related(