diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/MessageTypeName.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/MessageTypeName.cs index e59622bb6..e87fa669b 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/MessageTypeName.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/MessageTypeName.cs @@ -3,6 +3,10 @@ namespace BotSharp.Abstraction.Conversations.Enums; public static class MessageTypeName { public const string Plain = "plain"; + /// + /// Persisted for record/audit but excluded from default LLM dialog history. + /// + public const string RecordOnly = "record_only"; public const string Notification = "notification"; public const string FunctionCall = "function"; public const string Audio = "audio"; diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs index 60e81bbe9..b468d3afa 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs @@ -1,3 +1,5 @@ +using BotSharp.Abstraction.Conversations.Enums; + namespace BotSharp.Core.Routing; public partial class RoutingService @@ -6,8 +8,8 @@ public async Task GetConversationContent(List dialogs, { var agentService = _services.GetRequiredService(); var conversation = ""; - - foreach (var dialog in dialogs.TakeLast(maxDialogCount)) + var conversationDialogs = dialogs.Where(x => x.MessageType != MessageTypeName.RecordOnly).TakeLast(maxDialogCount).ToList(); + foreach (var dialog in conversationDialogs) { var role = dialog.Role; if (role != AgentRole.User)