Skip to content

Commit

Permalink
Merge pull request #31 from mule/pr-25-text-not-wrapping-in-code-blocks
Browse files Browse the repository at this point in the history
Pr 25 text not wrapping in code blocks
  • Loading branch information
mule authored Jul 25, 2023
2 parents 0c2117d + 7229b6e commit fd75815
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ChatGptBlazorApp/Pages/Chat.razor
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</div>
<div class="row">
<div id="chatOutput" class="overflow-y">
<ul>
<ul style="max-width: 100em">
@{
if (_currentSession != null)
{
Expand Down
3 changes: 3 additions & 0 deletions ChatGptBlazorApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ await userRepo.InitializeAsync(new Dictionary<Guid, User>
new ChatSessionBlobStorageRepository(blobContainerClient.GetBlobClient("chatSessions.json"), Log.Logger);
await chatSessionRepo.InitializeAsync();

// var chatSessionRepo = new ChatSessionFileDb(new FileSystem(), Log.Logger, "./Data/chatsessionsdb.json");
// await chatSessionRepo.InitializeAsync();


builder.Services.AddSingleton<IChatSessionRepository, ChatSessionBlobStorageRepository>(ctx => chatSessionRepo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

namespace DataAccessLayer.Repositories;

public class ChatSessionFileDb : RepositoryFileDb<Guid, ChatSession>, IChatSessionRepository
public class ChatSessionFileRepository : FileSystemRepository<Guid, ChatSession>, IChatSessionRepository
{
public ChatSessionFileDb(IFileSystem fileSystem, ILogger logger, string dbFilePath) : base(fileSystem, logger,
public ChatSessionFileRepository(IFileSystem fileSystem, ILogger logger, string dbFilePath) : base(fileSystem,
logger,
dbFilePath)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

namespace DataAccessLayer.Repositories;

public class RepositoryFileDb<TK, T> : RepositoryBase<TK, T>, IInitializeableRepository<TK, T>
public class FileSystemRepository<TK, T> : RepositoryBase<TK, T>, IInitializeableRepository<TK, T>
where T : IModel<TK> where TK : notnull
{
private readonly string _dbFilePath;
private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;

public RepositoryFileDb(IFileSystem fileSystem, ILogger logger, string dbFilePath)
public FileSystemRepository(IFileSystem fileSystem, ILogger logger, string dbFilePath)
{
_fileSystem = fileSystem;
_dbFilePath = dbFilePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace DataAccessLayer.Repositories;

public class UserFileDb : RepositoryFileDb<Guid, User>, IUserRepository
public class UserFileRepository : FileSystemRepository<Guid, User>, IUserRepository
{
public UserFileDb(IFileSystem fileSystem, ILogger logger, string dbFilePath) : base(fileSystem, logger, dbFilePath)
public UserFileRepository(IFileSystem fileSystem, ILogger logger, string dbFilePath) : base(fileSystem, logger,
dbFilePath)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace DataAccessLayerTests;

public class RepositoryFileDbTests
public class FileSystemRepositoryTests
{
[Fact]
public async Task Should_be_able_to_initialize_an_empty_file_db()
Expand All @@ -16,7 +16,7 @@ public async Task Should_be_able_to_initialize_an_empty_file_db()
var testLogger = new TestLogger();

IFileSystem fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
var targetRepo = new RepositoryFileDb<Guid, User>(fileSystem, testLogger, mockDbFilePath);
var targetRepo = new FileSystemRepository<Guid, User>(fileSystem, testLogger, mockDbFilePath);

await targetRepo.InitializeAsync();

Expand All @@ -41,7 +41,7 @@ public async Task Should_be_able_to_initialize_a_file_db_with_data()
var testLogger = new TestLogger();

IFileSystem fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
var targetRepo = new RepositoryFileDb<string, TestModel>(fileSystem, testLogger, mockDbFilePath);
var targetRepo = new FileSystemRepository<string, TestModel>(fileSystem, testLogger, mockDbFilePath);
await targetRepo.InitializeAsync(testData);

targetRepo.IsInitialized.Should().BeTrue();
Expand All @@ -65,7 +65,7 @@ public async Task Should_be_able_to_add_new_item_to_file_db()
var testLogger = new TestLogger();

IFileSystem fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
var targetRepo = new RepositoryFileDb<string, TestModel>(fileSystem, testLogger, mockDbFilePath);
var targetRepo = new FileSystemRepository<string, TestModel>(fileSystem, testLogger, mockDbFilePath);
await targetRepo.InitializeAsync(testData);

targetRepo.IsInitialized.Should().BeTrue();
Expand Down Expand Up @@ -105,7 +105,7 @@ public async Task Should_be_able_to_update_item_in_file_db()
var testLogger = new TestLogger();

IFileSystem fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>());
var targetRepo = new RepositoryFileDb<string, TestModel>(fileSystem, testLogger, mockDbFilePath);
var targetRepo = new FileSystemRepository<string, TestModel>(fileSystem, testLogger, mockDbFilePath);
await targetRepo.InitializeAsync(testData);

targetRepo.IsInitialized.Should().BeTrue();
Expand Down

0 comments on commit fd75815

Please sign in to comment.