Amazon Skill Flow Builder 超时和回退以重新提示和重述

Amazon Skill Flow Builder timeout and fallback for reprompts and recaps

我无法在 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
        }

问题在于,除非你说 "route A" 或 "route B",否则你将永远得到重新提示。

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

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

# of time variation 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

感谢 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
        }