-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProgram.cs
More file actions
20 lines (15 loc) · 814 Bytes
/
Program.cs
File metadata and controls
20 lines (15 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var builder = DistributedApplication.CreateBuilder(args);
var useAzureOpenAI = bool.Parse(Environment.GetEnvironmentVariable("UseAzureOpenAI") ?? "true");
var azureDeployment = Environment.GetEnvironmentVariable("AzureDeployment") ?? "chat";
var openAi = builder.AddAzureOpenAI("openAi")
.AddDeployment(new AzureOpenAIDeployment(azureDeployment, "gpt-4o", "2024-05-13"));
var backend = builder.AddProject<Projects.ChatApp_WebApi>("backend")
.WithReference(openAi)
.WithEnvironment("AI:UseAzureOpenAI", useAzureOpenAI.ToString())
.WithEnvironment("AI:Deployment", azureDeployment);
var frontend = builder.AddNpmApp("frontend", "../ChatApp.React")
.WithReference(backend)
.WithHttpEndpoint(env: "PORT")
.WithExternalHttpEndpoints()
.PublishAsDockerFile();
builder.Build().Run();