Amazon Skill Flow Builder的超时和回退提示和摘要

问题描述 投票:0回答:2

我在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,您可以将其定义为在经过多次尝试以获取正确的响应后触发。

aws-lambda alexa alexa-skills-kit alexa-skill
2个回答
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

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
        }
© www.soinside.com 2019 - 2024. All rights reserved.