nutri-cal 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +4 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -44,10 +44,11 @@ server.tool(
44
44
  "calculate_nutrition",
45
45
  {
46
46
  chatID: z.string().describe("The chat session ID"),
47
+ meal_order: z.string().describe("The order of the meal (e.g., breakfast, lunch, dinner)"),
47
48
  ingredientName: z.string().describe("The name of the ingredient"),
48
49
  amount: z.number().describe("The amount of ingredient in grams"),
49
50
  },
50
- async ({ chatID, ingredientName, amount }) => {
51
+ async ({ chatID, meal_order, ingredientName, amount }) => {
51
52
  try {
52
53
  // 1. Fetch food data from Redis
53
54
  const foodKey = `food:${ingredientName}`;
@@ -78,7 +79,7 @@ server.tool(
78
79
  };
79
80
 
80
81
  // 3. Store/Accumulate in Redis atomically
81
- const userKey = `cal_res:${chatID}`;
82
+ const userKey = `cal_res:${chatID}_${meal_order}`;
82
83
 
83
84
  const pipeline = redis.multi();
84
85
  pipeline.hincrbyfloat(userKey, "Protein", calculatedNutrition.Protein);
@@ -101,7 +102,7 @@ Carbs: ${calculatedNutrition.Carbs.toFixed(2)}g
101
102
  Fiber: ${calculatedNutrition.Fiber.toFixed(2)}g
102
103
  Calories: ${calculatedNutrition.Calories.toFixed(2)}kcal
103
104
 
104
- Successfully added to daily total for ChatID: ${chatID} (Expires in 10 minutes)`,
105
+ Successfully added to daily total for ChatID: ${chatID}, Meal: ${meal_order} (Expires in 10 minutes)`,
105
106
  },
106
107
  ],
107
108
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nutri-cal",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {