feat(insights): read location context from Apollo (#177)
The local location_history table is a one-time Takeout import: it ends in 2019, still has the ghost-device and coarse cell-fix samples Apollo has since excluded, and was read loosely. The per-photo line took the nearest sample within +/-3 h at any distance (17% of photo moments got a position >2 km away), and get_location_history listed the first 20 rows of a +/-14-day window sorted ascending (always ~14 days before the date). With APOLLO_API_BASE_URL set: - per-photo context comes from /api/location/at (30 min max gap; no sample -> no line). A Place stay renders as "at Home (14:02-18:30)" in the display zone; an unnamed sample is reverse-geocoded. - get_location_history returns Apollo's /api/location/day timeline for the date (+/-1 day at most), and is offered even with an empty local table. Both fall back to the local table when Apollo is unset or a call fails; the local tool path now covers the requested local day(s) and samples evenly instead of listing a window's first rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22d28ee80f
commit
dc90407afb
3 files changed
+460
-38
No files matched your search
@@ -981,6 +981,20 @@ string. See `src/ai/apollo_client.rs` and `src/ai/insight_generator.rs`:
|
||||
variant; auto-enrichment covers the photo-context path and the agentic
|
||||
tool covers ad-hoc lat/lon questions in chat continuation.
|
||||
|
||||
- **Location context** (#177, Apollo #51): Apollo also owns the location
|
||||
track — cleaned of ghost devices and coarse cell fixes, and current (HA
|
||||
siphon, Garmin), unlike our `location_history` table, a one-time Takeout
|
||||
import that ends in 2019. When configured, the per-photo location line
|
||||
comes from `/api/location/at?ts=&max_gap=1800` (no sample within 30 min →
|
||||
no line, instead of the old nearest-within-±3 h at any distance; a Place
|
||||
stay renders as "You were at Home (14:02–18:30)" in the display zone —
|
||||
`render_apollo_location`), and the `get_location_history` tool returns
|
||||
Apollo's `/api/location/day` timeline (stays / stops / travel / gaps) for
|
||||
the date, ±1 day at most. Either falls back to `location_history` when
|
||||
Apollo is unset or the call fails; the local tool path samples evenly
|
||||
across the requested local day(s) rather than listing a window's first
|
||||
rows. The tool is offered whenever Apollo is configured, local table or not.
|
||||
|
||||
Failure modes degrade silently to the legacy Nominatim path: 5 s timeout,
|
||||
errors logged at `warn`, empty results returned. Apollo's routes are
|
||||
unauthenticated (single-user, LAN-trust); add JWT auth here + on Apollo's
|
||||
|
||||
Reference in new issue
Block a user