voice copilot playload use tel Digits

This commit is contained in:
易磊 2024-10-18 16:40:06 +08:00 committed by GitHub
parent effe494571
commit b99b66e489
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View file

@ -72,6 +72,7 @@ public class TwilioVoiceController : TwilioController
ConversationId = conversationId,
SeqNumber = seqNum,
Content = messageContent,
Digits = request.Digits,
From = request.From
};

View file

@ -5,6 +5,7 @@ namespace BotSharp.Plugin.Twilio.Models
public string ConversationId { get; set; }
public int SeqNumber { get; set; }
public string Content { get; set; }
public string Digits { get; set; }
public string From { get; set; }
public Dictionary<string, string> States { get; set; } = new();

View file

@ -70,7 +70,7 @@ namespace BotSharp.Plugin.Twilio.Services
var result = await conv.SendMessage(config.AgentId,
inputMsg,
replyMessage: BuildPostbackMessageModel(conv),
replyMessage: BuildPostbackMessageModel(conv, message),
async msg =>
{
reply = new AssistantMessage()
@ -88,7 +88,7 @@ namespace BotSharp.Plugin.Twilio.Services
await sessionManager.SetAssistantReplyAsync(message.ConversationId, message.SeqNumber, reply);
}
private PostbackMessageModel BuildPostbackMessageModel(IConversationService conv)
private PostbackMessageModel BuildPostbackMessageModel(IConversationService conv, CallerMessage message)
{
var messages = conv.GetDialogHistory(1);
if (!messages.Any()) return null;
@ -98,7 +98,7 @@ namespace BotSharp.Plugin.Twilio.Services
{
FunctionName = lastMessage.PostbackFunctionName,
ParentId = lastMessage.MessageId,
Payload = lastMessage.Payload
Payload = message.Digits
};
}