From 7415895db18ee84f4570d00ae4f10128e21d5083 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Thu, 7 Nov 2024 13:53:06 -0600 Subject: [PATCH 1/2] add flag --- .../BotSharp.Core/Conversations/Services/ConversationService.cs | 2 +- .../BotSharp.Core/Evaluations/EvaluatingService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs index 6c856591b..f6326a7b4 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs @@ -159,7 +159,7 @@ public List GetDialogHistory(int lastCount = 100, bool fromBrea public void SetConversationId(string conversationId, List states, bool isReadOnly = false) { _conversationId = conversationId; - _state.Load(_conversationId); + _state.Load(_conversationId, isReadOnly); states.ForEach(x => _state.SetState(x.Key, x.Value, activeRounds: x.ActiveRounds, source: StateSource.External)); } diff --git a/src/Infrastructure/BotSharp.Core/Evaluations/EvaluatingService.cs b/src/Infrastructure/BotSharp.Core/Evaluations/EvaluatingService.cs index 58da8688d..ec5b31582 100644 --- a/src/Infrastructure/BotSharp.Core/Evaluations/EvaluatingService.cs +++ b/src/Infrastructure/BotSharp.Core/Evaluations/EvaluatingService.cs @@ -89,9 +89,9 @@ public async Task Evaluate(string conversationId, EvaluationRe private async Task SendMessage(string agentId, string conversationId, string text) { var conv = _services.GetRequiredService(); + var routing = _services.GetRequiredService(); var inputMsg = new RoleDialogModel(AgentRole.User, text); - var routing = _services.GetRequiredService(); routing.Context.SetMessageId(conversationId, inputMsg.MessageId); conv.SetConversationId(conversationId, new List { From 7c341fca327073e502a1b5d9a6bb5e3041ba3b07 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Thu, 7 Nov 2024 13:59:18 -0600 Subject: [PATCH 2/2] add missing flag --- .../BotSharp.OpenAPI/Controllers/ConversationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs index b7391be70..2da3251b3 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs @@ -80,7 +80,7 @@ public async Task> GetConversations([FromBody] public async Task> GetDialogs([FromRoute] string conversationId) { var conv = _services.GetRequiredService(); - conv.SetConversationId(conversationId, new List()); + conv.SetConversationId(conversationId, new List(), isReadOnly: true); var history = conv.GetDialogHistory(fromBreakpoint: false); var userService = _services.GetRequiredService();