commit
74da640abd
|
|
@ -11,18 +11,18 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
|
|||
|
||||
public List<ParameterPropertyDef> Parameters => new List<ParameterPropertyDef>
|
||||
{
|
||||
/*new ParameterPropertyDef("next_action_reason",
|
||||
new ParameterPropertyDef("next_action_reason",
|
||||
"the reason why route to this virtual agent.",
|
||||
required: true),*/
|
||||
required: true),
|
||||
new ParameterPropertyDef("next_action_agent",
|
||||
"agent for next action based on user latest response, if user is replying last agent's question, you must route to this agent.",
|
||||
required: true),
|
||||
new ParameterPropertyDef("args",
|
||||
"useful parameters of next action agent, format: { }",
|
||||
type: "object"),
|
||||
/*new ParameterPropertyDef("user_goal_description",
|
||||
new ParameterPropertyDef("user_goal_description",
|
||||
"user goal based on user initial task.",
|
||||
required: true),*/
|
||||
required: true),
|
||||
new ParameterPropertyDef("user_goal_agent",
|
||||
"agent who can acheive user initial task.",
|
||||
required: true),
|
||||
|
|
|
|||
|
|
@ -7,5 +7,9 @@
|
|||
"updatedDateTime": "2024-05-07T10:00:00Z",
|
||||
"disabled": false,
|
||||
"isPublic": true,
|
||||
"llmConfig": {
|
||||
"provider": "openai",
|
||||
"model": "gpt-4o-mini"
|
||||
},
|
||||
"profiles": [ "fallback" ]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Follow these steps to handle user request:
|
|||
# {{ handler.description}}
|
||||
{% if handler.parameters and handler.parameters != empty -%}
|
||||
Parameters:
|
||||
- function: {{ handler.name }}
|
||||
{% for p in handler.parameters -%}
|
||||
- {{ p.name }} {% if p.required -%}(required){%- endif %}: {{ p.description }}{{ "\r\n " }}
|
||||
{%- endfor %}
|
||||
|
|
|
|||
|
|
@ -47,15 +47,16 @@ public class TwilioVoiceController : TwilioController
|
|||
var messageQueue = _services.GetRequiredService<TwilioMessageQueue>();
|
||||
var sessionManager = _services.GetRequiredService<ITwilioSessionManager>();
|
||||
var messages = await sessionManager.RetrieveStagedCallerMessagesAsync(conversationId, seqNum);
|
||||
if (!string.IsNullOrWhiteSpace(request.SpeechResult))
|
||||
string text = (request.SpeechResult + "\r\n" + request.Digits).Trim();
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
messages.Add(request.SpeechResult);
|
||||
await sessionManager.StageCallerMessageAsync(conversationId, seqNum, request.SpeechResult);
|
||||
messages.Add(text);
|
||||
await sessionManager.StageCallerMessageAsync(conversationId, seqNum, text);
|
||||
}
|
||||
VoiceResponse response;
|
||||
if (messages.Count == 0 && seqNum == 0)
|
||||
{
|
||||
response = twilio.ReturnInstructions("twilio/welcome.mp3", $"twilio/voice/{conversationId}/receive/{seqNum}?states={states}", true);
|
||||
response = twilio.ReturnInstructions("twilio/welcome.mp3", $"twilio/voice/{conversationId}/receive/{seqNum}?states={states}", true, timeout: 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ public class TwilioService
|
|||
{
|
||||
Input = new List<Gather.InputEnum>()
|
||||
{
|
||||
Gather.InputEnum.Speech
|
||||
Gather.InputEnum.Speech,
|
||||
Gather.InputEnum.Dtmf
|
||||
},
|
||||
Action = new Uri($"{_settings.CallbackHost}/twilio/voice/{twilioSetting.AgentId}")
|
||||
};
|
||||
|
|
@ -70,7 +71,8 @@ public class TwilioService
|
|||
{
|
||||
Input = new List<Gather.InputEnum>()
|
||||
{
|
||||
Gather.InputEnum.Speech
|
||||
Gather.InputEnum.Speech,
|
||||
Gather.InputEnum.Dtmf
|
||||
},
|
||||
Action = new Uri($"{_settings.CallbackHost}/{callbackPath}"),
|
||||
SpeechModel = Gather.SpeechModelEnum.PhoneCall,
|
||||
|
|
@ -109,7 +111,11 @@ public class TwilioService
|
|||
var response = new VoiceResponse();
|
||||
var gather = new Gather()
|
||||
{
|
||||
Input = new List<Gather.InputEnum>() { Gather.InputEnum.Speech },
|
||||
Input = new List<Gather.InputEnum>()
|
||||
{
|
||||
Gather.InputEnum.Speech,
|
||||
Gather.InputEnum.Dtmf
|
||||
},
|
||||
Action = new Uri($"{_settings.CallbackHost}/twilio/voice/{twilioSetting.AgentId}"),
|
||||
ActionOnEmptyResult = true
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue