IModerationService

This commit is contained in:
Paul Schneider 2026-05-30 18:20:17 +01:00
commit 1aafb7cc7d
10 changed files with 162 additions and 10 deletions

View file

@ -1,5 +1,7 @@
using Anthropic.SDK;
using Microsoft.AspNetCore;
using Yavsc.Abstract.Interfaces;
using Yavsc.Extensions;
namespace Yavsc
@ -9,12 +11,29 @@ namespace Yavsc
public static async Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Anthropic client
builder.Services.AddSingleton<AnthropicClient>(_ =>
new AnthropicClient(
new APIAuthentication(
builder.Configuration["ANTHROPIC_API_KEY"]
?? throw new InvalidOperationException("ANTHROPIC_API_KEY manquante")
)
)
);
// Service de modération
if (builder.Environment.IsDevelopment())
builder.Services.AddScoped<IModerationService, MockModerationService>();
else
builder.Services.AddScoped<IModerationService, ClaudeModerationService>();
builder.Configuration
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables()
.Build();
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables()
.Build();
var app = await builder.ConfigureWebAppServices().ConfigurePipeline();
app.Run();
}

View file

@ -77,5 +77,9 @@
},
"Kyc": {
"HmacSecret": "*** via dotnet user-secrets ou variable d'environnement ***"
},
"Moderation": {
"AutoApproveThreshold": 0.7,
"AutoRejectThreshold": 0.9
}
}