Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge "Development" into "main" #27

Merged
merged 34 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ca9c60d
Reducing thumbnail size
efonsecab Apr 20, 2024
6898b1a
Enabling support for multiple thumbnails
efonsecab Apr 20, 2024
8406bba
Displaying multipe thumbnails
efonsecab Apr 20, 2024
f39d66d
Upgrading to NET Aspire 4
efonsecab Apr 20, 2024
b7885d6
Fixing exception due to order after preview 4
efonsecab Apr 20, 2024
6d6aec5
Improving page
efonsecab Apr 20, 2024
f58d254
setting global json to force sdk version.
efonsecab Apr 21, 2024
72c6db4
Adding divider
efonsecab Apr 22, 2024
bf608e6
Merge pull request #25 from pticostaricags/dev-aspire-prev4
efonsecab Apr 22, 2024
500696e
Adding draft for sending messages
efonsecab Apr 26, 2024
8cc0c86
Fixing order of services configuration to fix issue not showing the logs
efonsecab Apr 26, 2024
3fadb62
Fixing order of services in admin portal
efonsecab Apr 26, 2024
f54343d
Fixing order of services
efonsecab Apr 27, 2024
02d0153
Upgrading to fix issues of metrics not shown
efonsecab Apr 28, 2024
55ecb45
Adding draft for custom metrics
efonsecab Apr 29, 2024
a56741f
Converting to use Dependency Injection for metrics
efonsecab Apr 29, 2024
67726aa
Adding ObservableGauge
efonsecab Apr 29, 2024
33291fb
Adding custom metric gauge
efonsecab Apr 29, 2024
6374d42
Replaced Azure Content Moderator with Azure AI Content Safety.
efonsecab Apr 29, 2024
b5fd0c3
Adding additional metrics.
efonsecab Apr 30, 2024
bdd6465
Fixing bug
efonsecab May 1, 2024
f5f48db
Centralizing UserMessage tables and models
efonsecab May 2, 2024
abe6d48
Displaying Local Data
efonsecab May 2, 2024
67969d1
Adding SignalR.
efonsecab May 2, 2024
673754a
Removing ability to send emails
efonsecab May 2, 2024
661e22b
Integrating Azure Content Safety into FairPlayTube.
efonsecab May 3, 2024
bcab902
Fixing issue with SignalR and performance degradation.
efonsecab May 3, 2024
b849434
Enabling support for comments
efonsecab May 3, 2024
86357e9
Add compression
efonsecab May 3, 2024
35a4e80
Disable prerendering
efonsecab May 3, 2024
afba3be
Fixing tests
efonsecab May 3, 2024
7866bdd
Improving discovery of users to send messages to
efonsecab May 4, 2024
c037ef8
Improving UI
efonsecab May 4, 2024
63ce909
upgrading packages
efonsecab May 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
@using FairPlayCombined.Common
@using FairPlayCombined.Models.Common.ConfigurationSecret
@using FairPlayCombined.Services.Common
@using Microsoft.Azure.CognitiveServices.ContentModerator

