fix: finish hooking up accommodations flow

This commit is contained in:
bracesproul
2025-03-05 13:32:51 -08:00
parent 6923c99c32
commit 4e9f33a1d5
5 changed files with 196 additions and 16 deletions

View File

@@ -81,15 +81,16 @@ export async function callTools(
const tripPlan = response.tool_calls?.[0]?.args as
| z.infer<typeof schema>
| undefined;
if (!tripPlan) {
const toolCallId = response.tool_calls?.[0]?.id;
if (!tripPlan || !toolCallId) {
throw new Error("No trip plan found");
}
if (tripPlan.listAccommodations) {
ui.write(
"accommodations-list",
getAccommodationsListProps(state.tripDetails),
);
ui.write("accommodations-list", {
toolCallId,
...getAccommodationsListProps(state.tripDetails),
});
}
if (tripPlan.bookAccommodation && tripPlan.accommodationName) {
ui.write("book-accommodation", {