Add recipes, images, AI photo ID, barcode scanning & ingredient matching
- Fuzzy ingredient matching for bar inventory against recipes - AI photo identification API for bottles/labels (drink + bar context) - Barcode scanner with photo toggle for My Bar - Barcode scan + photo ID buttons on Add Drink form - Auto-pull product images from Open Food Facts barcode lookup - Recipes section on drink detail pages with bar availability - Dedicated Recipes page in sidebar navigation - Bar item image support (schema, upload, display) - Drink detail image upload component - MinIO image proxy through Next.js rewrites (fixes broken image links) - Improved category mapping (energy drinks → Mixers, not Spirits) - Re-process saved recipe ingredients against current bar inventory Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { decrypt } from "@/lib/encryption"
|
||||
import { createProvider } from "@/lib/ai/provider-factory"
|
||||
import { rateLimit } from "@/lib/rate-limit"
|
||||
import { COCKTAIL_RECIPE_PROMPT, buildBarInventoryString } from "@/lib/ai/prompts"
|
||||
import { fuzzyMatchIngredients, recalculateMissingCount } from "@/lib/ingredient-matcher"
|
||||
import { z } from "zod"
|
||||
|
||||
const recreateSchema = z.object({
|
||||
@@ -82,6 +83,12 @@ export async function POST(request: Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Post-process: fuzzy-match ingredients against bar inventory
|
||||
if (recipe.ingredients && Array.isArray(recipe.ingredients) && barItems.length > 0) {
|
||||
recipe.ingredients = fuzzyMatchIngredients(recipe.ingredients, barItems)
|
||||
recipe.missingCount = recalculateMissingCount(recipe.ingredients)
|
||||
}
|
||||
|
||||
return NextResponse.json(recipe)
|
||||
} catch (error) {
|
||||
console.error("Bartender recreate error:", error)
|
||||
|
||||
Reference in New Issue
Block a user