Remove GoToRouterFn.
This commit is contained in:
parent
e9b34dc1df
commit
e3a00c54e8
|
|
@ -37,7 +37,6 @@ public static class BotSharpServiceCollectionExtensions
|
||||||
|
|
||||||
services.AddScoped<IAgentRouting, AgentRouter>();
|
services.AddScoped<IAgentRouting, AgentRouter>();
|
||||||
|
|
||||||
services.AddScoped<IFunctionCallback, GoToRouterFn>();
|
|
||||||
services.AddScoped<IFunctionCallback, RouteToAgentFn>();
|
services.AddScoped<IFunctionCallback, RouteToAgentFn>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ public partial class ConversationService
|
||||||
currentRecursiveDepth++;
|
currentRecursiveDepth++;
|
||||||
if (currentRecursiveDepth > maxRecursiveDepth)
|
if (currentRecursiveDepth > maxRecursiveDepth)
|
||||||
{
|
{
|
||||||
_logger.LogError($"Exceed max current recursive depth.");
|
_logger.LogError($"Exceeded max recursive depth.");
|
||||||
await HandleAssistantMessage(new RoleDialogModel(AgentRole.Assistant, "System has exception, please try later.")
|
await HandleAssistantMessage(new RoleDialogModel(AgentRole.Assistant, "I'm sorry, can you see it again?")
|
||||||
{
|
{
|
||||||
CurrentAgentId = agent.Id,
|
CurrentAgentId = agent.Id,
|
||||||
Channel = wholeDialogs.Last().Channel
|
Channel = wholeDialogs.Last().Channel
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue