Reputation: 10839
I can't find a solution in Skill Flow Builder
for detecting how often a reprompt
or recap
is returned so that I can force a fallback route after 2-3 attempts at prompting the user.
Does anyone have a solution?
Here's a typical example:
@welcome
*say
Hello. Where do you want to go?
*reprompt
Where to go?
*recap
Where to go?
*then
hear route A {
-> route_a
}
hear route B {
-> route_b
}
The problem with this is unless you say "route A" or "route B" you will get the reprompts forever.
It needs a fallback
that you can define to trigger after so many attempts to get a correct response.
Upvotes: 0
Views: 125
Reputation: 10839
Thank you Ezra for this solution. I have some bits to add to make this easier to implement globally:
@global prepend
*then
hear * {
-> recapHandler
}
@recapHandler
// *say
// DEBUG Recap count is {recapCount} [pause] Recap limit is {recapLimit}
*then
increase recapCount by 1
if recapCount <= recapLimit {
-> {recapScene} *recap
}
set recapCount as 0
-> {fallbackScene}
Note the variable names that you have to setup in each of your scenes. Until there is a global variable for the current scene you are in, you'll have to set this manually.
@aScene
*say
blah blah
*recap
recap message
*then
set recapScene as 'aScene'
set fallbackScene as 'aFallbackScene'
hear * {
-> recapHandler
}
Upvotes: 0
Reputation: 26
If you define hear *
, SFB driver will route the behavior to it instead of just repeating the *recap
message.
Example of # of time variation recap would look something like:
@start
*say
hello.
Do you go to left or right?
*reprompt
Do you want to go left, or right?
*recap
This is a recap message.
*then
hear left {
set repromptCount as 0
-> left room
}
hear right {
set repromptCount as 0
-> right room
}
hear * {
increase repromptCount by 1
set limit as 3
if repromptCount < limit {
-> start *recap
}
set repromptingDestination as 'reprompting destination'
-> too many reprompts scene
}
@left room
*say
left room
@right room
*say
right room
@too many reprompts scene
*say
You didn't know what to do too much.
*then
-> {repromptingDestination}
@reprompting destination
*say
Reprompt destination
Upvotes: 1