diff --git a/Directory.Build.props b/Directory.Build.props index 23dce0b1..81c66e4a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ 10.0 ..\..\..\packages - 0.14.5 + 0.14.6 true \ No newline at end of file diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.cs index 665f6ce7..4eae4709 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.cs @@ -59,8 +59,23 @@ public class RoutingService : IRoutingService // Compatible with previous Router, can be removed in the future. else if (inst.Function == "route_to_agent") { + // If the agent name is empty, fallback to router + if (string.IsNullOrEmpty(inst.Parameters.AgentName)) + { + result = new RoleDialogModel(AgentRole.Function, inst.Reason) + { + FunctionName = inst.Function, + FunctionArgs = JsonSerializer.Serialize(new RoutingArgs + { + AgentName = inst.Parameters.AgentName + }), + CurrentAgentId = router.Id + }; + break; + } + var function = _services.GetServices().FirstOrDefault(x => x.Name == inst.Function); - result = new RoleDialogModel(AgentRole.Function, inst.Parameters.Question) + result = new RoleDialogModel(AgentRole.Function, inst.Reason) { FunctionName = inst.Function, FunctionArgs = JsonSerializer.Serialize(new RoutingArgs