這是一個非常簡單的問題,但我找不到任何回答的證據。我想爲我配置一個插槽類型 - 這意味着Lex必須繼續詢問列表中的更多元素。Amazon AWS Lex插槽類型列表
例如,這裏是一個回往復應該是什麼樣子:
Lex: What flowers would you like to order?
Me: roses
Lex: Any other types?
Me: yes, I also want lillies
Lex: Anything else?
Me: that is all
是被髮送到一個LAMBDA一個例子有效載荷看起來是這樣的:
{
"currentIntent": {
"slots": {
"PickupDate": "2030-11-08",
"PickupTime": "10:00",
"FlowerType": "lilies"
},
"name": "OrderFlowers",
"confirmationStatus": "None"
},
"bot": {
"alias": "$LATEST",
"version": "$LATEST",
"name": "OrderFlowers"
},
"userId": "John",
"invocationSource": "DialogCodeHook",
"outputDialogMode": "Text",
"messageVersion": "1.0",
"sessionAttributes": {}
}
那^^ ^是直接從AWS Lambda控制檯中的示例測試配置中獲取的。
我希望它看起來像這樣:
{
"currentIntent": {
"slots": {
"PickupDate": "2030-11-08",
"PickupTime": "10:00",
"FlowerTypes": [
"roses",
"lilies"
]
},
"name": "OrderFlowers",
"confirmationStatus": "None"
},
"bot": {
"alias": "$LATEST",
"version": "$LATEST",
"name": "OrderFlowers"
},
"userId": "John",
"invocationSource": "DialogCodeHook",
"outputDialogMode": "Text",
"messageVersion": "1.0",
"sessionAttributes": {}
}
根據http://docs.aws.amazon.com/lex/latest/dg/API_Slot.html看起來像一個'slot'總是一個字符串。你能通過增加額外的插槽來完成你想要完成的任務嗎?例如FlowerType01,FlowerType02,... FlowerType99? –
我可以,但我希望有一個更好的方法 –
您可以創建一個驗證鉤子並利用引出槽調用來填充自己的花朵數組,它可以作爲'sessionAttribute'存儲。這很麻煩,你可能會更好地使用上面提到的多個插槽。 – Milk