【发布时间】:2018-03-26 20:48:38
【问题描述】:
我正在学习 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 <<<
如果需要,可以比较一下
其实我是想得到这个功能(build message to 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)
谁能帮帮我?
【问题讨论】:
-
嗨!如果您签出代码中的How to create a Minimal, Complete, and Verifiable example 以备将来在堆栈溢出时使用会更好。 -谢谢
-
感谢@Momin 和 {aUXcoder} 编辑,帮助我的问题
标签: python node.js amazon-web-services aws-lambda