From ebf6f5c01c63963b0e702a41d8dc6e4fdfb9d808 Mon Sep 17 00:00:00 2001 From: hchen2020 <101423@smsassist.com> Date: Wed, 23 Aug 2023 10:40:46 -0500 Subject: [PATCH 1/3] Fix dead loop when depth exceeds the limit. --- ...ionService.GetChatCompletionsAsyncRecursively.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.GetChatCompletionsAsyncRecursively.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.GetChatCompletionsAsyncRecursively.cs index 3f56f97b..d4f058f7 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.GetChatCompletionsAsyncRecursively.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.GetChatCompletionsAsyncRecursively.cs @@ -21,12 +21,21 @@ public partial class ConversationService currentRecursiveDepth++; if (currentRecursiveDepth > maxRecursiveDepth) { - _logger.LogError($"Exceeded max recursive depth."); - await HandleAssistantMessage(new RoleDialogModel(AgentRole.Assistant, "I'm sorry, can you see it again?") + _logger.LogWarning($"Exceeded max recursive depth."); + + var latestResponse = wholeDialogs.Last(); + var text = latestResponse.Content; + if (latestResponse.Role == AgentRole.Function) + { + text = latestResponse.Content.Split("=>").Last(); + } + + await HandleAssistantMessage(new RoleDialogModel(AgentRole.Assistant, text) { CurrentAgentId = agent.Id, Channel = wholeDialogs.Last().Channel }, onMessageReceived); + return false; } From 59e1788ff7eb9dadcc64af755fbd4c692229c2fd Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Wed, 23 Aug 2023 13:48:02 -0500 Subject: [PATCH 2/3] Bumb version number. --- .../BotSharp.Abstraction/BotSharp.Abstraction.csproj | 2 +- src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj index 48aa9074..583d9101 100644 --- a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj +++ b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj @@ -4,7 +4,7 @@ netstandard2.1 enable 10.0 - 0.9.0 + 0.9.2 Icon.png diff --git a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj index 6b871db4..902bef90 100644 --- a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj +++ b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj @@ -4,7 +4,7 @@ netstandard2.1 10.0 false - 0.9.0 + 0.9.2 From 3ef775561a41046ffc904f7a94ac8dc640d8a011 Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Fri, 25 Aug 2023 10:38:25 -0500 Subject: [PATCH 3/3] Bump version to v0.9.4 --- .../BotSharp.Abstraction/BotSharp.Abstraction.csproj | 2 +- src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj index 583d9101..802652e9 100644 --- a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj +++ b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj @@ -4,7 +4,7 @@ netstandard2.1 enable 10.0 - 0.9.2 + 0.9.4 Icon.png diff --git a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj index 902bef90..ab77723b 100644 --- a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj +++ b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj @@ -4,7 +4,7 @@ netstandard2.1 10.0 false - 0.9.2 + 0.9.4