Fix ExecuteOnce fetch dialogs.

This commit is contained in:
hchen 2023-11-16 12:20:43 -06:00
parent dbd1b8d0ce
commit 0bf2fe58fc
3 changed files with 12 additions and 1 deletions

View file

@ -12,5 +12,12 @@ public interface IRoutingService
void ResetRecursiveCounter(); void ResetRecursiveCounter();
Task<bool> InvokeAgent(string agentId, List<RoleDialogModel> dialogs); Task<bool> InvokeAgent(string agentId, List<RoleDialogModel> dialogs);
Task<RoleDialogModel> InstructLoop(RoleDialogModel message); Task<RoleDialogModel> InstructLoop(RoleDialogModel message);
/// <summary>
/// Talk to a specific Agent directly, bypassing the Router
/// </summary>
/// <param name="agent"></param>
/// <param name="message"></param>
/// <returns></returns>
Task<RoleDialogModel> ExecuteOnce(Agent agent, RoleDialogModel message); Task<RoleDialogModel> ExecuteOnce(Agent agent, RoleDialogModel message);
} }

View file

@ -36,7 +36,9 @@ public partial class RoutingService : IRoutingService
var handlers = _services.GetServices<IRoutingHandler>(); var handlers = _services.GetServices<IRoutingHandler>();
var handler = handlers.FirstOrDefault(x => x.Name == "route_to_agent"); var handler = handlers.FirstOrDefault(x => x.Name == "route_to_agent");
var dialogs = new List<RoleDialogModel> { message };
var conv = _services.GetRequiredService<IConversationService>();
var dialogs = conv.GetDialogHistory();
handler.SetDialogs(dialogs); handler.SetDialogs(dialogs);
var inst = new FunctionCallFromLlm var inst = new FunctionCallFromLlm

View file

@ -6,6 +6,8 @@ namespace BotSharp.Plugin.PizzaBot;
public class PizzaBotPlugin : IBotSharpPlugin public class PizzaBotPlugin : IBotSharpPlugin
{ {
public string Name => "Pizza AI Assistant"; public string Name => "Pizza AI Assistant";
public string Description => "An example of an enterprise-grade AI Chatbot.";
public void RegisterDI(IServiceCollection services, IConfiguration config) public void RegisterDI(IServiceCollection services, IConfiguration config)
{ {
// Register hooks // Register hooks