Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(ai-import): give the keeper search a starting flight

Mauricee7f2e179541b
diff --git a/server/src/nest/llm-parse/booking-total.ts b/server/src/nest/llm-parse/booking-total.ts
index 116a3174a..68560b204 100644
--- a/server/src/nest/llm-parse/booking-total.ts
+++ b/server/src/nest/llm-parse/booking-total.ts
@@ -71,7 +71,7 @@ export function collapseRepeatedBookingTotal(nodes: Node[], documentText: string
if (!printed.onTotal || printed.lines >= priced.length) return nodes;
// The first to depart keeps it; a tie keeps the order the model gave.
- const keeper = priced.reduce((first, node) => (departure(node) < departure(first) ? node : first));
+ const keeper = priced.reduce((first, node) => (departure(node) < departure(first) ? node : first), priced[0]);
return nodes.map((node) => {
if (node === keeper || priceOf(node) == null) return node;
const { price: _price, priceCurrency: _currency, ...rest } = node;