Ryan Sweet 1edf5cfe9c
working on scaffolding a new dotnet intro sample for #531 (#536)
* interim stash

* interim stash

* interim checkpoint

* broken stash

* whoops

* merge sln files

* fix a bunch of refactoring errors

* moving more to core vs samples

* interim

* fixup the devteam sample

* fix ci

* fixup soln file

* trying to fix ci

* trying to fix ci

* adding back

* still trying

* recreate

* next step

* adding it back

* trying to fix

* Rename Autogen -> AutoGen (#567)

* Add transparency faqs (#566)

* remove Autogen

* add AutoGen back

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

---------

Co-authored-by: Xiaoyun Zhang <xiaoyuz@microsoft.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2024-09-19 01:41:44 +00:00

44 lines
1.1 KiB
C#

var builder = WebApplication.CreateBuilder(args);
// Add service defaults & Aspire components.
builder.AddServiceDefaults();
// Add services to the container.
builder.Services.AddProblemDetails();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseExceptionHandler();
var summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/agents", () =>
{
// here is where we call an agent
var result = Enumerable.Range(1, 5).Select(index =>
new AgentOutputRecord
(
Date: DateTime.Now.AddDays(index),
Content: $"AgentResult {DateTime.Now.AddDays(index):d}",
Summary: summaries[DateTime.Now.AddDays(index).DayOfYear % summaries.Length]
))
.ToArray();
return result;
});
app.MapDefaultEndpoints();
app.Run();
public record AgentOutputRecord(DateTime Date, string Content, string? Summary)
{
public string DisplayDate => Date.ToString("d");
public string DisplayContent => Content;
public string DisplaySummary => Summary ?? "No summary";
}