Repository navigation
Add update_recipe tool to edit recipes in place - #81
Open
paultristanwagner wants to merge 1 commit into
Open
paultristanwagner wants to merge 1 commit into
paultristanwagner wants to merge 1 commit into
Conversation
The app edits a recipe by re-sending it whole to /api/v2/add_food with its id, with the nutrient profile recalculated client side; the server doesn't recalculate. update_recipe does the same, sharing the ingredient and nutrient math with create_recipe. The "full recipe" measure follows the new batch weight, a whole-batch serving stays whole-batch, and the g measure is kept (the server refuses a save that drops it). get_food_details now returns a recipe's ingredients so they can be read before editing. Verified against the live API. Claude-Session: https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ
9 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #73.
Adds an
update_recipetool to edit a recipe in place: rename it, changeits ingredients or amounts, resize its serving, or change its notes.
update_custom_foodrefuses recipes, because their nutrients come fromthe ingredients.
The app edits a recipe the same way
update_custom_foodedits a food: itre-sends the whole object to
POST /api/v2/add_foodwith itsid. It recalculates the per-100 gnutrientsitself before sending; the server stores what it gets. Verifiedagainst the live API with throwaway recipes:
ingredientsreplace the old list (they get new ingredient ids)namegmeasure(
"Cannot remove the grams measure from a gram-based food")Changes:
create_recipemoved into_recipe_ingredientswithout changes, so bothmethods share it.
update_recipe(food_id, *, name, ingredients, serving_grams, comments)edits under the per-food lock:serving_gramsis givenupdate_recipetool.add_recipe's ingredient parsing movedinto
_parse_ingredients, which both tools use.get_food_detailsnowreturns a recipe's
ingredients, in the shape these tools take, so theycan be read before editing.
https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