diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationService.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationService.cs index a52b9f07..7e7e372e 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationService.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationService.cs @@ -41,7 +41,7 @@ public interface IConversationService PostbackMessageModel? replyMessage, Func onResponseReceived); - List GetDialogHistory(int lastCount = 100, bool fromBreakpoint = true, IEnumerable? excludeMessageTypes = null); + List GetDialogHistory(int lastCount = 100, bool fromBreakpoint = true, IEnumerable? includeMessageTypes = null); Task CleanHistory(string agentId); /// diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs index 40f412d9..8511b873 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs @@ -106,7 +106,7 @@ public partial class ConversationService : IConversationService throw new NotImplementedException(); } - public List GetDialogHistory(int lastCount = 100, bool fromBreakpoint = true, IEnumerable? excludeMessageTypes = null) + public List GetDialogHistory(int lastCount = 100, bool fromBreakpoint = true, IEnumerable? includeMessageTypes = null) { if (string.IsNullOrEmpty(_conversationId)) { @@ -115,9 +115,13 @@ public partial class ConversationService : IConversationService var dialogs = _storage.GetDialogs(_conversationId); - if (!excludeMessageTypes.IsNullOrEmpty()) + if (!includeMessageTypes.IsNullOrEmpty()) { - dialogs = dialogs.Where(x => !excludeMessageTypes.Contains(x.MessageType)).ToList(); + dialogs = dialogs.Where(x => string.IsNullOrEmpty(x.MessageType) || includeMessageTypes.Contains(x.MessageType)).ToList(); + } + else + { + dialogs = dialogs.Where(x => string.IsNullOrEmpty(x.MessageType) || x.MessageType.IsEqualTo(MessageTypeName.Plain)).ToList(); } if (fromBreakpoint)