Remove agent-related configurations and dependencies.
This commit removes the "Agents" configuration section, related API keys, services, and persistence logic across the codebase. Unused agent-related NuGet packages and code references were also eliminated to simplify the project and focus on core functionality.
This commit is contained in:
parent
74a1c50f66
commit
13d7e91e0d
|
|
@ -64,7 +64,6 @@
|
|||
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||
<PackageVersion Include="Microsoft.Identity.Client" Version="4.67.2" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.34.0" />
|
||||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
|
||||
<PackageVersion Include="MongoDB.Driver" Version="3.1.0" />
|
||||
<PackageVersion Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.0.0" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Text.Encodings.Web;
|
||||
using Elsa.Agents;
|
||||
using Elsa.Alterations.Extensions;
|
||||
using Elsa.Alterations.MassTransit.Extensions;
|
||||
using Elsa.Caching.Options;
|
||||
|
|
@ -94,7 +93,6 @@ const DistributedCachingTransport distributedCachingTransport = DistributedCachi
|
|||
const MassTransitBroker massTransitBroker = MassTransitBroker.Memory;
|
||||
const bool useMultitenancy = false;
|
||||
const bool useTenantsFromConfiguration = true;
|
||||
const bool useAgents = false;
|
||||
const bool useSecrets = false;
|
||||
const bool disableVariableWrappers = false;
|
||||
const bool disableVariableCopying = false;
|
||||
|
|
@ -213,7 +211,8 @@ services
|
|||
else if (sqlDatabaseProvider == SqlDatabaseProvider.CockroachDb)
|
||||
ef.UsePostgreSql(cockroachDbConnectionString!);
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.Oracle)
|
||||
ef.UseOracle(oracleConnectionString, new ElsaDbContextOptions{ SchemaName = "ELSA"});
|
||||
ef.UseOracle(oracleConnectionString, new()
|
||||
{ SchemaName = "ELSA"});
|
||||
else
|
||||
ef.UseSqlite(sp => sp.GetSqliteConnectionString());
|
||||
|
||||
|
|
@ -256,7 +255,8 @@ services
|
|||
else if (sqlDatabaseProvider == SqlDatabaseProvider.CockroachDb)
|
||||
ef.UsePostgreSql(cockroachDbConnectionString!);
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.Oracle)
|
||||
ef.UseOracle(oracleConnectionString, new ElsaDbContextOptions{ SchemaName = "ELSA"});
|
||||
ef.UseOracle(oracleConnectionString, new()
|
||||
{ SchemaName = "ELSA"});
|
||||
else
|
||||
ef.UseSqlite(sp => sp.GetSqliteConnectionString());
|
||||
|
||||
|
|
@ -304,7 +304,8 @@ services
|
|||
else if (sqlDatabaseProvider == SqlDatabaseProvider.CockroachDb)
|
||||
ef.UsePostgreSql(cockroachDbConnectionString);
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.Oracle)
|
||||
ef.UseOracle(oracleConnectionString, new ElsaDbContextOptions{ SchemaName = "ELSA"});
|
||||
ef.UseOracle(oracleConnectionString, new()
|
||||
{ SchemaName = "ELSA"});
|
||||
else
|
||||
ef.UseSqlite(sp => sp.GetSqliteConnectionString());
|
||||
|
||||
|
|
@ -354,7 +355,7 @@ services
|
|||
return new RedisDistributedSynchronizationProvider(database);
|
||||
}
|
||||
case "File":
|
||||
return new FileDistributedSynchronizationProvider(new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "locks")));
|
||||
return new FileDistributedSynchronizationProvider(new(Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "locks")));
|
||||
case "Noop":
|
||||
default:
|
||||
return new NoopDistributedSynchronizationProvider();
|
||||
|
|
@ -451,7 +452,8 @@ services
|
|||
else if (sqlDatabaseProvider == SqlDatabaseProvider.CockroachDb)
|
||||
ef.UsePostgreSql(cockroachDbConnectionString);
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.Oracle)
|
||||
ef.UseOracle(oracleConnectionString, new ElsaDbContextOptions{ SchemaName = "ELSA"});
|
||||
ef.UseOracle(oracleConnectionString, new()
|
||||
{ SchemaName = "ELSA"});
|
||||
else
|
||||
ef.UseSqlite(sp => sp.GetSqliteConnectionString());
|
||||
|
||||
|
|
@ -536,7 +538,7 @@ services
|
|||
{
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.SqlServer)
|
||||
return new SqlServerProvider(sqlServerConnectionString!, true, "", "proto_actor");
|
||||
return new SqliteProvider(new SqliteConnectionStringBuilder(sqliteConnectionString));
|
||||
return new SqliteProvider(new(sqliteConnectionString));
|
||||
};
|
||||
|
||||
if (configuration["KUBERNETES_SERVICE_HOST"] != null)
|
||||
|
|
@ -562,18 +564,7 @@ services
|
|||
kafka.ConfigureOptions(options => configuration.GetSection("Kafka").Bind(options));
|
||||
});
|
||||
}
|
||||
|
||||
if (useAgents)
|
||||
{
|
||||
elsa
|
||||
.UseAgentActivities()
|
||||
.UseAgentPersistence(persistence => persistence.UseEntityFrameworkCore(ef => ef.UseSqlite(sp => sp.GetSqliteConnectionString())))
|
||||
.UseAgentsApi()
|
||||
;
|
||||
|
||||
services.Configure<AgentsOptions>(options => builder.Configuration.GetSection("Agents").Bind(options));
|
||||
}
|
||||
|
||||
|
||||
if (useSecrets)
|
||||
{
|
||||
elsa
|
||||
|
|
@ -647,7 +638,8 @@ services
|
|||
if (sqlDatabaseProvider == SqlDatabaseProvider.Sqlite) ef.UseSqlite(sqliteConnectionString);
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.SqlServer) ef.UseSqlServer(sqlServerConnectionString);
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.PostgreSql) ef.UsePostgreSql(postgresConnectionString);
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.Oracle) ef.UseOracle(oracleConnectionString, new ElsaDbContextOptions{ SchemaName = "ELSA"});
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.Oracle) ef.UseOracle(oracleConnectionString, new()
|
||||
{ SchemaName = "ELSA"});
|
||||
#if !NET9_0
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.MySql)
|
||||
ef.UseMySql(mySqlConnectionString);
|
||||
|
|
|
|||
|
|
@ -254,82 +254,6 @@
|
|||
"SweepInterval": "04:00:00"
|
||||
}
|
||||
},
|
||||
"Agents": {
|
||||
"ApiKeys": [
|
||||
{
|
||||
"Name": "MyApiKey",
|
||||
"Value": "my-api-key"
|
||||
}
|
||||
],
|
||||
"Services": [
|
||||
{
|
||||
"Name": "ChatCompletion",
|
||||
"Type": "OpenAIChatCompletion",
|
||||
"Settings": {
|
||||
"ModelId": "gpt-4o",
|
||||
"ApiKeyRef": "MyApiKey"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "TextToImage",
|
||||
"Type": "OpenAITextToImage",
|
||||
"Settings": {
|
||||
"ModelId": "dall-e-3",
|
||||
"ApiKeyRef": "MyApiKey"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Agents": [
|
||||
{
|
||||
"Name": "Copywriter",
|
||||
"Description": "A persona that writes articles on any topic.",
|
||||
"Services": [
|
||||
"ChatCompletion"
|
||||
],
|
||||
"FunctionName": "WriteArticle",
|
||||
"PromptTemplate": "You are a writer of articles about any topic and any additional instructions given to you. The syntax of the article content will be markdown, and your response will be in JSON format containing a \"title\" field and a \"markdown\" field using the following JSON structure: { \"title\": \"The title of the Article\", \"markdown\": \"The article content in markdown syntax.\" }. This is the topic: {{$Topic}}. The article consists of around {{$ParagraphCount}} paragraphs. The article must be written in the language {{$Language}} using the following style: {{$WritingStyle}}. Additional instructions (if any): {{$AdditionalInstructions}}.",
|
||||
"InputVariables": [
|
||||
{
|
||||
"Name": "Topic",
|
||||
"Description": "The topic to write an article about.",
|
||||
"Type": "string"
|
||||
},
|
||||
{
|
||||
"Name": "ParagraphCount",
|
||||
"Description": "The number of paragraphs to write.",
|
||||
"Type": "int"
|
||||
},
|
||||
{
|
||||
"Name": "Language",
|
||||
"Description": "The language to write the text in.",
|
||||
"Type": "string"
|
||||
},
|
||||
{
|
||||
"Name": "WritingStyle",
|
||||
"Description": "The style to write the text in.",
|
||||
"Type": "string"
|
||||
},
|
||||
{
|
||||
"Name": "AdditionalInstructions",
|
||||
"Description": "Any additional instructions.",
|
||||
"Type": "string"
|
||||
}
|
||||
],
|
||||
"OutputVariable": {
|
||||
"Name": "Article",
|
||||
"Description": "The article consisting of a title and markdown text."
|
||||
},
|
||||
"ExecutionSettings": {
|
||||
"MaxTokens": null,
|
||||
"Temperature": 0.5,
|
||||
"TopP": 0.9,
|
||||
"PresencePenalty": 0.5,
|
||||
"FrequencyPenalty": 0.5,
|
||||
"ResponseFormat": "json_object"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Webhooks": {
|
||||
"Sinks": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ using Elsa.ServerAndStudio.Web.Enums;
|
|||
using Medallion.Threading.FileSystem;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Proto.Persistence.Sqlite;
|
||||
using WebhooksCore.Options;
|
||||
using Elsa.Connections.Middleware;
|
||||
using Proto.Persistence.Sqlite;
|
||||
|
||||
const bool useMassTransit = true;
|
||||
const bool useProtoActor = true;
|
||||
|
|
@ -140,21 +140,6 @@ services
|
|||
.UseEmail(email => email.ConfigureOptions = options => configuration.GetSection("Smtp").Bind(options))
|
||||
.UseWebhooks(webhooks => webhooks.ConfigureSinks = options => builder.Configuration.GetSection("Webhooks:Sinks").Bind(options))
|
||||
.UseWorkflowsApi()
|
||||
.UseAgentsApi()
|
||||
.UseAgentPersistence(persistence => persistence.UseEntityFrameworkCore(ef =>
|
||||
{
|
||||
if (sqlDatabaseProvider == SqlDatabaseProvider.SqlServer)
|
||||
ef.UseSqlServer(sqlServerConnectionString);
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.PostgreSql)
|
||||
ef.UsePostgreSql(postgreSqlConnectionString);
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.Sqlite)
|
||||
ef.UseSqlite(sqliteConnectionString);
|
||||
#if !NET9_0
|
||||
else if (sqlDatabaseProvider == SqlDatabaseProvider.MySql)
|
||||
ef.UseMySql(mySqlConnectionString);
|
||||
#endif
|
||||
}))
|
||||
.UseAgentActivities()
|
||||
.AddActivitiesFrom<Program>()
|
||||
.AddWorkflowsFrom<Program>();
|
||||
|
||||
|
|
@ -195,9 +180,9 @@ services
|
|||
});
|
||||
}
|
||||
|
||||
elsa.UseConnections(
|
||||
configure=> configure.AddConnectionsFrom<Program>());
|
||||
elsa.UseConnectionPersistence(ef=> ef.UseEntityFrameworkCore(f=>f.UseSqlite()));
|
||||
elsa.UseConnections(
|
||||
configure=> configure.AddConnectionsFrom<Program>());
|
||||
elsa.UseConnectionPersistence(ef=> ef.UseEntityFrameworkCore(f=>f.UseSqlite()));
|
||||
elsa.UseConnectionsApi();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System.Net.Http.Headers;
|
||||
using System.Reflection;
|
||||
using Elsa.Agents;
|
||||
using Elsa.Alterations.Extensions;
|
||||
using Elsa.Caching;
|
||||
using Elsa.EntityFrameworkCore.Extensions;
|
||||
|
|
@ -36,7 +34,7 @@ public class WorkflowServer(Infrastructure infrastructure, string url) : WebAppl
|
|||
public TClient CreateApiClient<TClient>()
|
||||
{
|
||||
var client = CreateClient();
|
||||
client.BaseAddress = new Uri(client.BaseAddress!, "/elsa/api");
|
||||
client.BaseAddress = new(client.BaseAddress!, "/elsa/api");
|
||||
client.Timeout = TimeSpan.FromMinutes(1);
|
||||
return RestService.For<TClient>(client, CreateRefitSettings(Services));
|
||||
}
|
||||
|
|
@ -44,7 +42,7 @@ public class WorkflowServer(Infrastructure infrastructure, string url) : WebAppl
|
|||
public HttpClient CreateHttpWorkflowClient()
|
||||
{
|
||||
var client = CreateClient();
|
||||
client.BaseAddress = new Uri(client.BaseAddress!, "/workflows/");
|
||||
client.BaseAddress = new(client.BaseAddress!, "/workflows/");
|
||||
client.Timeout = TimeSpan.FromMinutes(1);
|
||||
return client;
|
||||
}
|
||||
|
|
@ -114,8 +112,6 @@ public class WorkflowServer(Infrastructure infrastructure, string url) : WebAppl
|
|||
{
|
||||
http.UseCache();
|
||||
});
|
||||
elsa.UseAgents();
|
||||
elsa.UseAgentPersistence(feature => feature.UseEntityFrameworkCore(ef => ef.UsePostgreSql(typeof(AgentsPostgreSqlProvidersExtensions).Assembly, dbConnectionString)));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +133,6 @@ public class WorkflowServer(Infrastructure infrastructure, string url) : WebAppl
|
|||
|
||||
protected override void ConfigureClient(HttpClient client)
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("ApiKey", AdminApiKeyProvider.DefaultApiKey);
|
||||
client.DefaultRequestHeaders.Authorization = new("ApiKey", AdminApiKeyProvider.DefaultApiKey);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue