Merge pull request #232 from iceljc/features/add-routing-invoke-function
add invoke function in routing service
This commit is contained in:
commit
732e3925fb
|
|
@ -11,6 +11,7 @@ public interface IRoutingService
|
|||
List<RoutingHandlerDef> GetHandlers();
|
||||
void ResetRecursiveCounter();
|
||||
Task<bool> InvokeAgent(string agentId, List<RoleDialogModel> dialogs);
|
||||
Task<bool> InvokeFunction(string name, RoleDialogModel message);
|
||||
Task<RoleDialogModel> InstructLoop(RoleDialogModel message);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
using BotSharp.Abstraction.Functions;
|
||||
|
||||
namespace BotSharp.Core.Routing;
|
||||
|
||||
public partial class RoutingService
|
||||
{
|
||||
public async Task<bool> InvokeFunction(string name, RoleDialogModel message)
|
||||
{
|
||||
var function = _services.GetServices<IFunctionCallback>().FirstOrDefault(x => x.Name == name);
|
||||
if (function == null) return false;
|
||||
|
||||
return await function.Execute(message);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue