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

19 lines
518 B
C#
Raw Normal View History

namespace BotSharp.Core.Routing;
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;
}
}