Amazon Skill Flow Builder超时和回退以进行提示和总结

时间:2019-11-01 09:20:19

标签: aws-lambda alexa alexa-skills-kit alexa-skill

我无法在Skill Flow Builder中找到用于检测返回repromptrecap的频率的解决方案,因此在2-3次提示后,我可以强制执行备用路由用户。

有人可以解决吗?

这是一个典型的例子:

@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
        }

问题是除非您说“路线A”或“路线B”,否则您将永远得到提示。

它需要一个fallback,您可以定义sort在经过多次尝试以获取正确的响应后触发。

2 个答案:

答案 0 :(得分:1)

如果您定义hear *,则SFB驱动程序会将行为发送给它,而不仅仅是重复*recap消息。

时间变化回顾的示例如下所示:

@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

答案 1 :(得分:0)

感谢Ezra提供此解决方案。我需要添加一些内容,以使其更易于在全球范围内实施:

@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}

请注意您必须在每个场景中设置的变量名称。在您当前所在的场景没有全局变量之前,必须手动进行设置。

@aScene
    *say
        blah blah
    *recap
        recap message
    *then
        set recapScene as 'aScene'
        set fallbackScene as 'aFallbackScene'
        hear * {
            -> recapHandler
        }