TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.35k stars 563 forks source link

New way of importing if website importing not possible #2680

Open Pentaonia opened 11 months ago

Pentaonia commented 11 months ago

Is your feature request related to a problem? Please describe.

I can't import recipes from several websites, for example: https://einfachvegantastisch.de/recipe/kichererbsen-tofu/

Describe the solution you'd like

It would be great to implement an editor like the one from "Paprika recipe manager". If it is not able to import directly, you can open it in an internal browser, select certain text (for example the description) and press a corresponding button in the footer. Afterwards it is pasted in the right field.

This would be a great addition to simply copy&paste recipes.

Describe alternatives you've considered

No response

Additional context

9ceaa4ce-0152-4544-b9d8-8f150f1cc8f5

che-rusker commented 10 months ago

I second that!

vabene1111 commented 10 months ago

nice idea but tricky to implement that in a website (paprika is a client application). Still smilerz old tree importer could do that, I removed it for simplicity at some point but something like that might make a come back. will leave this open as a reminder.

matclab commented 5 months ago

Another way is to use an opensource LLM to ask for formatting a recipe as json. I tried the following prompt on chatgpt with great success (french):

Voici un exemple de recette de gâteau à l'orange au format JSON-LD qui suit le schema json 'recipe' :

{"name":"Gâteau à l'orange facile et rapide","description":"Un condensé de moelleux, de douceur et de saveur ! Ce gâteau à l'orange, fondant à souhait, fera forcément son petit effet au moment du dessert ou du goûter ! En plus, la recette est facile et rapide à réaliser : 2 oranges, de la farine, du beurre, du sucre, des œufs, de la levure... en 10 minutes de préparation top chrono ! Il serait vraiment trop dommage de vous en priver, non ? Allez hop, testez-la, adoptez-la et surtout, partagez-la !","keywords":[{"name":"dessert","description":"","created_at":"2024-03-04T21:23:22.018664+01:00","updated_at":"2024-03-17T18:22:13.299837+01:00"},{"name":"gateaux","description":"","created_at":"2024-03-06T16:57:04.123690+01:00","updated_at":"2024-03-06T17:21:17.247872+01:00"}],"steps":[{"name":"","instruction":"Préchauffez le four th.6 (180°C).","ingredients":[],"time":0,"order":0,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Dans un saladier, fouettez ensemble le sucre en poudre, les œufs, la farine tamisée et la levure. Versez ensuite votre beurre fondu dans la préparation. Mélangez bien.","ingredients":[{"food":{"name":"Sucre en poudre","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"g","plural_name":"g","description":null},"amount":175.0,"note":"","order":0,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"oeufs","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":null,"amount":3.0,"note":"","order":1,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"Farine","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"g","plural_name":"g","description":null},"amount":175.0,"note":"","order":2,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"Beurre fondu","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"g","plural_name":"g","description":null},"amount":175.0,"note":"","order":3,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"Levure chimique","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"Sachet","plural_name":"Sachets","description":""},"amount":0.5,"note":"","order":4,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false}],"time":0,"order":1,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Lavez les oranges et zestez-les. Pressez-les pour en extraire le jus.","ingredients":[{"food":{"name":"Orange(s)","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":null,"amount":2.0,"note":"","order":0,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false}],"time":0,"order":2,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Ajoutez ensuite les zestes et la moitié du jus d'orange dans la pâte à gâteau. Réservez le reste du jus.","ingredients":[],"time":0,"order":3,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Beurrez et farinez un moule à manqué puis versez-y la pâte.","ingredients":[],"time":0,"order":4,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Enfournez pendant 30 min.","ingredients":[],"time":0,"order":5,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Lorsque votre gâteau à l'orange est cuit, sortez-le du four et arrosez-le du jus d'orange restant.  \n\nServez froid avec quelques tranches d'orange pour la décoration.","ingredients":[],"time":0,"order":6,"show_as_header":false,"show_ingredients_table":true}],"working_time":10,"waiting_time":30,"internal":true,"nutrition":null,"servings":6,"servings_text":"","source_url":"https://www.cuisineaz.com/recettes/gateau-a-l-orange-facile-et-rapide-54953.aspx"}

Peux-tu convertir la recette suivante dans le même format JSON-LD:

42Craft commented 2 months ago

Another way is to use an opensource LLM to ask for formatting a recipe as json. I tried the following prompt on chatgpt with great success (french):

Voici un exemple de recette de gâteau à l'orange au format JSON-LD qui suit le schema json 'recipe' :

{"name":"Gâteau à l'orange facile et rapide","description":"Un condensé de moelleux, de douceur et de saveur ! Ce gâteau à l'orange, fondant à souhait, fera forcément son petit effet au moment du dessert ou du goûter ! En plus, la recette est facile et rapide à réaliser : 2 oranges, de la farine, du beurre, du sucre, des œufs, de la levure... en 10 minutes de préparation top chrono ! Il serait vraiment trop dommage de vous en priver, non ? Allez hop, testez-la, adoptez-la et surtout, partagez-la !","keywords":[{"name":"dessert","description":"","created_at":"2024-03-04T21:23:22.018664+01:00","updated_at":"2024-03-17T18:22:13.299837+01:00"},{"name":"gateaux","description":"","created_at":"2024-03-06T16:57:04.123690+01:00","updated_at":"2024-03-06T17:21:17.247872+01:00"}],"steps":[{"name":"","instruction":"Préchauffez le four th.6 (180°C).","ingredients":[],"time":0,"order":0,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Dans un saladier, fouettez ensemble le sucre en poudre, les œufs, la farine tamisée et la levure. Versez ensuite votre beurre fondu dans la préparation. Mélangez bien.","ingredients":[{"food":{"name":"Sucre en poudre","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"g","plural_name":"g","description":null},"amount":175.0,"note":"","order":0,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"oeufs","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":null,"amount":3.0,"note":"","order":1,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"Farine","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"g","plural_name":"g","description":null},"amount":175.0,"note":"","order":2,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"Beurre fondu","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"g","plural_name":"g","description":null},"amount":175.0,"note":"","order":3,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false},{"food":{"name":"Levure chimique","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":{"name":"Sachet","plural_name":"Sachets","description":""},"amount":0.5,"note":"","order":4,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false}],"time":0,"order":1,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Lavez les oranges et zestez-les. Pressez-les pour en extraire le jus.","ingredients":[{"food":{"name":"Orange(s)","plural_name":null,"ignore_shopping":false,"supermarket_category":null},"unit":null,"amount":2.0,"note":"","order":0,"is_header":false,"no_amount":false,"always_use_plural_unit":false,"always_use_plural_food":false}],"time":0,"order":2,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Ajoutez ensuite les zestes et la moitié du jus d'orange dans la pâte à gâteau. Réservez le reste du jus.","ingredients":[],"time":0,"order":3,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Beurrez et farinez un moule à manqué puis versez-y la pâte.","ingredients":[],"time":0,"order":4,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Enfournez pendant 30 min.","ingredients":[],"time":0,"order":5,"show_as_header":false,"show_ingredients_table":true},{"name":"","instruction":"Lorsque votre gâteau à l'orange est cuit, sortez-le du four et arrosez-le du jus d'orange restant.  \n\nServez froid avec quelques tranches d'orange pour la décoration.","ingredients":[],"time":0,"order":6,"show_as_header":false,"show_ingredients_table":true}],"working_time":10,"waiting_time":30,"internal":true,"nutrition":null,"servings":6,"servings_text":"","source_url":"https://www.cuisineaz.com/recettes/gateau-a-l-orange-facile-et-rapide-54953.aspx"}

