Commit Graph

7 Commits

Author SHA1 Message Date
c51cd23d5e feat: enhanced AI usage logging (model, provider, response) and fixed build blockers 2025-12-27 00:10:55 +01:00
1017ec2c57 fix: Add Glengyle distillery (producer of Kilkerran)
Glengyle is the actual distillery name, Kilkerran is the brand.
AI returns 'Glengyle' which was being mismatched to 'Glenglassaugh'.
2025-12-26 22:34:49 +01:00
883b2b61b4 feat: Add Fuse.js distillery name normalization
New: src/lib/distillery-matcher.ts
- normalizeDistillery(): Fuzzy matches AI responses against distilleries.json
- cleanBottleName(): Removes distillery from bottle name to avoid duplication
- normalizeWhiskyData(): Combined helper for both operations

Example transformations:
- 'ARDNAHOE DISTILLERY CO LTD' → 'Ardnahoe'
- 'Laphroaig 10 Year Old' → '10 Year Old' (with distillery in separate field)

Integration:
- gemini-vision.ts now normalizes results after AI response
- Enables consistent distillery names for enrichment cache
2025-12-26 22:20:31 +01:00
ce49c9e347 feat: Route OpenRouter requests via Nebius with FP8 quantization
- Added OPENROUTER_PROVIDER_PREFERENCES config
- Prioritizes Nebius provider for better availability/speed
- Uses FP8 quantization for quality/speed balance
- Falls back to other providers if Nebius unavailable
2025-12-26 00:12:42 +01:00
8cf51d4aea fix: Add retry logic for OpenRouter 429 rate limit errors
- Retries up to 3 times with exponential backoff (2s, 4s, 8s)
- Also handles 503 service unavailable errors
- Logs retry attempts for debugging
- Only retries rate limit errors, other errors fail immediately
2025-12-26 00:06:21 +01:00
fb2a8d0f7b feat: Add OpenRouter as AI provider with easy switch
- Added openrouter.ts with provider configuration
- Default provider: OpenRouter with google/gemma-3-27b-it
- Switch to Gemini via AI_PROVIDER=gemini in .env.local
- Both providers use same credit system
- OpenRouter uses OpenAI-compatible API

To switch providers, set in .env.local:
AI_PROVIDER=openrouter  # default
AI_PROVIDER=gemini      # Google Gemini
2025-12-25 23:56:24 +01:00
afe9197776 feat: improved local OCR with Strip & Match distillery detection
- Added comprehensive distillery database (200+ entries)
- Implemented Strip & Match heuristic for fuzzy matching
- Added contextual age detection from distillery lines
- Added whitespace normalization for OCR text
- Disabled local name extraction (too noisy, let Gemini handle it)
- Fixed confidence scale normalization in TastingEditor (0-1 vs 0-100)
- Improved extractName filter (60% letters required)
- Relaxed Fuse.js thresholds for partial matches
2025-12-25 13:14:08 +01:00