Skip to content

Commit

Permalink
Created Recipe model.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisIvanov committed Jun 3, 2024
1 parent 587aa23 commit 8d7c8c2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/server/CookingApp/Models/RecipeModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace CookingApp.Models
{
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

public class RecipeModel
{
class Recipe
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public int Id { get; set; }
public string Content { get; set; }
public DateTime Created { get; set; }

}
}
}
13 changes: 9 additions & 4 deletions src/server/CookingApp/Services/OpenAI/Completions/Recipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using global::OpenAI.ObjectModels.RequestModels;
using global::OpenAI.ObjectModels;
using global::OpenAI.Interfaces;
using CookingApp.Infrastructure.Interfaces;
using MongoDB.Bson;

/// <summary>
/// This class it to assist with the personal needs of the user.
Expand All @@ -13,14 +15,16 @@ public class Recipe<T>
{
// field for UserSettingsDbService
// field for userManagerService
private readonly IRepository _repository;
private readonly IOpenAIService _openAIService;

public Recipe(IOpenAIService openAIService)
public Recipe(IOpenAIService openAIService, IRepository repository)
{
_openAIService = openAIService;
_repository = repository;
}

public async Task<string> CreateCompletion()
public async Task<string> CreateCompletion(string message)
{
// var user = await _userManager.GetUser();
// var userAllergies = await _userSettings.Where(x => x.UserId == user.Id).Select(x => x.Allergies).ToListAsync();
Expand Down Expand Up @@ -67,7 +71,8 @@ public async Task<string> CreateCompletion()
"\r\n" +
"\r\nAfter the potatoes have been in the oven for about 15 minutes, place the baking sheet with the fish in the oven." +
"\r\nBake the fish for 10-15 minutes, depending on the thickness of the fillets. The fish should be opaque and flake easily with a fork when done." +
"\r\nServe:\r\n" +
"\r\nServe:" +
"\r\n" +
"\r\nRemove both the fish and potatoes from the oven." +
"\r\nServe the baked fish with a side of roasted potatoes." +
"\r\nOptionally, garnish with additional fresh dill and serve with lemon wedges for an extra burst of flavor." +
Expand All @@ -76,7 +81,7 @@ public async Task<string> CreateCompletion()
"\r\nAdjust the seasoning according to your taste preference." +
"\r\nFeel free to add other herbs or spices that you like." +
"\r\nEnjoy your meal!"),
ChatMessage.FromUser("Where was it played?")
ChatMessage.FromUser(message)
},
Model = Models.Gpt_4o,
});
Expand Down

0 comments on commit 8d7c8c2

Please sign in to comment.