2023-10-18 11:58:36 +00:00
|
|
|
using BotSharp.Abstraction.Evaluations;
|
|
|
|
|
using BotSharp.Abstraction.Evaluations.Models;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.OpenAPI.Controllers;
|
|
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
|
[ApiController]
|
2023-12-27 15:53:54 +00:00
|
|
|
public class EvaluationController : ControllerBase
|
2023-10-18 11:58:36 +00:00
|
|
|
{
|
|
|
|
|
private readonly IServiceProvider _services;
|
|
|
|
|
public EvaluationController(IServiceProvider services)
|
|
|
|
|
{
|
|
|
|
|
_services = services;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-23 00:31:49 +00:00
|
|
|
[HttpPost("/evaluation/execute/{task}")]
|
|
|
|
|
public async Task<Conversation> Execute([FromRoute] string task, [FromBody] EvaluationRequest request)
|
2023-10-18 11:58:36 +00:00
|
|
|
{
|
|
|
|
|
var eval = _services.GetRequiredService<IEvaluatingService>();
|
2023-10-23 00:31:49 +00:00
|
|
|
return await eval.Execute(task, request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("/evaluation/review/{conversationId}")]
|
|
|
|
|
public async Task<EvaluationResult> Review([FromRoute] string conversationId, [FromBody] EvaluationRequest request)
|
|
|
|
|
{
|
|
|
|
|
var eval = _services.GetRequiredService<IEvaluatingService>();
|
|
|
|
|
return await eval.Review(conversationId, request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost("/evaluation/evaluate/{conversationId}")]
|
|
|
|
|
public async Task<EvaluationResult> Evaluate([FromRoute] string conversationId, [FromBody] EvaluationRequest request)
|
|
|
|
|
{
|
|
|
|
|
var eval = _services.GetRequiredService<IEvaluatingService>();
|
|
|
|
|
return await eval.Evaluate(conversationId, request);
|
2023-10-18 11:58:36 +00:00
|
|
|
}
|
|
|
|
|
}
|