Create recipes, suggest meals from available ingredients, and provide nutritional guidance.
Create recipes, suggest meals based on available ingredients, handle dietary restrictions, and provide basic nutritional information.
Do not output recipes as plain markdown text. Instead, build a beautiful, interactive recipe card as an HTML artifact displayed on the canvas. The recipe card should look like a polished cooking app (think Paprika, NYT Cooking, or Bon Appétit).
Generated hero image — Use generateImage to create a photorealistic, appetizing hero image of the finished dish. Place it at the top of the card. Style: overhead shot or 45-degree angle, natural lighting, on a styled surface with minimal props.
Serving size adjuster — Include a serving size selector (buttons or +/- stepper) that dynamically recalculates all ingredient quantities in real time. Store the base recipe quantities in JavaScript and multiply on change:
// Store base recipe for N servings
const baseServings = 4;
const ingredients = [
{ name: "chicken breast", qty: 2, unit: "lbs" },
{ name: "olive oil", qty: 2, unit: "Tbsp" },
// ...
];
function updateServings(newServings) {
const ratio = newServings / baseServings;
ingredients.forEach(ing => {
const scaled = ing.qty * ratio;
// Display with smart fractions (¼, ½, ¾) for common amounts
});
}
Card layout — Structure the visual card with:
Styling — Clean, modern, food-magazine aesthetic. Use warm tones, generous whitespace, readable serif or clean sans-serif fonts. Mobile-friendly layout. No cluttered sidebars.
Place the recipe card on the canvas as an iframe (1280x900 or similar).
Think in formula + flavor profile, not recipe lookup:
From Ruhlman's Ratio (the CIA-derived reference). All by weight, not volume — this is why they work:
| Thing | Ratio | Notes |
|---|---|---|
| Bread dough | 5 flour : 3 water (+yeast, salt 2% of flour wt) | Hydration % = water/flour. 60% = sandwich loaf, 75%+ = ciabatta/focaccia |
| Pasta dough | 3 flour : 2 egg | ~100g flour per person |
| Pie dough | 3 flour : 2 fat : 1 water | Fat cold, water iced. Overmix = tough |
| Cookie | 1 sugar : 2 fat : 3 flour | Base for shortbread → choc chip → anything |
| Biscuit/scone | 3 flour : 1 fat : 2 liquid | |
| Muffin/quick bread | 2 flour : 2 liquid : 1 egg : 1 fat | |
| Pancake | 2 flour : 2 liquid : 1 egg : ½ fat | Thinner = crêpe (drop the leavening) |
| Vinaigrette | 3 oil : 1 acid | Mustard to emulsify. Salt in the acid first |
| Custard | 1 part egg : 2 parts liquid | Crème brûlée, quiche filling, bread pudding base |
| Stock | 3 water : 2 bones | By weight. Simmer, never boil |
| Brine | 20 water : 1 salt (5% w/w) | |
| Rice (stovetop) | 1 rice : 1.5 water by volume | Less for jasmine, more for brown |
Knowing the ratio > knowing a recipe. Same cookie ratio → swap butter for brown butter, add miso, change sugar to brown — infinite variations, predictable results.
| Out of | Use | Conversion + caveat |
|---|---|---|
| Buttermilk | Milk + acid | 1 cup milk + 1 Tbsp lemon juice or vinegar, sit 5 min |
| 1 egg (binding) | Flax or chia | 1 Tbsp ground + 3 Tbsp water, gel 5 min. Max 2 eggs' worth — beyond that it gets gummy |
| 1 egg (leavening) | Aquafaba | 3 Tbsp chickpea liquid. Whips like whites |
| Butter (baking) | Oil | Use 80% of butter weight (butter is ~80% fat, 20% water). Less browning |
| Butter (baking, low-fat) | Unsweetened applesauce | 1:1, but cut other liquid slightly. Cakier texture |
| Heavy cream | Coconut cream (the solid part of the can) | 1:1. Faint coconut taste in delicate dishes |
| Cake flour | AP flour | 1 cup AP minus 2 Tbsp, replaced with 2 Tbsp cornstarch |
| Self-rising flour | AP + leavening | 1 cup AP + 1½ tsp baking powder + ¼ tsp salt |
| Brown sugar | White + molasses | 1 cup white + 1 Tbsp molasses |
| Wine (cooking) | Stock + acid | Equal vol stock + 1 Tbsp vinegar per cup |
| Fresh herbs | Dried | Use ⅓ the amount. Add early (dried needs heat to bloom) |
| Soy sauce | Tamari (GF) / coconut aminos | Tamari 1:1. Coconut aminos: use ~1.3× and add salt (it's sweeter, less salty) |
USDA FoodData Central (fdc.nal.usda.gov) — free API, no key needed for basic search. The authoritative macro/micro database.
# webFetch or requests
# Search: https://api.nal.usda.gov/fdc/v1/foods/search?query=chicken%20breast&api_key=DEMO_KEY
# Returns per-100g: kcal, protein, fat, carbs, fiber, plus micros
# Scale by actual gram weight, sum across ingredients, divide by servings
For quick estimates without the API: protein ~4 kcal/g, carbs ~4 kcal/g, fat ~9 kcal/g, alcohol ~7 kcal/g.
Gram conversions for common measures: 1 cup AP flour ≈ 125g; 1 cup sugar ≈ 200g; 1 cup butter ≈ 227g (2 sticks); 1 large egg ≈ 50g; 1 Tbsp oil ≈ 14g.
分析心理健康数据、识别心理模式、评估心理健康状况、提供个性化心理健康建议。支持与睡眠、运动、营养等其他健康数据的关联分析。