-
Notifications
You must be signed in to change notification settings - Fork 705
/
Program.cs
49 lines (36 loc) · 1.47 KB
/
Program.cs
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
// Copyright (c) Microsoft. All rights reserved.
using CopilotChat.Shared;
using Microsoft.KernelMemory;
using Microsoft.KernelMemory.Diagnostics;
// ********************************************************
// ************** SETUP ***********************************
// ********************************************************
var builder = WebApplication.CreateBuilder();
IKernelMemory memory =
new KernelMemoryBuilder(builder.Services)
.FromAppSettings()
.Build();
builder.Services.AddSingleton(memory);
builder.Services.AddApplicationInsightsTelemetry();
var app = builder.Build();
DateTimeOffset start = DateTimeOffset.UtcNow;
// Simple ping endpoint
app.MapGet("/", () =>
{
var uptime = DateTimeOffset.UtcNow.ToUnixTimeSeconds() - start.ToUnixTimeSeconds();
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
var message = $"Memory pipeline is running. Uptime: {uptime} secs.";
if (!string.IsNullOrEmpty(environment))
{
message += $" Environment: {environment}";
}
return Results.Ok(message);
});
// ********************************************************
// ************** START ***********************************
// ********************************************************
app.Logger.LogInformation(
"Starting Chat Copilot Memory pipeline service, .NET Env: {0}, Log Level: {1}",
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"),
app.Logger.GetLogLevelName());
app.Run();