mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
d10b44d6bb
* init * wip * wip wip wip * wip wip * open up API * enable for multiple agents * more wip * make frontend respond. * wip * not sure if proper setup * define type * cleanup * frontend streaming wip * use System.Net.ServerSentEvents * usings * reformat via ichatclient * merge main renaming + refactor * fix main merge + fix sample (a2a change) * fix sample * some rebase (not working yet) * make it at least build somehow * make non-stream work without internal types * Input without custom models * implement streaming * test frontend * enable alerts and fix * build fixes & rereview * Update dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI.Responses/Microsoft.Agents.AI.Hosting.OpenAI.Responses.csproj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI.Responses/Utils/ResponseItemJsonConverter.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix agent discovery * rename * rename project into Microsoft.Agents.AI.Hosting.OpenAI (no responses in name) * PR address comments x1 * address PR comments x2 * correctly instantiate OpenAIResponse * address PR comments x3 * reconfigure JSON serialization & handle AOT warnings * fix build * proper ref * check update differently * correct check * exclude dotnet format diagnostics for IL2026 and IL3050 * space :) * re-review * add comments * remove unnecessary using * always take last openai response item * set responseItem Id explicitly * add agent.name validation for uri * cleanup --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using AgentWebChat.Web;
|
|
using AgentWebChat.Web.Components;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add service defaults & Aspire client integrations.
|
|
builder.AddServiceDefaults();
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
builder.Services.AddOutputCache();
|
|
|
|
// This URL uses "https+http://" to indicate HTTPS is preferred over HTTP.
|
|
// Learn more about service discovery scheme resolution at https://aka.ms/dotnet/sdschemes.
|
|
Uri baseAddress = new("https+http://agenthost");
|
|
|
|
// for some reason does not resolve with `apiservice` url
|
|
Uri a2aAddress = new("http://localhost:5390/a2a");
|
|
|
|
builder.Services.AddHttpClient<AgentDiscoveryClient>(client => client.BaseAddress = baseAddress);
|
|
builder.Services.AddSingleton(sp => new A2AAgentClient(sp.GetRequiredService<ILogger<A2AAgentClient>>(), a2aAddress));
|
|
builder.Services.AddSingleton(sp => new OpenAIResponsesAgentClient("http://localhost:5390"));
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAntiforgery();
|
|
|
|
app.UseOutputCache();
|
|
|
|
app.MapStaticAssets();
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.MapDefaultEndpoints();
|
|
|
|
app.Run();
|