Skip to content

A programming framework for agentic AI

add workflows app

Ryan Sweet11a200a0d576
diff --git a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs b/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs
index bb5a11fff..b31429658 100644
--- a/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs
+++ b/Elsa.SemanticKernel/Activities/SemanticKernelSkillRequest.cs
@@ -110,7 +110,7 @@ public class SemanticKernelSkill : CodeActivity<string>
var context = new ContextVariables();
context.Set("input", prompt);
- context.Set("wafContext", wafContext);
+ //context.Set("wafContext", wafContext);
var answer = await kernel.RunAsync(context, function).ConfigureAwait(false);
var result = typeof(T) != typeof(string) ? JsonSerializer.Deserialize<T>(answer.ToString()) : (T)(object)answer.ToString();
diff --git a/WorkflowsApp/NuGet.Config b/WorkflowsApp/NuGet.Config
new file mode 100644
index 000000000..a89a1e8b5
--- /dev/null
+++ b/WorkflowsApp/NuGet.Config
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <packageSources>
+ <clear/>
+
+ <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
+ <add key="Jint prereleases" value="https://www.myget.org/F/jint/api/v3/index.json" />
+ <add key="Elsa prereleases" value="https://f.feedz.io/elsa-workflows/elsa-3/nuget/index.json" />
+ </packageSources>
+</configuration>
\ No newline at end of file
diff --git a/WorkflowsApp/Pages/Index.cshtml b/WorkflowsApp/Pages/Index.cshtml
new file mode 100644
index 000000000..b889d560a
--- /dev/null
+++ b/WorkflowsApp/Pages/Index.cshtml
@@ -0,0 +1,22 @@
+@page "/"
+@{
+ var serverUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}{Request.Path}";
+ var apiUrl = serverUrl + "elsa/api";
+}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+ <title>Elsa Workflows 3.0</title>
+ <link rel="stylesheet" href="https://rsms.me/inter/inter.css">
+ <link rel="stylesheet" href="_content/Elsa.Workflows.Designer/elsa-workflows-designer/elsa-workflows-designer.css">
+ <script src="_content/Elsa.Workflows.Designer/monaco-editor/min/vs/loader.js"></script>
+ <script type="module" src="_content/Elsa.Workflows.Designer/elsa-workflows-designer/elsa-workflows-designer.esm.js"></script>
+</head>
+<body>
+
+<elsa-studio server="@apiUrl" monaco-lib-path="/_content/Elsa.Workflows.Designer/monaco-editor/min"></elsa-studio>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/WorkflowsApp/Pages/_ViewImports.cshtml b/WorkflowsApp/Pages/_ViewImports.cshtml
new file mode 100644
index 000000000..251d63908
--- /dev/null
+++ b/WorkflowsApp/Pages/_ViewImports.cshtml
@@ -0,0 +1,2 @@
+@namespace WorkflowsApp.Pages
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
\ No newline at end of file
diff --git a/WorkflowsApp/Program.cs b/WorkflowsApp/Program.cs
new file mode 100644
index 000000000..221c2ff10
--- /dev/null
+++ b/WorkflowsApp/Program.cs
@@ -0,0 +1,49 @@
+using Elsa.EntityFrameworkCore.Extensions;
+using Elsa.EntityFrameworkCore.Modules.Management;
+using Elsa.Extensions;
+using Elsa.Identity.Features;
+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()));
+
+ // 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 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();
diff --git a/WorkflowsApp/Properties/launchSettings.json b/WorkflowsApp/Properties/launchSettings.json
new file mode 100644
index 000000000..aacf9bea6
--- /dev/null
+++ b/WorkflowsApp/Properties/launchSettings.json
@@ -0,0 +1,37 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:10492",
+ "sslPort": 44312
+ }
+ },
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:5181",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7077;http://localhost:5181",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/WorkflowsApp/WorkflowsApp.csproj b/WorkflowsApp/WorkflowsApp.csproj
new file mode 100644
index 000000000..ad83cc625
--- /dev/null
+++ b/WorkflowsApp/WorkflowsApp.csproj
@@ -0,0 +1,23 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+ <PropertyGroup>
+ <TargetFramework>net7.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ <ImplicitUsings>enable</ImplicitUsings>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Elsa" Version="3.0.0-rc1" />
+ <PackageReference Include="Elsa.EntityFrameworkCore" Version="3.0.0-rc1" />
+ <PackageReference Include="Elsa.EntityFrameworkCore.Sqlite" Version="3.0.0-rc1" />
+ <PackageReference Include="Elsa.Http" Version="3.0.0-rc1" />
+ <PackageReference Include="Elsa.Identity" Version="3.0.0-rc1" />
+ <PackageReference Include="Elsa.Workflows.Api" Version="3.0.0-rc1" />
+ <PackageReference Include="Elsa.Workflows.Designer" Version="3.0.0-rc1" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Elsa.SemanticKernel\Elsa.SemanticKernel.csproj" />
+ </ItemGroup>
+
+</Project>
diff --git a/WorkflowsApp/appsettings.Development.json b/WorkflowsApp/appsettings.Development.json
new file mode 100644
index 000000000..ff66ba6b2
--- /dev/null
+++ b/WorkflowsApp/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/WorkflowsApp/elsa.sqlite.db b/WorkflowsApp/elsa.sqlite.db
new file mode 100644
index 000000000..4eec189fb
Binary files /dev/null and b/WorkflowsApp/elsa.sqlite.db differ