From 4a1ae030ddff79633f96e50664e6d40caae29e8e Mon Sep 17 00:00:00 2001 From: Haiping Chen <101423@smsassist.com> Date: Mon, 5 Feb 2024 23:58:38 -0600 Subject: [PATCH] Add more dialog history for SequentialPlanner --- .../BotSharp.Core/Routing/Planning/SequentialPlanner.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Routing/Planning/SequentialPlanner.cs b/src/Infrastructure/BotSharp.Core/Routing/Planning/SequentialPlanner.cs index 7d4291ee..a7201f2d 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/Planning/SequentialPlanner.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/Planning/SequentialPlanner.cs @@ -31,15 +31,19 @@ public class SequentialPlanner : IPlaner { _lastInst.Response = decomposation.Description; _lastInst.Reason = $"{decomposation.TotalRemainingSteps} left."; + dialogs.Add(new RoleDialogModel(AgentRole.User, decomposation.Description) + { + CurrentAgentId = router.Id, + MessageId = messageId + }); return _lastInst; } - else if (decomposation.TotalRemainingSteps == 0) + else if (decomposation.TotalRemainingSteps == 0 || decomposation.ShouldStop) { // Tell router all steps are done dialogs.Add(new RoleDialogModel(AgentRole.Assistant, decomposation.StopReason) { CurrentAgentId = router.Id, - FunctionName = nameof(SequentialPlanner), MessageId = messageId }); router.TemplateDict["conversation"] = router.TemplateDict["conversation"].ToString().TrimEnd() +