diff --git a/backend/API/Controllers/RecipeController.cs b/backend/API/Controllers/RecipeController.cs index 2699f1e..bd65528 100644 --- a/backend/API/Controllers/RecipeController.cs +++ b/backend/API/Controllers/RecipeController.cs @@ -62,10 +62,10 @@ namespace API.Controllers } [Authorize] - [HttpGet("chatbot/{dish}")] - public async Task GenerateRecipe(string dish, string language, int numberOfRecipes = 5) + [HttpPost("chatbot")] + public async Task GenerateRecipe([FromBody] GenerateRecipeDTO recipeDTO) { - var recipes = await _openAiRecipes.ChatGPT(dish, language, numberOfRecipes); + var recipes = await _openAiRecipes.ChatGPT(recipeDTO.Dish, recipeDTO.Language, recipeDTO.NumberOfRecipes); if (recipes.Content[0].Text == null || recipes.Content[0].Text == "") { return new ConflictObjectResult(new { message = "Could not connect to chatGPT" }); diff --git a/backend/API/Models/RecipeModels/GenerateRecipeDTO.cs b/backend/API/Models/RecipeModels/GenerateRecipeDTO.cs new file mode 100644 index 0000000..6d869b5 --- /dev/null +++ b/backend/API/Models/RecipeModels/GenerateRecipeDTO.cs @@ -0,0 +1,11 @@ +namespace API.Models.RecipeModels +{ + public class GenerateRecipeDTO + { + public string Dish { get; set; } + + public string Language { get; set; } + + public int NumberOfRecipes { get; set; } = 5; + } +}