diff --git a/src/Infrastructure/BotSharp.Abstraction/Messaging/MessageParser.cs b/src/Infrastructure/BotSharp.Abstraction/Messaging/MessageParser.cs index 3707de4a..21431d3f 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Messaging/MessageParser.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Messaging/MessageParser.cs @@ -45,6 +45,10 @@ public class MessageParser { res = JsonSerializer.Deserialize>(jsonText, options); } + else if (elementType == typeof(ButtonElement).Name) + { + res = JsonSerializer.Deserialize>(jsonText, options); + } } } @@ -80,6 +84,10 @@ public class MessageParser { res = JsonSerializer.Deserialize>(jsonText, options); } + else if (elementType == typeof(ButtonElement).Name) + { + res = JsonSerializer.Deserialize>(jsonText, options); + } } } diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs index 92966564..ee2481bf 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs @@ -118,7 +118,7 @@ public class ConversationStateService : IConversationStateService, IDisposable state.Value.Values.Add(new StateValue { Data = value.Data, - MessageId = !string.IsNullOrEmpty(curMsgId) ? curMsgId : value.MessageId, + MessageId = curMsgId, Active = false, ActiveRounds = value.ActiveRounds, UpdateTime = DateTime.UtcNow @@ -178,7 +178,7 @@ public class ConversationStateService : IConversationStateService, IDisposable value.Values.Add(new StateValue { Data = lastValue.Data, - MessageId = !string.IsNullOrEmpty(curMsgId) ? curMsgId : lastValue.MessageId, + MessageId = curMsgId, Active = false, ActiveRounds = lastValue.ActiveRounds, UpdateTime = utcNow diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs index 16133fc1..bb477391 100644 --- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs +++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Conversation.cs @@ -407,6 +407,11 @@ namespace BotSharp.Core.Repository var utcNow = DateTime.UtcNow; var dir = Path.Combine(_dbSettings.FileRepository, _conversationSettings.DataDir); + if (!Directory.Exists(dir)) + { + Directory.CreateDirectory(dir); + } + if (batchSize <= 0 || batchSize > batchLimit) { batchSize = batchLimit;