Commit Graph

9 Commits

Author SHA1 Message Date
Henrik Jess Nielsen
f374088211 fix(offers): DE→DA translation returned nothing — disable thinking, batch big
Prod showed 0 of 467 headings translated while AI matching worked. Cause:
Haiku 5.5 defaults thinking on, which consumed the 4000-token budget on the
40-item translation batches and truncated the JSON, so every batch fell back
to German. Matching (one small response) slipped through.

- Disable thinking on both Claude calls (mechanical JSON tasks), via a shared
  _claude_json helper that retries without the flag if a model rejects it
- Raise max_tokens (16000 translate / 8000 match) so output fits even if
  thinking stays on
- Batch ~all headings in 1-2 calls (250) instead of 40, so the preamble isn't
  repeated per batch and we don't hammer the rate limit (cheaper, as suggested)
2026-10-30 11:19:40 +01:00
Henrik Jess Nielsen
8dd435a7d0 feat(offers): Danish translation and AI matching via Claude
Offers come from the German avis, so add Claude-backed language help,
reusing BlaaAi's ANTHROPIC_API_KEY + Haiku pattern. Both degrade
gracefully: without a key, offers stay German and the token heuristic
still matches.

- Translate offer headings DE→DA in the fetch job, cached per heading
  in a translations table (only new headings cost a call). UI shows
  Danish primary + German subtitle for in-store navigation.
- AI match the fixed list against offers (offer_matches table): Claude
  returns same-product matches, far more precise than the token
  heuristic (which false-matched e.g. Nutella jar → advent calendar).
  load_deals() prefers AI matches, falls back to the heuristic.
- Haiku 5.5 by default (MATCH_MODEL/TRANSLATE_MODEL env overridable to
  Sonnet); no temperature param (Haiku 5.5 rejects non-default).
- requirements: add anthropic
2026-10-30 11:02:47 +01:00
Henrik Jess Nielsen
3b0ea28db5 feat(koeb-nu): read-only "buy now" shopping status vs current offers
Add a /koeb-nu page that analyses the list without touching quantities:
- which fixed items are on offer in Lübeck right now (honest per-unit
  offer price in EUR + DKK, no fabricated saving vs the Danish-origin
  estimate, since the units differ)
- what still needs ticking off, grouped by section (+ picked offers)
- a selection of this week's cheapest Tilbud specials not on the list,
  linking to the full Tilbud page
Header gets a 🛒 Køb nu link. The source carries no pre-price, so no
discount % is shown.
2026-10-30 10:43:22 +01:00
Henrik Jess Nielsen
65a99d2138 feat(offers): live Lübeck offer prices with pick-to-list and deal matching
Fetch CITTI Lübeck offers from the Tjek API (German dealer 3czmZx only —
never the Danish Flensburg booklet) and surface them in the app.

- New offers + offer_meta tables; defensive hotspots parser; upsert by
  offer id, prune per re-fetched catalog while preserving picked rows
- Daily in-process refresh scheduler (data.db lives on the app's own
  Nomad alloc disk, so a separate periodic job can't share it) plus a
  manual POST /api/offers/refresh and an "Opdater" button
- /tilbud page: browse all offers by catalog, search, EUR + DKK, and tick
  offers onto the shopping list; picks appear in a Lübeck-tilbud section
  on the main list and check off as bought via the existing /api/price
- Match the fixed catalog items against current offers and show a
  "på tilbud" badge with the matched offer name (conservative word-
  boundary token match, >=2 tokens for multi-word names)
- Dockerfile: add ca-certificates for urllib HTTPS to the Tjek API
2026-10-30 10:35:43 +01:00
Henrik Jess Nielsen
cf999ae228 feat(trips): archive current list and start a fresh one
Add a "Arkivér & ny liste" button that snapshots the current trip
(checked items, prices, quantities, extras and custom categories)
into a new trips table, then clears the mutable state so the list
resets to the fresh catalog.

- New trips table in init_db() storing a self-contained JSON snapshot
  plus computed totals and item count
- POST /api/archive with a no-op guard against archiving an empty list
- /historik list view and /historik/<id> read-only detail view
- Photo files are kept so archived trips can still show them
2026-10-30 10:15:27 +01:00
Henrik Jess Nielsen
1570b6eceb feat(items): add German product names for in-store navigation
All checks were successful
Build and Deploy citti / build-and-deploy (push) Successful in 47s
Each item now shows the German name (de field) below the Danish name
so it's easier to find products on shelves in Citti Flensburg.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 01:33:25 +02:00
Henrik Jess Nielsen
6ce940759c feat(shopping): editable quantity field per item
All checks were successful
Build and Deploy citti / build-and-deploy (push) Successful in 26s
Each item row now has an editable qty input showing the planned amount
(e.g. "6 × ½ kg"). Changes are auto-saved via debounce to the prices
table and highlighted in accent color when modified from the default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 01:18:04 +02:00
Henrik Jess Nielsen
d7ab8e02a1 Fix Dockerfile static copy, dynamic port, health endpoint
Some checks failed
Build and Deploy citti / build-and-deploy (push) Has been cancelled
- Remove COPY static/ (runtime uploads live in DATA_DIR/uploads)
- Add /health endpoint
- Read PORT from env (NOMAD_PORT_http in production, 9756 local)
- citti.nomad: dynamic port, canary deploy, Consul/Traefik, health check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 01:04:29 +02:00
Henrik Jess Nielsen
1a3476c4d3 Add Flask shopping app with Nomad deployment
Some checks failed
deploy / deploy (push) Has been cancelled
Flask app serving the Citti shopping list with SQLite persistence,
per-category item addition, dynamic custom categories, photo upload,
and a post-trip price analysis page.

- Port 9756, DATA_DIR env var for persistent volume in Nomad
- Gitea Actions pipeline builds Docker image and deploys via Nomad API
- Makefile targets: run, install, build, push

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06 00:54:07 +02:00