예
exports.handler = (event, context) =>
{
// if the session is old,
if (event.session.new === false) {
// get the user reply
// this doesn't seem to allways work
var userReply = event.request.intent.slots.Reply.value;
}
try {
switch (event.request.type) {
case "LaunchRequest":
// do nothing here
break;
case "IntentRequest":
switch (event.request.intent.name) {
case "ChatSession":
// the chat session starts, when I say: Alexa, open MyApp and start chat.
// this works, and the session seems to remain open, because Alexa waits for me to say something else
alexaReplyes({noCard: true, noNewSession: true, reply: 'New chat session started'});
break;
default:
throw "Invalid intent"
}
break;
case "SessionEndedRequest":
// do nothing here
break;
default:
context.fail(`INVALID REQUEST TYPE`)
}
} catch (error) {
context.fail(`Exception: ${error}`)
}
}
{
"intents": [
{
"intent": "ChatSession",
"slots": [
{
"name": "Reply",
"type": "REPLIES"
}
]
}
]
}
ChatSession start chat
, 의도 설정이 올바르지 않습니다. 몇 항목 : 그것은 당신이 사용자가 말을 기대하는 방법에 대한 더 많은 발언을 추가 나을)
ChatSession start chat {Reply}
2 :
1)이 같은 발언에 슬롯을 포함해야 예 :
ChatSession Yes {Reply}
희망 하시겠습니까?
사용자가 기술을 시작한 후에 무엇을 기대합니까? 그리고 요청과 응답을 앞뒤로 볼 수있는 솔루션을 찾고 있습니까? –
@JohnKelvie 꽤 많이 있습니다. 사용자 응답을 일부 백엔드 서비스에 보내고 회신을 반환 한 다음 다른 사용자 입력을 기다리고 대화처럼 기다립니다. 제 문제는 초기 사용자가 응답하지 않는다는 것입니다. – Patrioticcow