feat: auto-classify AI recipes as dish/drink (v0.33.0)
generate, generate-from-idea, URL import, and photo import all now have the AI set recipeType directly (defaulting to "dish" whenever ambiguous, per instruction), with cookMins force-cleared for drinks as a backstop in case the model doesn't follow the prompt guidance. 1-serving-by-default for unspecified drink quantities is left to the model's own judgment of the request text, since there's no reliable way to detect "was a serving count stated" without re-parsing intent. Drink recipes get a distinct default icon (no cover photo case), and Explore gains the same dish/drink Type filter My Recipes already had. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,7 @@ export async function POST(req: NextRequest) {
|
||||
title: recipe.title,
|
||||
description: recipe.description ?? null,
|
||||
baseServings: recipe.baseServings,
|
||||
recipeType: recipe.recipeType,
|
||||
prepMins: recipe.prepMins ?? null,
|
||||
cookMins: recipe.cookMins ?? null,
|
||||
difficulty: recipe.difficulty ?? null,
|
||||
|
||||
@@ -59,6 +59,7 @@ export async function POST(req: NextRequest) {
|
||||
title: recipe.title,
|
||||
description: recipe.description,
|
||||
baseServings: recipe.baseServings ?? 4,
|
||||
recipeType: recipe.recipeType,
|
||||
visibility: "private",
|
||||
difficulty: recipe.difficulty,
|
||||
prepMins: recipe.prepMins,
|
||||
|
||||
@@ -91,6 +91,12 @@ export async function GET(req: NextRequest) {
|
||||
conditions.push(eq(recipes.difficulty, difficulty));
|
||||
}
|
||||
|
||||
const recipeTypeParam = searchParams.get("recipeType");
|
||||
const recipeType = recipeTypeParam === "dish" || recipeTypeParam === "drink" ? recipeTypeParam : undefined;
|
||||
if (recipeType) {
|
||||
conditions.push(eq(recipes.recipeType, recipeType));
|
||||
}
|
||||
|
||||
if (maxMins !== undefined) {
|
||||
conditions.push(
|
||||
sql`(${recipes.prepMins} + ${recipes.cookMins}) <= ${maxMins}`
|
||||
|
||||
Reference in New Issue
Block a user