mirror of
https://github.com/microsoft/autogen.git
synced 2025-08-23 08:02:05 +00:00

* 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>
32 lines
951 B
C#
32 lines
951 B
C#
namespace HelloAgents.Web;
|
|
|
|
public class AgentAPIClient(HttpClient httpClient)
|
|
{
|
|
public async Task<AgentOutputRecord[]> GetAgentResultAsync(int maxItems = 10, CancellationToken cancellationToken = default)
|
|
{
|
|
List<AgentOutputRecord>? forecasts = null;
|
|
|
|
await foreach (var forecast in httpClient.GetFromJsonAsAsyncEnumerable<AgentOutputRecord>("/agents", cancellationToken))
|
|
{
|
|
if (forecasts?.Count >= maxItems)
|
|
{
|
|
break;
|
|
}
|
|
if (forecast is not null)
|
|
{
|
|
forecasts ??= [];
|
|
forecasts.Add(forecast);
|
|
}
|
|
}
|
|
|
|
return forecasts?.ToArray() ?? [];
|
|
}
|
|
}
|
|
|
|
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";
|
|
}
|