This commit is contained in:
Ionel Andrei Cataon
2026-02-18 17:36:18 +02:00
parent 1b08c99047
commit 30f10e8430

View File

@@ -194,14 +194,15 @@
const id = 'ai-'+Date.now(); box.innerHTML += `<div id="${id}" class="msg ai shadow">Analyzing nutrition data...</div>`;
box.scrollTop = box.scrollHeight;
const sysPrompt = {role:"system", content: `Expert Dietitian. Target: ${document.getElementById('kcal').innerText} kcal. SYSTEM: ${isMetric ? 'METRIC' : 'IMPERIAL'}.
const sysPrompt = {role:"system", content: `Expert Dietitian. TARGET: ${document.getElementById('kcal').innerText} kcal. SYSTEM: ${isMetric ? 'METRIC' : 'IMPERIAL'}.
CRITICAL MATH RULE: You MUST calculate the exact "Weight (RAW)" for every ingredient so that the sum of all meals equals precisely ${document.getElementById('kcal').innerText} kcal. The math in your tables MUST add up to this specific target.
HIERARCHY RULES:
1. Break down by DAY (e.g., ### Monday).
2. Break down each day by MEAL (e.g., #### Breakfast).
3. Every meal MUST have a table: | Ingredient | Weight (RAW) | Calories | P(g) | C(g) | F(g) |.
1. Break down by DAY (### Monday).
2. Break down each day by MEAL (#### Breakfast).
3. Every meal MUST have a table: | Ingredient | Weight (RAW) | Calories | P(g) | C(g) | f(g) |.
4. After each meal table, provide "Meal Total: [Kcal] | [P] | [C] | [F]".
5. At the end of each DAY, provide a bold "Daily Total: [Kcal] | [P] | [C] | [F]".
6. MANDATORY: Use DRY/RAW weights only.
6. MANDATORY: Use DRY/RAW weights only for all calories/macros.
7. Refer to previous messages for "GENERATE_SHOPPING_LIST" requests.`};
conversationHistory.push({role: "user", content: text});