Remove GoToRouterFn.

This commit is contained in:
hchen2020 2023-08-22 15:02:50 -05:00
parent e9b34dc1df
commit e3a00c54e8
3 changed files with 2 additions and 30 deletions

View file

@ -37,7 +37,6 @@ public static class BotSharpServiceCollectionExtensions
services.AddScoped<IAgentRouting, AgentRouter>();
services.AddScoped<IFunctionCallback, GoToRouterFn>();
services.AddScoped<IFunctionCallback, RouteToAgentFn>();
return services;

View file

@ -21,8 +21,8 @@ public partial class ConversationService
currentRecursiveDepth++;
if (currentRecursiveDepth > maxRecursiveDepth)
{
_logger.LogError($"Exceed max current recursive depth.");
await HandleAssistantMessage(new RoleDialogModel(AgentRole.Assistant, "System has exception, please try later.")
_logger.LogError($"Exceeded max recursive depth.");
await HandleAssistantMessage(new RoleDialogModel(AgentRole.Assistant, "I'm sorry, can you see it again?")
{
CurrentAgentId = agent.Id,
Channel = wholeDialogs.Last().Channel

View file

@ -1,27 +0,0 @@
using BotSharp.Abstraction.Conversations.Models;
using BotSharp.Abstraction.Functions;
using BotSharp.Abstraction.Functions.Models;
namespace BotSharp.Core.Functions;
public class GoToRouterFn : IFunctionCallback
{
public string Name => "go_to_router";
private readonly IServiceProvider _services;
public GoToRouterFn(IServiceProvider services)
{
_services = services;
}
public async Task<bool> Execute(RoleDialogModel message)
{
var settings = _services.GetRequiredService<AgentSettings>();
message.CurrentAgentId = settings.RouterId;
var result = new FunctionExecutionValidationResult("true");
message.ExecutionResult = JsonSerializer.Serialize(result);
return true;
}
}