最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon lex - Re-prompting the user for input after a certain time - Stack Overflow

programmeradmin4浏览0评论

I am building a bot in amazon lex, which will be used to collect app ratings from the user. To collect these ratings I'm using Elicit_slot so the bot will prompt the user for rating. Problem is if user doesn't input after 30s I want the bot to reprompt it again (only for 1 try). I couldn't find any doc for the timeout feature.

This is the only doc I found out, but even after adding this in session attributes it didn't work

Here's my code for slot elicitation:

def elicit_slot(intent_request, session_attributes, slot_name, message):
    # Set a timeout for the slot
    session_attributes["x-amz-lex:text:start-timeout-ms:RequestForRating:rating"] = '5000' #set for 5s for testing
    return {
        "lex_data":{
            "sessionState": {
                "sessionAttributes": session_attributes,
                "dialogAction": {
                    "type": "ElicitSlot",
                    "slotToElicit": slot_name
                },
                "intent": intent_request["sessionState"]["intent"]
            },
            "messages": [
                {
                    "contentType": "PlainText",
                    "content": message
                }
            ]
        }
    }


发布评论

评论列表(0)

  1. 暂无评论