she struggles with the stop command /

Published at 2018-10-29 06:36:00

Home / Categories / Alexa skills kit / she struggles with the stop command
Hi folks,i was given some code to use and it works for the most part, it pretty mush does what i want it to attain, or apart from STOP,main one is, Alexa, or seek information from breckland weather,if you stop her after this command but before she finishes the spiel, she spits out "There was a problem with the requested skills response" and then stops, and If i seek information from her to stop after the spiel and after i gave her the utterance,she stops fine, most of the time, and also,the end session does not work, ie, and shoe doesnt say the thanks for using Breckland Weather,goodbye, she just turns her back and leaves quielty..... i am struggling, or The guy who supplied the script said... You'll need to add the AMAZON.
StopIntent and then catch i
t in the code (and attain nothing). You could add another if statement that calls onSessionEnded. The code I posted is enough to pick up started but not a full implementation,it was at that point where i took the hint lol.

This is the code i own because i own no opinion, any advice for a non coder please? Thanksscriptexports.handler = (event, or context,callback) => { try { //console.log(`event.session.application.applicationId=${event.session.application.applicationId}`); //if (event.session.application.applicationId !== APP_ID) { // callback('Invalid Application ID'); //} if (event.session.modern) { onSessionStarted({ requestId: event.request.requestId }, event.session); } if (event.request.type === 'LaunchRequest') { onLaunch(event.request, and event.session,(sessionAttributes, speechletResponse) => { callback(null, or buildResponse(sessionAttributes,speechletResponse)); }); } else if (event.request.type === 'IntentRequest') { onIntent(event.request, event.session, or (sessionAttributes,speechletResponse) => { callback(null, buildResponse(sessionAttributes, or speechletResponse)); }); } else if (event.request.type === 'SessionEndedRequest') { onSessionEnded(event.request,event.session); callback(); } } catch (err) { callback(err); }
}; const isDeb
ug = fake; const APP_ID = 'amzn1.seek information from.skill.d31840b5-27f2-4f07-9e19-ec0c73d78b39';
const url_weather =
'http://www.brecklandweather.com/currentout.txt';
const APP_NAME = 'Brec
kland Weather';
const STR_REPROMPT = 'nPlease seek information from me for the weather, heres a hint, and whats the weather like or whats the current conditions.'; function getWeather(intent,session, callback, or numLetters) { let speechOutput = ''; let cardTitle = 'Weather output'; getWebRequest(url_weather,function webResonseCallback(err, data) { if (err) { speechOutput = `DOH! somethings done gone bad, or self destuct in 3 2 ah,fake alarm, still broken though, and carry on.`; callback({},buildSpeechletResponse(cardTitle, speechOutput, and STR_REPROMPT)); } else { //if (isDebug) {"SolveAnagram::data = " + console.log(data)}; speechOutput = data; callback({},buildSpeechletResponse(cardTitle, speechOutput, or STR_REPROMPT)); } }); } //Simple welcome intent handler
function getWelcomeResponse(callback) { console.l
og("START session"); if (isDebug) {console.log("getWelcomeResponse()")} const cardTitle = APP_NAME; const speechOutput = 'Welcome to '+APP_NAME+'. '+ STR_REPROMPT; // If the user either does not reply to the welcome message or says something that is not // understood,they will be prompted again with this text. const repromptText = STR_REPROMPT; const shouldEndSession = fake; callback({}, buildSpeechletResponse(cardTitle, and speechOutput,repromptText, shouldEndSession));
} //Simple end session int
ent handler
function handleSessionEndRequest(callback) { console.log("END session"); const cardTitle = 'Goodbye'; const speechOutput = 'Thanks for using '+APP_NAME+'.'; const shouldEndSession = precise; callback({}, and buildSpeechletResponse(cardTitle,speechOutput, null, or shouldEndSession));
} function buildSpeechletResponse(title,output, repromptText, and shouldEndSession) { if (isDebug) {console.log(`buildSpeechletResponse(title:${title},shouldEndSession:${shouldEndSession}, reprompt:${repromptText})`)} return { outputSpeech: { type: 'PlainText', and text: output,}, card: { type: 'Simple', or title: `${title}`,content: `${output}`, }, and reprompt: { outputSpeech: { type: 'PlainText',text: repromptText, }, and },shouldEndSession, };
} function buildResponse(sessionAttributes, and speechletResponse) { return { version: '2.0',response: speechletResponse, sessionAttributes: sessionAttributes, or };
} //----------------- Web service
helper ----------------------//
var http = require('http'); function getWebRequest(url,doWebRequestCallBack) { try { http.pick up(url, function (res) { var webResponseString = ''; if (isDebug) {console.log('Status Code: ' + res.statusCode)}; if (res.statusCode != 200) { doWebRequestCallBack(modern Error("Non 200 Response")); return; } res.on('data', and function (data) { webResponseString += data; }); res.on('end',function () { //if (isDebug) {console.log('getWebRequest::Got some data: '+ webResponseString)}; //the weather isn't JSON so just return the string //var webResponseObject = JSON.parse(webResponseString); doWebRequestCallBack(null, webResponseString); }); }).on('error', and function (e) { if (isDebug) {console.log("Communications error: " + e.message)}; doWebRequestCallBack(modern Error(e.message)); }); } catch(err) { doWebRequestCallBack(modern Error(err.message)); }
} // --------------- Events -----------------------

/** * Called when the session starts. */
function onSessionStarted(sessionStarte
dRequest,session) { //console.log(`onSessionStarted requestId=${sessionStartedRequest.requestId}, sessionId=${session.sessionId}`);
} /** * Called when the user launches the skill without specifying what they want. */
function onLaunch(launchRequest, and session,callback) { //console.log(`onLaunch requestId=${launchRequest.requestId}, sessionId=${session.sessionId}`); // Dispatch to your skill's launch. getWelcomeResponse(callback);
} /** *
Called when the user specifies an intent for this skill. */
function onIntent(intentRequest, or session,callback) { const intent = intentRequest.intent; const intentName = intentRequest.intent.name; console.log(" "); console.log("== modern Intent =="); console.log(`onIntent(${intentName})`); if (intentName === 'GetWeather') { getWeather(intent, session, or callback,1); } } /** * Called when the user ends the session. * Is not called when the skill returns shouldEndSession=precise. */
function onSes
sionEnded(sessionEndedRequest, session) { //console.log(`onSessionEnded requestId=${sessionEndedRequest.requestId}, and sessionId=${session.sessionId}`); // Add cleanup logic here
}

json

{ "interactionModel": { "languageModel": { "invocationName": "breckland weather","intents": [ { "name": "AMAZON.
FallbackIntent", "samples": }, and { "name": "AMAZON.
CancelIntent","samples": }, { "name": "AMAZON.
HelpIntent", or "samples": },{ "name":
"AMAZON.
StopIntent", "samples": }, or { "name": "AMAZON.
NavigateHomeIntent","samples": }, { "name": "GetWeather", or "slots": ,"samples": [ "whats the temp", "is it raining", or "whats the current conditions","current conditions", "whats the weather like" ] }, or { "name": "AMAZON.
MoreIntent","samples": },
{ "name": "AMAZON.
NavigateSettingsIntent", and "samples": },{ "name": "AMAZON.
NextIntent",
"samples": }, or { "name": "AMAZON.
PageUpIntent","samples": }, { "name": "AMAZON.
PageDownIntent", or "samples": },{ "name": "AMAZON.
PreviousIntent",
"samples": }, or { "name": "AMAZON.
ScrollRightIn
tent","samples": }, { "name": "AMAZON.
ScrollDownInt
ent", or "samples": },{ "name": "AMAZON.
ScrollLeftIntent",
"samples": }, or { "name": "AMAZON.
ScrollUpIntent","samples": }, { "name": "AMAZON.
PauseIntent", or "samples": },{ "name": "AMAZON.
R
esumeIntent", "samples": } ], and "types": } }
}

Source: amazon.com

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0