Răsfoiți Sursa

TG-199: Fix Nginx 502 port and AI meal planner logic bugs

lanfr144 1 lună în urmă
părinte
comite
40ba111018
2 a modificat fișierele cu 7 adăugiri și 4 ștergeri
  1. 6 3
      app.py
  2. 1 1
      nginx/nginx.conf

+ 6 - 3
app.py

@@ -795,7 +795,7 @@ with tab_planner:
     p_col1, p_col2, p_col3 = st.columns(3)
     target_cal = p_col1.number_input("Target Daily Calories (kcal)", 1000, 5000, 2000, 50)
     diet_pref = p_col2.selectbox("Dietary Preference", ["Omnivore", "Vegetarian", "Vegan", "Keto", "Paleo"])
-    meal_count = p_col3.slider("Number of Meals", 2, 6, 3)
+    meal_count = p_col3.slider("Number of Meals", 1, 6, 3)
     extra_notes = st.text_input("Any additional allergies or goals?")
     
     if st.button("Generate Professional Menu"):
@@ -811,14 +811,17 @@ with tab_planner:
             selected_meals = ", ".join(meal_names[:int(meal_count)])
             
             sys_prompt = f"""You are a professional clinical Dietitian planner. Target: {target_cal}kcal. 
-            You must generate a meal plan consisting of EXACTLY these meals and no others: {selected_meals}.
+            You must generate a meal plan consisting of EXACTLY {meal_count} meals. Do NOT generate more than {meal_count} meals under any circumstance.
+            The allowed meal(s) are strictly: {selected_meals}.
             Dietary constraint: {diet_pref}. Additional notes: {extra_notes}.
             Health profile: {profile_text}. 
             
             CRITICAL INSTRUCTIONS:
             - You MUST formulate the menu using ONLY the following real database items retrieved for you: {db_context}
             - Output the menu beautifully formatted as a Markdown Table.
-            - Columns MUST be: | Meal Time | Exact Food | Portion Size | Calories | Protein |
+            - The Markdown table MUST strictly contain 5 columns separated by pipes (|).
+            - Columns MUST be exactly: | Meal Time | Exact Food | Portion Size | Calories | Protein |
+            - If you merge columns, the system will fail. Separate Calories and Protein with a pipe.
             - Do NOT output JSON. Do NOT use tool calls.
             - Provide a direct answer. Skip all thinking, reasoning, and pleasantries.
             """

+ 1 - 1
nginx/nginx.conf

@@ -8,7 +8,7 @@ http {
         server_name localhost;
 
         location / {
-            proxy_pass http://app:8502;
+            proxy_pass http://app:8501;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;