-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
58 lines (45 loc) · 2.1 KB
/
Program.cs
File metadata and controls
58 lines (45 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.ClientModel;
using Azure.AI.OpenAI;
using Microsoft.Extensions.AI;
using RequirementsLab.Components;
using RequirementsLab.Services;
var builder = WebApplication.CreateBuilder(args);
// Load configuration
builder.Configuration.AddJsonFile("appsettings.json", optional: false);
// Register Azure OpenAI ChatClient
var endpoint = builder.Configuration["AzureOpenAI:Endpoint"] ?? throw new InvalidOperationException("Missing AzureOpenAI:Endpoint");
var apiKey = builder.Configuration["AzureOpenAI:ApiKey"] ?? throw new InvalidOperationException("Missing AzureOpenAI:ApiKey");
var deploymentName = builder.Configuration["AzureOpenAI:DeploymentName"] ?? "gpt-4o";
var azureClient = new AzureOpenAIClient(new Uri(endpoint), new ApiKeyCredential(apiKey));
IChatClient chatClient = azureClient.GetChatClient(deploymentName).AsIChatClient();
builder.Services.AddSingleton(chatClient);
// Register application services
builder.Services.AddScoped<SolutionGeneratorService>();
builder.Services.AddScoped<FeasibilityEvaluatorService>();
builder.Services.AddScoped<PocTemplateService>();
builder.Services.AddScoped<ImplementationPlanService>();
// Register Agents
builder.Services.AddScoped<RequirementsLab.Services.Agents.PMAgent>();
builder.Services.AddScoped<RequirementsLab.Services.Agents.SAAgent>();
builder.Services.AddScoped<RequirementsLab.Services.Agents.PGAgent>();
builder.Services.AddTransient<RequirementsLab.Services.Agents.Infrastructure.GroupChatManager>();
builder.Services.AddScoped<RequirementsLab.Services.FileExtractionService>();
builder.Services.AddScoped<RequirementsLab.Services.QuestionnaireService>();
// Add Blazor services
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddControllers();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseAntiforgery();
app.MapStaticAssets();
app.MapControllers();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();