elsa-core/src/modules/Elsa.Agents.Core/Services/ConfigurationKernelConfigProvider.cs
Sipke Schoorstra 223536c90a Remove unused using statements and configure agents.
Removed several unused `using` statements within multiple files to clean up the codebase. Additionally, enhanced the configuration for the `Agent` module in `appsettings.json` and enabled agent-related features in `Program.cs`.
2024-09-01 14:24:43 +02:00

17 lines
711 B
C#

using JetBrains.Annotations;
using Microsoft.Extensions.Options;
namespace Elsa.Agents;
[UsedImplicitly]
public class ConfigurationKernelConfigProvider(IOptions<AgentsOptions> options) : IKernelConfigProvider
{
public Task<KernelConfig> GetKernelConfigAsync(CancellationToken cancellationToken = default)
{
var kernelConfig = new KernelConfig();
foreach (var apiKey in options.Value.ApiKeys) kernelConfig.ApiKeys[apiKey.Name] = apiKey;
foreach (var service in options.Value.Services) kernelConfig.Services[service.Name] = service;
foreach (var agent in options.Value.Agents) kernelConfig.Agents[agent.Name] = agent;
return Task.FromResult(kernelConfig);
}
}