BotSharp/src/Infrastructure/BotSharp.Core/Hooks/RoutingHook.cs

19 lines
516 B
C#
Raw Normal View History

namespace BotSharp.Core.Hooks;
2023-08-28 03:50:10 +00:00
public class RoutingHook : AgentHookBase
{
2023-08-28 03:50:10 +00:00
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;
}
}