| | | 1 | | using CShells.Features; |
| | | 2 | | using Elsa.AI.Copilot.Options; |
| | | 3 | | using Elsa.Extensions; |
| | | 4 | | using JetBrains.Annotations; |
| | | 5 | | using Microsoft.Extensions.DependencyInjection; |
| | | 6 | | |
| | | 7 | | namespace Elsa.AI.Copilot.ShellFeatures; |
| | | 8 | | |
| | | 9 | | [ShellFeature( |
| | | 10 | | "CopilotAI", |
| | | 11 | | DisplayName = "Copilot AI Provider", |
| | | 12 | | Description = "Registers the Copilot adapter for Weaver AI")] |
| | | 13 | | [UsedImplicitly] |
| | | 14 | | public class CopilotAIFeature : IShellFeature |
| | | 15 | | { |
| | 0 | 16 | | private static readonly CopilotOptions DefaultOptions = new(); |
| | | 17 | | |
| | 0 | 18 | | public string CliPath { get; set; } = DefaultOptions.CliPath; |
| | 0 | 19 | | public string? Model { get; set; } = DefaultOptions.Model; |
| | 0 | 20 | | public string? ProviderName { get; set; } = DefaultOptions.ProviderName; |
| | | 21 | | |
| | | 22 | | public void ConfigureServices(IServiceCollection services) |
| | | 23 | | { |
| | 0 | 24 | | services.AddCopilotAIProvider(ConfigureOptions); |
| | 0 | 25 | | } |
| | | 26 | | |
| | | 27 | | private void ConfigureOptions(CopilotOptions options) |
| | | 28 | | { |
| | 0 | 29 | | options.CliPath = CliPath; |
| | 0 | 30 | | options.Model = Model; |
| | 0 | 31 | | options.ProviderName = ProviderName; |
| | 0 | 32 | | } |
| | | 33 | | } |