我正在学习 aws lambda - lex,我发现了带有 node.js 的咖啡机器人示例代码。
// --------------- Main handler -----------------------
// --------------- in node.js -----------------------
// Route the incoming request based on intent.
// The JSON body of the request is provided in the event slot.
exports.handler = (event, context, callback) => {
try {
dispatch(event, (response) => callback(null, response));
} catch (err) {
callback(err);
}
};
我想使用回调参数,但我在 python 中找不到它
// --------------- Main handler -----------------------
// --------------- in python -----------------------
def lambda_handler(event, context):
dispatch(event)
# >>> this handler doesn't include callback <<<
如果您需要,请比较两者
蟒蛇文档 vs Node.js 文档
其实我想得到这个功能(构建消息到lex)
callback(elicitSlot(outputSessionAttributes, intentRequest.currentIntent.name, slots, 'BeverageType',
buildMessage('Sorry, but we can only do a mocha or a chai. What kind of beverage would you like?'),
buildResponseCard("Menu", "Today's Menu", menuItem)));
完整的示例代码在这里(https://github.com/awslabs/amz-ai-building-better-bots/blob/master/src/index.js)
有人可以帮助我吗?