Skip to content

Commit

Permalink
🚑 hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
SkulderLock committed Aug 1, 2023
1 parent 13d80a5 commit 831d3b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public DaysMealsModel(MealModel breakfast, MealModel lunch, MealModel dinner, Da
this.mealDate = mealDate;
this.user = user;
this.userDateIdentifier = (user.getEmail() + mealDate.toString());
this.meal = "";
}

public MealModel getBreakfast() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MealModel {
private String name;

@NotBlank(message = "An image is required")
private String image;
private String image = "https://images.unsplash.com/photo-1498837167922-ddd27525d352?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80";

@NotBlank(message = "A Description is required")
private String description;
Expand All @@ -32,7 +32,7 @@ public MealModel(String name, String instructions,String description, String ima
this.name = name;
this.instructions = instructions;
this.description = description;
this.image = image;
this.image = "https://images.unsplash.com/photo-1498837167922-ddd27525d352?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80";
this.ingredients = ingredients;
this.cookingTime = cookingTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ public class OpenaiApiService {
private OpenaiPromptBuilder pBuilder = new OpenaiPromptBuilder();

public String fetchMealResponse(String Type) throws JsonMappingException, JsonProcessingException {
// String jsonResponse = getJSONResponse(Type);
// JsonNode jsonNode = jsonMapper.readTree(jsonResponse);
String jsonResponse = getJSONResponse(Type);
JsonNode jsonNode = jsonMapper.readTree(jsonResponse);

// String text = jsonNode.get("choices").get(0).get("text").asText();
// text = text.replace("\\\"", "\"");
// text = text.replace("\n", "");
// text = text.replace("/r/n", "\\r\\n");
// return text;
String text = jsonNode.get("choices").get(0).get("text").asText();
text = text.replace("\\\"", "\"");
text = text.replace("\n", "");
text = text.replace("/r/n", "\\r\\n");
return text;

return "{\"instructions\":\"1. Preheat oven to 375 degrees/r/n2. Grease a baking dish with butter/r/n3. Beat together the eggs, milk, and a pinch of salt/r/n4. Place the bread slices in the baking dish and pour the egg mixture over them/r/n5. Bake in the preheated oven for 25 minutes/r/n6. Serve warm with your favorite toppings\",\"name\":\"Baked French Toast\",\"description\":\"a delicious breakfast dish of egg-soaked bread\",\"ingredients\":\"6 slices of bread/r/n3 eggs/r/n3/4 cup of milk/r/nSalt/r/nButter\",\"cookingTime\":\"30 minutes\"}";
// return "{\"instructions\":\"1. Preheat oven to 375 degrees/r/n2. Grease a baking dish with butter/r/n3. Beat together the eggs, milk, and a pinch of salt/r/n4. Place the bread slices in the baking dish and pour the egg mixture over them/r/n5. Bake in the preheated oven for 25 minutes/r/n6. Serve warm with your favorite toppings\",\"name\":\"Baked French Toast\",\"description\":\"a delicious breakfast dish of egg-soaked bread\",\"ingredients\":\"6 slices of bread/r/n3 eggs/r/n3/4 cup of milk/r/nSalt/r/nButter\",\"cookingTime\":\"30 minutes\"}";
}

public String fetchMealResponse(String Type, String extendedPrompt)
Expand Down

0 comments on commit 831d3b8

Please sign in to comment.