Skip to content

Commit

Permalink
blame rider
Browse files Browse the repository at this point in the history
  • Loading branch information
mirakst committed Nov 9, 2023
1 parent e6c6169 commit 00f6f8c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ChatRPG/API/HttpMessageHandlerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public HttpMessageHandler CreateHandler(string name)
private static HttpResponseMessage GenerateMockResponse(HttpRequestMessage request)
{
Console.Write("Please enter mocked API response: ");
string input = Console.ReadLine();
string? input = Console.ReadLine();
StringContent responseContent = new StringContent($$"""
{
"id": "chatcmpl-000",
Expand Down
2 changes: 1 addition & 1 deletion ChatRPG/API/OpenAiLlmClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class OpenAiLlmClient : IOpenAiLlmClient

public OpenAiLlmClient(IConfiguration configuration, IHttpClientFactory httpClientFactory)
{
_openAiApi = new OpenAIAPI(configuration.GetSection("ApiKeys").GetValue<string>("OpenAI") ?? string.Empty);
_openAiApi = new OpenAIAPI(configuration.GetSection("ApiKeys")?.GetValue<string>("OpenAI"));
_openAiApi.Chat.DefaultChatRequestArgs.Model = Model;
_openAiApi.Chat.DefaultChatRequestArgs.Temperature = Temperature;
_openAiApi.HttpClientFactory = httpClientFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override async Task<bool> ValidateAuthenticationStateAsync(
IServiceScope scope = _scopeFactory.CreateScope();
try
{
UserManager<TUser?> userManager = scope.ServiceProvider.GetRequiredService<UserManager<TUser>>();
UserManager<TUser> userManager = scope.ServiceProvider.GetRequiredService<UserManager<TUser>>();
return await ValidateSecurityStampAsync(userManager, authenticationState.User);
}
finally
Expand All @@ -47,7 +47,7 @@ protected override async Task<bool> ValidateAuthenticationStateAsync(
}
}

private async Task<bool> ValidateSecurityStampAsync(UserManager<TUser?> userManager, ClaimsPrincipal principal)
private async Task<bool> ValidateSecurityStampAsync(UserManager<TUser> userManager, ClaimsPrincipal principal)
{
TUser? user = await userManager.GetUserAsync(principal);
if (user == null)
Expand Down
6 changes: 3 additions & 3 deletions ChatRPG/Data/Models/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Character(Campaign campaign, CharacterType type, string name, string desc
public string Description { get; private set; } = null!;
public int MaxHealth { get; private set; }
public int CurrentHealth { get; private set; }
public ICollection<CharacterAbility> CharacterAbilities { get; } = new List<CharacterAbility>();
public ICollection<CharacterAbility?> CharacterAbilities { get; } = new List<CharacterAbility?>();

/// <summary>
/// Adjust the current health of this character.
Expand All @@ -54,9 +54,9 @@ public void AdjustHealth(int value)
/// </summary>
/// <param name="ability">The ability to add.</param>
/// <returns>The created <see cref="CharacterAbility"/> entity.</returns>
public CharacterAbility AddAbility(Ability ability)
public CharacterAbility? AddAbility(Ability ability)
{
CharacterAbility charAbility = CharacterAbilities.FirstOrDefault(a => a!.Ability == ability, null);
CharacterAbility? charAbility = CharacterAbilities.FirstOrDefault(a => a!.Ability == ability, null);
if (charAbility is not null)
{
return charAbility;
Expand Down
2 changes: 1 addition & 1 deletion ChatRPG/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div class="container">
&copy; 2023 - ChatRPG
@{
string foundPrivacy = Url.Page("/Privacy", new { area = "" });
string? foundPrivacy = Url.Page("/Privacy", new { area = "" });
}
@if (foundPrivacy != null)
{
Expand Down
2 changes: 1 addition & 1 deletion ChatRPG/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
ApplicationDbContext dbContext = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
dbContext.Database.Migrate();

UserManager<User?> userManager = scope.ServiceProvider.GetRequiredService<UserManager<User>>();
UserManager<User> userManager = scope.ServiceProvider.GetRequiredService<UserManager<User>>();
const string username = "test";
User? user = await userManager.FindByNameAsync(username);
if (user == null)
Expand Down

0 comments on commit 00f6f8c

Please sign in to comment.