2024-04-22 20:46:47 +00:00
|
|
|
using BotSharp.Abstraction.Functions;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Core.Routing.Functions;
|
|
|
|
|
|
|
|
|
|
public class HumanInterventionNeededFn : IFunctionCallback
|
|
|
|
|
{
|
|
|
|
|
public string Name => "human_intervention_needed";
|
|
|
|
|
|
|
|
|
|
private readonly IServiceProvider _services;
|
|
|
|
|
|
|
|
|
|
public HumanInterventionNeededFn(IServiceProvider services)
|
|
|
|
|
{
|
|
|
|
|
_services = services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<bool> Execute(RoleDialogModel message)
|
|
|
|
|
{
|
2024-12-07 21:47:17 +00:00
|
|
|
var hooks = _services
|
|
|
|
|
.GetRequiredService<ConversationHookProvider>()
|
|
|
|
|
.HooksOrderByPriority;
|
2024-04-22 20:46:47 +00:00
|
|
|
|
|
|
|
|
foreach (var hook in hooks)
|
|
|
|
|
{
|
|
|
|
|
await hook.OnHumanInterventionNeeded(message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|