mirror of
https://github.com/openfaas/faas.git
synced 2025-06-19 20:46:41 +00:00
Remove debug from node sample
This commit is contained in:
@ -11,21 +11,25 @@ getStdin().then(content => {
|
|||||||
handle(request, request.request.intent);
|
handle(request, request.request.intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
function tellWithCard(speechOutput) {
|
function tellWithCard(speechOutput, request) {
|
||||||
console.log(sample)
|
// console.log(sample)
|
||||||
sample.response.outputSpeech.text = speechOutput
|
sample.response.session = request.session;
|
||||||
sample.response.card.content = speechOutput
|
sample.response.outputSpeech.text = speechOutput;
|
||||||
|
sample.response.card.content = speechOutput;
|
||||||
sample.response.card.title = "Office Lights";
|
sample.response.card.title = "Office Lights";
|
||||||
|
|
||||||
console.log(JSON.stringify(sample));
|
console.log(JSON.stringify(sample));
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle(request, intent) {
|
function handle(request, intent) {
|
||||||
|
// console.log("Intent: " + intent.name);
|
||||||
|
|
||||||
if(intent.name == "TurnOffIntent") {
|
if(intent.name == "TurnOffIntent") {
|
||||||
let req = {r:0,g:0,b:0};
|
let req = {r:0,g:0,b:0};
|
||||||
var speechOutput = "Lights off.";
|
var speechOutput = "Lights off.";
|
||||||
sendColor.sendColor(req, () => {
|
sendColor.sendColor(req, () => {
|
||||||
return tellWithCard(speechOutput);
|
return tellWithCard(speechOutput, request);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let colorRequested = intent.slots.LedColor.value;
|
let colorRequested = intent.slots.LedColor.value;
|
||||||
@ -38,11 +42,13 @@ function handle(request, intent) {
|
|||||||
req.g = 255;
|
req.g = 255;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return tellWithCard("I heard "+colorRequested+ " but can only do: red, green, blue.", "I heard "+colorRequested+ " but can only do: red, green, blue.");
|
return tellWithCard("I heard "+colorRequested+
|
||||||
|
" but can only do: red, green, blue.",
|
||||||
|
"I heard "+colorRequested+ " but can only do: red, green, blue.", request);
|
||||||
}
|
}
|
||||||
sendColor.sendColor(req, () => {
|
sendColor.sendColor(req, () => {
|
||||||
var speechOutput = "OK, " + colorRequested + ".";
|
var speechOutput = "OK, " + colorRequested + ".";
|
||||||
return tellWithCard(speechOutput);
|
return tellWithCard(speechOutput, request);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user