-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathapphost.cs
More file actions
52 lines (42 loc) · 2.48 KB
/
Copy pathapphost.cs
File metadata and controls
52 lines (42 loc) · 2.48 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
#:sdk Aspire.AppHost.Sdk@13.4.6
#:package Aspire.Hosting.Azure.CosmosDB
#:project ./src/InterviewCoach.Agent/InterviewCoach.Agent.csproj
#:project ./src/InterviewCoach.AppHost.Core/InterviewCoach.AppHost.Core.csproj
#:project ./src/InterviewCoach.Mcp.InterviewData/InterviewCoach.Mcp.InterviewData.csproj
#:project ./src/InterviewCoach.WebUI/InterviewCoach.WebUI.csproj
using Microsoft.Extensions.Configuration;
var builder = DistributedApplication.CreateBuilder(args);
var config = builder.Configuration
.AddJsonFile("apphost.settings.json", optional: true, reloadOnChange: true)
.AddUserSecrets(typeof(Program).Assembly, optional: true, reloadOnChange: true)
.Build();
var mcpMarkItDown = builder.AddContainer(ResourceConstants.McpMarkItDown, "mcp/markitdown", "latest")
.WithHttpEndpoint(targetPort: 3001)
.WithArgs("--http", "--host", "0.0.0.0", "--port", "3001");
// Azure Cosmos DB (NoSQL). Uses the local emulator in run mode and provisions a managed
// account when published. Aspire creates the database and container as resources, so no
// runtime resource creation is required (see the EnsureCreatedAsync note in the MCP server).
var cosmos = builder.AddAzureCosmosDB(ResourceConstants.Cosmos);
#pragma warning disable ASPIRECOSMOSDB001
if (builder.ExecutionContext.IsRunMode)
{
cosmos.RunAsPreviewEmulator(emulator => emulator.WithDataExplorer());
}
#pragma warning restore ASPIRECOSMOSDB001
var cosmosDb = cosmos.AddCosmosDatabase(ResourceConstants.CosmosDatabase);
cosmosDb.AddContainer(ResourceConstants.CosmosContainer, "/id");
var mcpInterviewData = builder.AddProject<Projects.InterviewCoach_Mcp_InterviewData>(ResourceConstants.McpInterviewData)
.WithReference(cosmosDb)
.WaitFor(cosmosDb);
var agent = builder.AddProject<Projects.InterviewCoach_Agent>(ResourceConstants.Agent)
.WithExternalHttpEndpoints()
.WithLlmReference(config, args)
.WithReference(mcpMarkItDown.GetEndpoint("http"))
.WithReference(mcpInterviewData)
.WaitFor(mcpMarkItDown)
.WaitFor(mcpInterviewData);
var webUI = builder.AddProject<Projects.InterviewCoach_WebUI>(ResourceConstants.WebUI)
.WithExternalHttpEndpoints()
.WithReference(agent)
.WaitFor(agent);
await builder.Build().RunAsync();