mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
Merge project-oagents into agnext
This commit is contained in:
54
dotnet/samples/WorkflowsApp/Program.cs
Normal file
54
dotnet/samples/WorkflowsApp/Program.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Elsa.EntityFrameworkCore.Extensions;
|
||||
using Elsa.EntityFrameworkCore.Modules.Management;
|
||||
using Elsa.EntityFrameworkCore.Modules.Runtime;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.SemanticKernel;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddElsa(elsa =>
|
||||
{
|
||||
// Configure management feature to use EF Core.
|
||||
elsa.UseWorkflowManagement(management => management.UseEntityFrameworkCore(ef => ef.UseSqlite()));
|
||||
|
||||
elsa.UseWorkflowRuntime(runtime =>runtime.UseEntityFrameworkCore());
|
||||
|
||||
// Expose API endpoints.
|
||||
elsa.UseWorkflowsApi();
|
||||
|
||||
// Add services for HTTP activities and workflow middleware.
|
||||
elsa.UseHttp();
|
||||
|
||||
// Configure identity so that we can create a default admin user.
|
||||
elsa.UseIdentity(identity =>
|
||||
{
|
||||
identity.UseAdminUserProvider();
|
||||
identity.TokenOptions = options => options.SigningKey = "secret-token-signing-key";
|
||||
});
|
||||
|
||||
// Use default authentication (JWT + API Key).
|
||||
elsa.UseDefaultAuthentication(auth => auth.UseAdminApiKey());
|
||||
|
||||
// Add Semantic Kernel skill.
|
||||
elsa.AddActivity<SemanticKernelSkill>();
|
||||
|
||||
});
|
||||
|
||||
// Add dynamic Activity Provider for SK skills.
|
||||
builder.Services.AddActivityProvider<SemanticKernelActivityProvider>();
|
||||
|
||||
// Add Razor pages.
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseWorkflowsApi();
|
||||
app.UseWorkflows();
|
||||
app.MapRazorPages();
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user