mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Improved the Web Based Harness
This commit is contained in:
parent
c3c57c058a
commit
ee6eb84bd8
19 changed files with 2799 additions and 2202 deletions
36
DebugTools/MccMcpWebPlayground/Api/MccPlaygroundEndpoints.cs
Normal file
36
DebugTools/MccMcpWebPlayground/Api/MccPlaygroundEndpoints.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using DebugTools.MccMcpWebPlayground.Contracts;
|
||||
using DebugTools.MccMcpWebPlayground.Harness;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace DebugTools.MccMcpWebPlayground.Api;
|
||||
|
||||
public static class MccPlaygroundEndpoints
|
||||
{
|
||||
public static IEndpointRouteBuilder MapMccPlaygroundEndpoints(this IEndpointRouteBuilder endpoints)
|
||||
{
|
||||
RouteGroupBuilder api = endpoints.MapGroup("/api");
|
||||
|
||||
api.MapGet("/health", () => Results.Ok(new { ok = true }));
|
||||
|
||||
api.MapGet("/config", (IOptions<MccWebHarnessOptions> options) =>
|
||||
{
|
||||
MccWebHarnessOptions harnessOptions = options.Value;
|
||||
return Results.Ok(new MccConfigResponse(
|
||||
Model: harnessOptions.ResolveModel(),
|
||||
OpenRouterBaseUrl: harnessOptions.ResolveOpenRouterBaseUrl(),
|
||||
McpEndpoint: harnessOptions.ResolveMcpEndpoint(),
|
||||
HasApiKey: harnessOptions.HasApiKeyConfigured(),
|
||||
ExposeInventoryWindowAction: harnessOptions.ExposeInventoryWindowAction,
|
||||
ExposeInternalCommandTool: harnessOptions.ExposeInternalCommandTool));
|
||||
});
|
||||
|
||||
api.MapPost("/chat/stream", (ChatStreamRequest request, IMccAgentRunService runService, HttpContext httpContext, CancellationToken cancellationToken) =>
|
||||
{
|
||||
return TypedResults.ServerSentEvents(runService.StreamAsync(request, httpContext, cancellationToken));
|
||||
})
|
||||
.WithRequestTimeout("mcc-stream");
|
||||
|
||||
return endpoints;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue