Skip to content

Commit 732e392

Browse files
authored
Merge pull request #232 from iceljc/features/add-routing-invoke-function
add invoke function in routing service
2 parents 8e940e9 + fabbd8b commit 732e392

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Infrastructure/BotSharp.Abstraction/Routing/IRoutingService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public interface IRoutingService
1111
List<RoutingHandlerDef> GetHandlers();
1212
void ResetRecursiveCounter();
1313
Task<bool> InvokeAgent(string agentId, List<RoleDialogModel> dialogs);
14+
Task<bool> InvokeFunction(string name, RoleDialogModel message);
1415
Task<RoleDialogModel> InstructLoop(RoleDialogModel message);
1516

1617
/// <summary>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using BotSharp.Abstraction.Functions;
2+
3+
namespace BotSharp.Core.Routing;
4+
5+
public partial class RoutingService
6+
{
7+
public async Task<bool> InvokeFunction(string name, RoleDialogModel message)
8+
{
9+
var function = _services.GetServices<IFunctionCallback>().FirstOrDefault(x => x.Name == name);
10+
if (function == null) return false;
11+
12+
return await function.Execute(message);
13+
}
14+
}

0 commit comments

Comments
 (0)