@inject IToastService toastService
@inject ConfigurationSecretService configurationSecretService
Expand Down Expand Up @@ -141,32 +140,38 @@
<FluentValidationMessage For="@( () => azureVideoIndexerSubscriptionIdConfiguration.Value)"></FluentValidationMessage>
</div>
}
@if (this.azureContentModeratorEndpointConfiguration != null &&
this.azureContentModeratorKeyConfiguration != null)
@if (this.googleGeminiKeyConfiguration != null)
{
<div>
<h3>Azure Content Moderator Configuration</h3>
</div>
<div>
<FluentLabel Typo="Typography.Body">@azureContentModeratorEndpointConfiguration.Name</FluentLabel>
<FluentTextField style="width:100%;" @bind-Value="this.azureContentModeratorEndpointConfiguration.Value"></FluentTextField>
<FluentValidationMessage For="@( () => azureContentModeratorEndpointConfiguration.Value)"></FluentValidationMessage>
<h3>Google Gemini Configuration</h3>
</div>
<div>
<FluentLabel Typo="Typography.Body">@azureContentModeratorKeyConfiguration.Name</FluentLabel>
<FluentTextField style="width:100%;" @bind-Value="this.azureContentModeratorKeyConfiguration.Value"></FluentTextField>
<FluentValidationMessage For="@( () => azureContentModeratorKeyConfiguration.Value)"></FluentValidationMessage>
<FluentLabel Typo="Typography.Body">@googleGeminiKeyConfiguration.Name</FluentLabel>
<FluentTextField style="width:100%;" @bind-Value="this.googleGeminiKeyConfiguration.Value"></FluentTextField>
<FluentValidationMessage For="@( () => googleGeminiKeyConfiguration.Value)"></FluentValidationMessage>
</div>
}
@if (this.googleGeminiKeyConfiguration != null)
@if (this.azureContentSafetyKeyConfiguration != null
&& this.azureContentSafetyEndpointConfiguration != null)
{
<div>
<h3>Google Gemini Configuration</h3>
<FluentLabel Typo="Typography.H3">
<FluentAnchor Href="https://learn.microsoft.com/en-us/azure/ai-services/content-safety/" Target="_blank">
<FluentIcon Value="@(new Icons.Regular.Size16.Globe())"
Color="Color.Accent" Slot="start"></FluentIcon>
Azure Content Safety Configuration
</FluentAnchor>
</FluentLabel>
</div>
<div>
<FluentLabel Typo="Typography.Body">@googleGeminiKeyConfiguration.Name</FluentLabel>
<FluentTextField style="width:100%;" @bind-Value="this.googleGeminiKeyConfiguration.Value"></FluentTextField>
<FluentValidationMessage For="@( () => googleGeminiKeyConfiguration.Value)"></FluentValidationMessage>
<FluentLabel Typo="Typography.Body">@azureContentSafetyEndpointConfiguration.Name</FluentLabel>
<FluentTextField style="width:100%;" TextFieldType="TextFieldType.Url" InputMode="InputMode.Url" @bind-Value="this.azureContentSafetyEndpointConfiguration.Value"></FluentTextField>
<FluentValidationMessage For="@( () => azureContentSafetyEndpointConfiguration.Value)"></FluentValidationMessage>
</div>
<div>
<FluentLabel Typo="Typography.Body">@azureContentSafetyKeyConfiguration.Name</FluentLabel>
<FluentTextField style="width:100%;" TextFieldType="TextFieldType.Text" InputMode="InputMode.Text" @bind-Value="this.azureContentSafetyKeyConfiguration.Value"></FluentTextField>
<FluentValidationMessage For="@( () => azureContentSafetyKeyConfiguration.Value)"></FluentValidationMessage>
</div>
}
<div>
Expand Down Expand Up @@ -227,15 +232,16 @@
private ConfigurationSecretModel? azureVideoIndexerSubscriptionIdConfiguration => allConfigurationSecrets?
.SingleOrDefault(p => p.Name == FairPlayCombined.Common.Constants.ConfigurationSecretsKeys.AZURE_VIDEOINDEXER_SUBSCRIPTION_ID_KEY);

private ConfigurationSecretModel? azureContentModeratorEndpointConfiguration => allConfigurationSecrets?
.SingleOrDefault(p => p.Name == FairPlayCombined.Common.Constants.ConfigurationSecretsKeys.AZURE_CONTENT_MODERATOR_ENDPOINT_KEY);

private ConfigurationSecretModel? azureContentModeratorKeyConfiguration => allConfigurationSecrets?
.SingleOrDefault(p => p.Name == FairPlayCombined.Common.Constants.ConfigurationSecretsKeys.AZURE_CONTENT_MODERATOR_KEY_KEY);

private ConfigurationSecretModel? googleGeminiKeyConfiguration => allConfigurationSecrets?
.SingleOrDefault(p => p.Name == FairPlayCombined.Common.Constants.ConfigurationSecretsKeys.GOOGLE_GEMINI_KEY_KEY);

private ConfigurationSecretModel? azureContentSafetyEndpointConfiguration => allConfigurationSecrets?
.SingleOrDefault(p => p.Name == FairPlayCombined.Common.Constants.ConfigurationSecretsKeys.AZURE_CONTENT_SAFETY_ENDPOINT_KEY);

private ConfigurationSecretModel? azureContentSafetyKeyConfiguration => allConfigurationSecrets?
.SingleOrDefault(p => p.Name == FairPlayCombined.Common.Constants.ConfigurationSecretsKeys.AZURE_CONTENT_SAFETY_KEY_KEY);


