2017-12-26 25 views
1

에서 특정 요청이있는 스킬을 호출 할 수 없음 알렉사 스킬 코드 :여기 echosim.io

'use strict'; 
const Alexa = require("alexa-sdk"); 

exports.handler = function(event, context, callback) { 
    console.log("skill-sample-nodejs-hello-world Received an event"); 
    console.log("event="); 
    console.dir(event); 
    const alexa = Alexa.handler(event, context); 
    alexa.registerHandlers(handlers); 
    alexa.execute(); 
}; 

const handlers = { 
    'LaunchRequest': function() { 
     console.log("LaunchRequest called()"); 
     this.response.speak('Hello World Init!').listen("I am listening SayHelloInit"); 
     this.emit(':responseReady'); 
     //this.emit('SayHelloInit'); 
    }, 
    'HelloWorldIntent': function() { 
     console.log("hello world intent called"); 
     this.response.speak('Hello World How are you!').listen("I am listening sayhello"); 
     this.emit(':responseReady'); 
     //this.emit('SayHello'); 
    }, 
    'AMAZON.HelpIntent': function() { 
     const speechOutput = 'This is the Hello World Sample Skill. '; 
     const reprompt = 'Say hello, to hear me speak.'; 

     this.response.speak(speechOutput).listen(reprompt); 
     this.emit(':responseReady'); 
    }, 
    'AMAZON.CancelIntent': function() { 
     this.response.speak('Goodbye!'); 
     this.emit(':responseReady'); 
    }, 
    'AMAZON.StopIntent': function() { 
     this.response.speak('See you later!'); 
     this.emit(':responseReady'); 
    }, 
    'SessionEndedRequest': function() { 
     console.log("SESSIONENDEDREQUEST"); 
     this.response.speak("SessionEndedRequest. Goodbye!"); 
     this.emit(':responseReady'); 
    }, 
    'Unhandled': function() { 
     console.log("UNHANDLED"); 
     const message = 'Unhandled'; 
     this.response.speak(message).listen(message); 
     this.emit(':responseReady'); 
    } 
}; 
다음

몇 가지 이상한 행동을 관찰 : 아마존 개발자 콘솔에서 알렉사 시뮬레이터에서

은 , "집으로 돌아가는 안녕하세요 세상"으로 스킬을 호출 할 수 없었습니다. 응답은 "죄송합니다. 나는 모릅니다." 하지만 "hello world 시작"으로 스킬을 호출 한 후에 "hello world를 시작하여 집에 가십시오"라는 응답을 받고 "Hello World How are you!"라는 응답을 얻을 수 있습니다.

Echosim.io에서 "hello world 시작"으로 스킬을 호출 할 수 있지만 "집으로 돌아가려면 hello world 시작"으로 호출 할 수는 없습니다. 그것은 "미안해"라고 대답합니다. 또한, 재 (reprompt) 연설은 전혀 사용되지 않습니다.

cloudwatch 로그에서 때로는 "SessionEndedRequest"가 이유 코드 "USER_INITIATED"와 함께 람다 함수로 전송 된 것을 볼 수 있습니다. 나는 "중지, 취소"등을 말하지 않았다. 어떻게 USER_INITIATED SessionEndedRequest가 트리거 되는가? 이것은 재 녹음 된 연설이 결코 실행되지 않는다는 사실과 어떻게 관련이 있습니까?

"집에 가서는"다음과 같은 매핑됩니다 : 나는 문제가 최근에가는 다시 메시지를 얻는 데 많은 게시물을 본

  { 
       "name": "HelloWorldIntent", 
       "samples": [ 
        "hello", 
        "say hello", 
        "who are you", 
        "go home", 
        "hello world" 
       ], 
       "slots": [] 
      } 

답변

0

. 제 생각에는 SDK가 첫 번째 줄에 의도 한대로 응답을 빌드하지 않을 수도 있습니다.

this.response.speak(speechOutput).listen(reprompt); 
this.emit(':responseReady'); 

대신이 줄을 사용해보십시오.

this.emit(':ask', speechOutput, reprompt); 

이것은 귀하의 것과 동일해야합니다.

echosim.io의 문제에 관해서. 적절한 마이크를 사용하여 발언을 녹음합니까? 내 경험으로는, echoism.io는 헤드셋 마이크를 사용하고 있었는데도 내가 말한 것을 식별하는 데 많은 어려움을 겪었습니다.

대신 가능하면 에코 장치를 사용하거나 새로 도입 된 테스트 시뮬레이터 베타를 개발자 콘솔에 사용하는 것이 좋습니다.

+0

어딘가에 echosim.io가 다시 실행되지 않는다는 의견을 보았습니다. –