BotSharp/src/Infrastructure/BotSharp.OpenAPI/Controllers/EvaluationController.cs

24 lines
660 B
C#
Raw Normal View History

2023-10-18 11:58:36 +00:00
using BotSharp.Abstraction.ApiAdapters;
using BotSharp.Abstraction.Evaluations;
using BotSharp.Abstraction.Evaluations.Models;
namespace BotSharp.OpenAPI.Controllers;
[Authorize]
[ApiController]
public class EvaluationController : ControllerBase, IApiAdapter
{
private readonly IServiceProvider _services;
public EvaluationController(IServiceProvider services)
{
_services = services;
}
[HttpPost("/evaluation")]
public async Task<EvaluationResult> RunTask([FromBody] EvaluationRequest request)
{
var eval = _services.GetRequiredService<IEvaluatingService>();
return await eval.Evaluate(request);
}
}