diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs index 3d8a25e9c..2018d6a79 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs @@ -30,7 +30,7 @@ public class RoleDialogModel : ITrackableMessage public string? SecondaryContent { get; set; } /// - /// Postback content + /// Postback of previous round payload /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("payload")] diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.SendMessage.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.SendMessage.cs index 29f9e3f22..c9c5c4a26 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.SendMessage.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.SendMessage.cs @@ -41,7 +41,7 @@ public async Task SendMessage(string agentId, routing.Context.SetMessageId(_conversationId, message.MessageId); routing.Context.Push(agent.Id, reason: "request started"); - // Save payload + // Save payload in order to assign the payload before hook is invoked if (replyMessage != null && !string.IsNullOrEmpty(replyMessage.Payload)) { message.Payload = replyMessage.Payload; diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs index f8efab46e..f95b3f378 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetConversationContent.cs @@ -16,7 +16,15 @@ public async Task GetConversationContent(List dialogs, role = agent.Name; } - conversation += $"{role}: {dialog.Payload ?? dialog.Content}\r\n"; + if (role == AgentRole.User) + { + conversation += $"{role}: {dialog.Payload ?? dialog.Content}\r\n"; + } + else + { + // Assistant reply deosn't need help with payload + conversation += $"{role}: {dialog.Content}\r\n"; + } } return conversation; diff --git a/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs b/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs index ca4896824..ee1a31e77 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs +++ b/src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs @@ -64,7 +64,7 @@ public VoiceResponse ReturnInstructions(string message) return response; } - public VoiceResponse ReturnInstructions(List speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 2) + public VoiceResponse ReturnInstructions(List speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 3) { var response = new VoiceResponse(); var gather = new Gather() @@ -76,8 +76,8 @@ public VoiceResponse ReturnInstructions(List speechPaths, string callbac }, Action = new Uri($"{_settings.CallbackHost}/{callbackPath}"), SpeechModel = Gather.SpeechModelEnum.PhoneCall, - SpeechTimeout = timeout > 0 ? timeout.ToString() : "2", - Timeout = timeout > 0 ? timeout : 2, + SpeechTimeout = "auto", // timeout > 0 ? timeout.ToString() : "3", + Timeout = timeout > 0 ? timeout : 3, ActionOnEmptyResult = actionOnEmptyResult }; if (speechPaths != null && speechPaths.Any()) @@ -91,7 +91,7 @@ public VoiceResponse ReturnInstructions(List speechPaths, string callbac return response; } - public VoiceResponse ReturnNoninterruptedInstructions(List speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 2) + public VoiceResponse ReturnNoninterruptedInstructions(List speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 3) { var response = new VoiceResponse(); if (speechPaths != null && speechPaths.Any()) @@ -110,8 +110,8 @@ public VoiceResponse ReturnNoninterruptedInstructions(List speechPaths, }, Action = new Uri($"{_settings.CallbackHost}/{callbackPath}"), SpeechModel = Gather.SpeechModelEnum.PhoneCall, - SpeechTimeout = timeout > 0 ? timeout.ToString() : "2", - Timeout = timeout > 0 ? timeout : 2, + SpeechTimeout = "auto", // timeout > 0 ? timeout.ToString() : "3", + Timeout = timeout > 0 ? timeout : 3, ActionOnEmptyResult = actionOnEmptyResult }; response.Append(gather);