private ExternalServicesHealthModel[]? externalServicesHealthModels;
private readonly CancellationTokenSource cancellationTokenSource = new();
private bool IsBusy { get; set; }
Expand Down Expand Up @@ -323,25 +329,25 @@
Name = Constants.ConfigurationSecretsKeys.AZURE_VIDEOINDEXER_SUBSCRIPTION_ID_KEY
});
}
if (this.azureContentModeratorEndpointConfiguration is null)
if (this.googleGeminiKeyConfiguration is null)
{
this.allConfigurationSecrets!.Add(new ConfigurationSecretModel()
{
Name = Constants.ConfigurationSecretsKeys.AZURE_CONTENT_MODERATOR_ENDPOINT_KEY
Name = Constants.ConfigurationSecretsKeys.GOOGLE_GEMINI_KEY_KEY
});
}
if (this.azureContentModeratorKeyConfiguration is null)
if (this.azureContentSafetyEndpointConfiguration is null)
{
this.allConfigurationSecrets!.Add(new ConfigurationSecretModel()
{
Name = Constants.ConfigurationSecretsKeys.AZURE_CONTENT_MODERATOR_KEY_KEY
Name = Constants.ConfigurationSecretsKeys.AZURE_CONTENT_SAFETY_ENDPOINT_KEY
});
}
if (this.googleGeminiKeyConfiguration is null)
if (this.azureContentSafetyKeyConfiguration is null)
{
this.allConfigurationSecrets!.Add(new ConfigurationSecretModel()
{
Name = Constants.ConfigurationSecretsKeys.GOOGLE_GEMINI_KEY_KEY
Name = Constants.ConfigurationSecretsKeys.AZURE_CONTENT_SAFETY_KEY_KEY
});
}
StateHasChanged();
Expand All @@ -354,11 +360,7 @@
ExternalServicesConfigurationModel externalServicesConfigurationModel = new()
{
AzureOpenDeploymentName = this.azureOpenAIDeploymentNameConfiguration!.Value,
OpenAIClient = new Azure.AI.OpenAI.OpenAIClient(openAIApiKey: this.azureOpenAIKeyConfiguration!.Value),
ContentModeratorClient = new(new ApiKeyServiceClientCredentials(this.azureContentModeratorKeyConfiguration!.Value))
{
Endpoint = this.azureContentModeratorEndpointConfiguration!.Value
}
OpenAIClient = new Azure.AI.OpenAI.OpenAIClient(openAIApiKey: this.azureOpenAIKeyConfiguration!.Value)
};
ExternalServicesHealthService externalServicesHealthService = new ExternalServicesHealthService(externalServicesConfigurationModel);
this.externalServicesHealthModels = await externalServicesHealthService.CheckServicesHealthAsync(this.cancellationTokenSource.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@
<None Remove="Resources\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-preview.1.23557.2" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.5.1-preview.24080.3" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.5.0" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.5.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982">
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.4.24218.6" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.7.1" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.6.0" />
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.7.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.24.0.89429">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0-preview.4.24219.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0-preview.4.24219.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.4.24217.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.4.24217.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.2.24128.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FairPlayCombined.Common\FairPlayCombined.Common.csproj" />
Expand Down
15 changes: 7 additions & 8 deletions src/FairPlayCombinedSln/FairPlayAdminPortal/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,23 @@
.AddDefaultTokenProviders();

builder.Services.AddTransient<IUserProviderService, UserProviderService>();
builder.Services.AddTransient<DbContextOptions<FairPlayCombinedDbContext>>(sp =>

builder.Services.AddDbContext<FairPlayCombinedDbContext>((sp, builder) =>
{
IUserProviderService userProviderService = sp.GetRequiredService<IUserProviderService>();
DbContextOptionsBuilder<FairPlayCombinedDbContext> optionsBuilder = new();
optionsBuilder.AddInterceptors(new SaveChangesInterceptor(userProviderService));
optionsBuilder.UseSqlServer(connectionString,
builder.AddInterceptors(new SaveChangesInterceptor(userProviderService));
builder.UseSqlServer(connectionString,
sqlServerOptionsAction =>
{
sqlServerOptionsAction.UseNetTopologySuite();
sqlServerOptionsAction.EnableRetryOnFailure(maxRetryCount: 3,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null);
});
return optionsBuilder.Options;
});
builder.AddSqlServerDbContext<FairPlayCombinedDbContext>(connectionName: "FairPlayCombinedDb");
builder.Services.AddDbContextFactory<FairPlayCombinedDbContext>();
}, contextLifetime: ServiceLifetime.Transient, optionsLifetime: ServiceLifetime.Transient);

builder.Services.AddDbContextFactory<FairPlayCombinedDbContext>();
builder.EnrichSqlServerDbContext<FairPlayCombinedDbContext>();
builder.Services.AddMemoryCache();
builder.Services.AddTransient<UserManager<ApplicationUser>, CustomUserManager>();
builder.Services.AddSingleton<IEmailSender<ApplicationUser>, IdentityNoOpEmailSender>();
Expand Down
17 changes: 10 additions & 7 deletions src/FairPlayCombinedSln/FairPlayBudget/FairPlayBudget.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
<Configurations>Debug;Release;Debug_Enable_Paid_Tests</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-preview.1.23557.2" />
<PackageReference Include="Blazored.Toast" Version="4.1.0" />
<PackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.4.24218.6" />
<PackageReference Include="Blazored.Toast" Version="4.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.DataAnnotations.Validation" Version="3.2.0-rc1.20223.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.2.24128.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid" Version="9.0.0-preview.4.24219.8" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0-preview.4.24219.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0-preview.4.24219.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.4.24217.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.4.24217.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FairPlayCombined.Common\FairPlayCombined.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.AI.ContentSafety" Version="1.0.0" />
<PackageReference Include="Azure.AI.OpenAI" Version="1.0.0-beta.15" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.ContentModerator" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-preview-24080-01" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.0-preview.24164.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.0-preview.24164.4" />
<PackageReference Include="Microsoft.Playwright.MSTest" Version="1.42.0" />
<PackageReference Include="Azure.AI.OpenAI" Version="1.0.0-beta.16" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-release-24177-07" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="Microsoft.Playwright.MSTest" Version="1.43.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Testcontainers.MsSql" Version="3.8.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0-preview.2.24128.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0-preview.4.24219.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FairPlayCombined.Services.AI\FairPlayCombined.Services.AI.csproj" />
Expand Down

This file was deleted.

Loading