Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RoleDialogModel : ITrackableMessage
public string? SecondaryContent { get; set; }

/// <summary>
/// Postback content
/// Postback of previous round payload
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("payload")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task<bool> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ public async Task<string> GetConversationContent(List<RoleDialogModel> 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;
Expand Down
12 changes: 6 additions & 6 deletions src/Plugins/BotSharp.Plugin.Twilio/Services/TwilioService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public VoiceResponse ReturnInstructions(string message)
return response;
}

public VoiceResponse ReturnInstructions(List<string> speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 2)
public VoiceResponse ReturnInstructions(List<string> speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 3)
{
var response = new VoiceResponse();
var gather = new Gather()
Expand All @@ -76,8 +76,8 @@ public VoiceResponse ReturnInstructions(List<string> 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())
Expand All @@ -91,7 +91,7 @@ public VoiceResponse ReturnInstructions(List<string> speechPaths, string callbac
return response;
}

public VoiceResponse ReturnNoninterruptedInstructions(List<string> speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 2)
public VoiceResponse ReturnNoninterruptedInstructions(List<string> speechPaths, string callbackPath, bool actionOnEmptyResult, int timeout = 3)
{
var response = new VoiceResponse();
if (speechPaths != null && speechPaths.Any())
Expand All @@ -110,8 +110,8 @@ public VoiceResponse ReturnNoninterruptedInstructions(List<string> 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);
Expand Down