Peux-tu convertir la recette suivante dans le même format JSON-LD:

I also want to use a LLM to import recipes. Currently I've a lot of recipes in One Note.

What json schema should I use and how can I import the recipe as json?

smilerz commented 2 months ago

I also want to use a LLM to import recipes. Currently I've a lot of recipes in One Note.

What json schema should I use and how can I import the recipe as json? tell it ld+json and then paste it into the 'source' tab of the import recipe page.

42Craft commented 2 months ago

I also want to use a LLM to import recipes. Currently I've a lot of recipes in One Note. What json schema should I use and how can I import the recipe as json? tell it ld+json and then paste it into the 'source' tab of the import recipe page.

This worked beautifully. Thank you!

Do you maybe have any tips?

For example, I saw that the recipe steps did not include a title. I think I'll include this in the prompt from now on.

smilerz commented 2 months ago

For example, I saw that the recipe steps did not include a title. I think I'll include this in the prompt from now on.

It really depends on what you are trying to do. Below is a prompt I used in a script when converting recipe books just to give an idea what you can do.

prompt_before = "Return raw json. do not return anything but json. Do not add markdown " + "fences or whitespace. Process this image as a recipe, and convert to a " + "JSON document conforming to the schema found at schema.org/recipe. Take " + "the title from the image. Write a one sentence creative description. " + "Attribute authorship to '"

author variable inserted here

prompt_after = "'. Extract the number of servings " + "from the document, then calculate nutrition facts based off ingredients, " + "and add it to the final output. Do not explain the output, or add " + "supporting documentation. only show the final result. Make sure there " + "are no duplicate keys in the output. If there are any 'additional notes', " + "append them to the recipeInstructions list. If any extracted text is " + "in all caps, correct it to normal sentence casing. Convert metric " + "weight measures to imperial."