Skip to content

Commit fe013a0

Browse files
committed
Migrated more to .NET 9
1 parent 66c907a commit fe013a0

File tree

5 files changed

+21
-25
lines changed

5 files changed

+21
-25
lines changed

Fritz.Chatbot/Commands/PredictHatCommand.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ public class PredictHatCommand : IBasicCommand
2828

2929
internal static string IterationName = "";
3030
private ScreenshotTrainingService _TrainHat;
31-
private readonly HatDescriptionRepository _Repository;
31+
//private readonly HatDescriptionRepository _Repository;
3232
private readonly IHubContext<ObsHub> _HubContext;
3333

34-
public PredictHatCommand(IConfiguration configuration, ScreenshotTrainingService service, HatDescriptionRepository repository, IHubContext<ObsHub> hubContext)
34+
public PredictHatCommand(IConfiguration configuration, ScreenshotTrainingService service, IHubContext<ObsHub> hubContext)
3535
{
3636
_CustomVisionKey = configuration["AzureServices:HatDetection:Key"];
3737
_AzureEndpoint = configuration["AzureServices:HatDetection:CustomVisionEndpoint"];
3838
_TwitchChannel = configuration["StreamServices:Twitch:Channel"];
3939
_AzureProjectId = Guid.Parse(configuration["AzureServices:HatDetection:ProjectId"]);
4040
_TrainHat = service;
41-
_Repository = repository;
41+
//_Repository = repository;
4242
_HubContext = hubContext;
4343
}
4444

@@ -86,13 +86,13 @@ public async Task Execute(IChatService chatService, string userName, ReadOnlyMem
8686

8787
if (result.Predictions.Count(b => b.Probability > 0.4d) > 1) {
8888

89-
var guess1Data = (await _Repository.GetHatData(bestMatch.TagName));
90-
var guess2Data = (await _Repository.GetHatData(result.Predictions.OrderByDescending(p => p.Probability).Skip(1).First().TagName));
89+
var guess1Data = new HatData("", ""); // (await _Repository.GetHatData(bestMatch.TagName));
90+
var guess2Data = new HatData("", ""); // (await _Repository.GetHatData(result.Predictions.OrderByDescending(p => p.Probability).Skip(1).First().TagName));
9191
await chatService.SendMessageAsync($"csharpGuess I'm not quite sure if this is {guess1Data.Name} ({bestMatch.Probability.ToString("0.0%")}) or {guess2Data.Name} ({result.Predictions.OrderByDescending(p => p.Probability).Skip(1).First().Probability.ToString("0.0%")})");
9292
return;
9393

9494
} else {
95-
var guessData = (await _Repository.GetHatData(bestMatch.TagName));
95+
var guessData = new HatData("", ""); // (await _Repository.GetHatData(bestMatch.TagName));
9696
await chatService.SendMessageAsync($"csharpGuess I'm not quite sure if this is {guessData.Name} ({bestMatch.Probability.ToString("0.0%")})");
9797
return;
9898
}
@@ -103,7 +103,7 @@ public async Task Execute(IChatService chatService, string userName, ReadOnlyMem
103103
return;
104104
}
105105

106-
var hatData = (await _Repository.GetHatData(bestMatch.TagName));
106+
var hatData = new HatData("", ""); // (await _Repository.GetHatData(bestMatch.TagName));
107107
var nameToReport = (hatData == null ? bestMatch.TagName : (string.IsNullOrEmpty(hatData.Name) ? bestMatch.TagName : hatData.Name));
108108
await chatService.SendMessageAsync($"csharpClip I think (with {bestMatch.Probability.ToString("0.0%")} certainty) Jeff is currently wearing his {nameToReport} hat csharpClip");
109109
if (hatData != null && !string.IsNullOrEmpty(hatData.Description)) await chatService.SendMessageAsync(hatData.Description);
@@ -127,4 +127,7 @@ private async Task IdentifyIterationName()
127127

128128
}
129129
}
130+
131+
internal record HatData(string Name, string Description);
132+
130133
}

Fritz.StreamTools/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
44
WORKDIR /app
55
EXPOSE 80
66
EXPOSE 443
77

8-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
8+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
99
WORKDIR /src
1010
COPY ["Fritz.StreamTools/Fritz.StreamTools.csproj", "Fritz.StreamTools/"]
1111
COPY ["Fritz.Chatbot/Fritz.Chatbot.csproj", "Fritz.Chatbot/"]

Fritz.StreamTools/Fritz.StreamTools.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
</ItemGroup>
2121
<ItemGroup>
2222
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
23-
<PackageReference Include="Bundgaard.MixerLib" Version="1.2.65" />
2423
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
2524
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.10" />
2625
<PackageReference Include="Microsoft.Azure.CognitiveServices.Language.TextAnalytics" Version="4.0.0" />

Test/Test.csproj

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
5-
3+
<TargetFramework>net9.0</TargetFramework>
64
<IsPackable>false</IsPackable>
75
</PropertyGroup>
8-
96
<ItemGroup>
107
<PackageReference Include="AutoFixture" Version="4.17.0" />
118
<PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" />
129
<PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" />
1310
<PackageReference Include="FluentAssertions" Version="6.5.1" />
14-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
16-
<PackageReference Include="Microsoft.AspNetCore.App" />
17-
<PackageReference Include="Moq" Version="4.16.1" />
18-
<PackageReference Include="System.IO.Abstractions" Version="16.1.10" />
19-
<PackageReference Include="xunit" Version="2.4.1" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
11+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
13+
<PackageReference Include="Moq" Version="4.20.72" />
14+
<PackageReference Include="System.IO.Abstractions" Version="21.2.1" />
15+
<PackageReference Include="xunit" Version="2.9.2" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
2117
<PrivateAssets>all</PrivateAssets>
2218
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2319
</PackageReference>
2420
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
2521
</ItemGroup>
26-
2722
<ItemGroup>
2823
<ProjectReference Include="..\Fritz.Chatbot\Fritz.Chatbot.csproj" />
2924
<ProjectReference Include="..\Fritz.StreamLib.Core\Fritz.StreamLib.Core.csproj" />
3025
<ProjectReference Include="..\Fritz.StreamTools\Fritz.StreamTools.csproj" />
3126
<ProjectReference Include="..\Fritz.Twitch\Fritz.Twitch.csproj" />
3227
</ItemGroup>
33-
34-
</Project>
28+
</Project>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.100",
3+
"version": "9.0.100",
44
"rollForward": "latestMajor"
55
}
66
}

0 commit comments

Comments
 (0)