BotSharp/src/Infrastructure/BotSharp.Core/Hooks/RoutingHook.cs
2023-08-27 22:50:10 -05:00

19 lines
516 B
C#

namespace BotSharp.Core.Hooks;
public class RoutingHook : AgentHookBase
{
public RoutingHook(IServiceProvider services, AgentSettings settings)
: base(services, settings)
{
}
public override bool OnInstructionLoaded(string template, Dictionary<string, object> dict)
{
var router = _services.GetRequiredService<IAgentRouting>();
dict["routing_records"] = router.GetRoutingRecords()
.Where(x => !x.Disabled)
.ToList();
return true;
}
}