diff --git a/proiect-nutritie-java/src/main/webapp/index.html b/proiect-nutritie-java/src/main/webapp/index.html index f7e38e4..ea4b66a 100644 --- a/proiect-nutritie-java/src/main/webapp/index.html +++ b/proiect-nutritie-java/src/main/webapp/index.html @@ -195,15 +195,19 @@ box.scrollTop = box.scrollHeight; 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 (### 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 for all calories/macros. - 7. Refer to previous messages for "GENERATE_SHOPPING_LIST" requests.`}; + + CRITICAL MATHEMATICAL AUDIT: + 1. You MUST ensure that (Meal 1 + Meal 2 + Meal 3 + Snacks) equals EXACTLY ${document.getElementById('kcal').innerText} kcal. + 2. If the total is too low, you MUST increase the "Weight (RAW)" of primary ingredients (oats, rice, meat, etc.) until the sum is correct. + 3. DO NOT fake the total. Every row in your table must mathematically add up to the 'Meal Total', and all 'Meal Totals' must add up to the 'Daily Total'. + + STRUCTURE: + - Use ### [Day] and #### [Meal Name]. + - Table columns: | Ingredient | Weight (RAW) | Calories | P(g) | C(g) | F(g) |. + - Provide: "Meal Total: [Kcal] | [P] | [C] | [F]" after every table. + - Final line per day: Bold **Daily Total: [Sum of all meals]**. + + MANDATORY: All calculations must be based on RAW/DRY weights.`}; conversationHistory.push({role: "user", content: text});