首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >alexa skill not服务调用未发生

alexa skill not服务调用未发生
EN

Stack Overflow用户
提问于 2016-07-22 13:42:12
回答 1查看 281关注 0票数 1

我试着使用历史虚张声势的例子来调用维基百科服务。我把电话放在了开机消息中。我可以看到它正在打印我的消息,直到它点击调用stmt为止。但之后它不会在控制台中打印任何内容。代码如下:

代码语言:javascript
复制
var https = require('https');
var urlPrefix = 'https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&explaintext=&exsectionformat=plain&redirects=&titles=';

HowTo.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {
     console.log("vik::::::::::::: before service call ");


    var speechText = "Welcome to the your assistant? ... what can I help you with.";
    var repromptText = "For instructions on what you can say, say help me.";
    response.ask(speechText, repromptText);
     getJsonEventsFromWikipedia("day", "date", function (events) {
        console.log("vik::::::::::::: wikipedia response received");
        console.log("values are:" + events);
    });
};


function getJsonEventsFromWikipedia(day, date, eventCallback) {
    var url = urlPrefix+'Jan_21';
     console.log("url to invoke is:" + url);

    https.get(url, function(res) {
        console.log("vik:::::::::::::::::::::inside data fetch");
        var body = '';

        res.on('data', function (chunk) {
            body += chunk;
        });

        res.on('end', function () {
            var stringResult = body;
            eventCallback(stringResult);
        });
    }).on('error', function (e) {
        console.log("Got error: ", e);
    });
}

控制台打印如下

代码语言:javascript
复制
START RequestId: 0c6d7a9b-4fcd-11e6-84e8-6b679452fe6e Version: $LATEST 
2016-07-22T05:27:58.039Z    0c6d7a9b-4fcd-11e6-84e8-6b679452fe6e    session applicationId: amzn1.echo-sdk-ams.app.ef1f54cb-cabe-429b-b8a1-5a4090e5f937 
2016-07-22T05:27:58.040Z    0c6d7a9b-4fcd-11e6-84e8-6b679452fe6e    vik::::::::::::: before service call  
2016-07-22T05:27:58.078Z    0c6d7a9b-4fcd-11e6-84e8-6b679452fe6e    url to invoke is:https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&explaintext=&exsectionformat=plain&redirects=&titles=Jan_21 
END RequestId: 0c6d7a9b-4fcd-11e6-84e8-6b679452fe6e 
REPORT RequestId: 0c6d7a9b-4fcd-11e6-84e8-6b679452fe6e  Duration: 398.63 ms Billed Duration: 400 ms Memory Size: 128 MB Max Memory Used: 17 MB  

我不确定哪里出了问题以及如何对其进行调试

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-26 12:15:13

它现在起作用了。问题是为了测试,我把它放在发射意图和响应卡之后。这就是调用context.succeed并在它完成之前杀死它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38518985

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档