Это код модели взаимодействия:
{
"interactionModel": {
"languageModel": {
"invocationName": "teach me",
"intents": [
{
"name": "AnswerIntent",
"slots": [
{
"name": "Answer",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"die Antwort ist {Answer}",
"meine Antwort ist {Answer}",
"ist die Antwort {Answer}",
"{Answer} ist meine Antwort",
"{Answer}"
]
},
{
"name": "DontKnowIntent",
"slots": [],
"samples": [
"weiß ich nicht",
"weiß nicht",
"überspringen",
"das weiß ich nicht",
"wer weiß",
"diese Frage weiß ich nicht",
"die weiß ich nicht",
"keine Ahnung"
]
},
{
"name": "AMAZON.StartOverIntent",
"samples": [
"Spiel starten",
"neues Spiel",
"starten",
"neues Spiel starten"
]
},
{
"name": "AMAZON.RepeatIntent",
"samples": [
"bitte wiederholen",
"noch einmal",
"wiederholen"
]
},
{
"name": "AMAZON.HelpIntent",
"samples": [
"Ich brauche Hilfe",
"Hilfe"
]
},
{
"name": "AMAZON.YesIntent",
"samples": []
},
{
"name": "AMAZON.NoIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
}
],
"types": []
}
}
}
И я думаю, что проблема в бэкэнде может быть в следующей части кода:
function isAnswerSlotValid(intent) {
const answerSlotFilled = intent
&& intent.slots
&& intent.slots.Answer
&& intent.slots.Answer.value;
const answerSlotIsInt = answerSlotFilled
&& !Number.isNaN(parseInt(intent.slots.Answer.value, 10));
return answerSlotIsInt
&& parseInt(intent.slots.Answer.value, 10) < (ANSWER_COUNT + 1)
&& parseInt(intent.slots.Answer.value, 10) > 0;
}
function handleUserGuess(userGaveUp, handlerInput) {
const { requestEnvelope, attributesManager, responseBuilder } = handlerInput;
const { intent } = requestEnvelope.request;
const answerSlotValid = isAnswerSlotValid(intent);
let speechOutput = '';
let speechOutputAnalysis = '';
let aplFirstPageSpeechOutput = '';
let aplSecondPageSpeechOutput = '';
const sessionAttributes = attributesManager.getSessionAttributes();
const gameQuestions = sessionAttributes.questions;
let correctAnswerIndex = parseInt(sessionAttributes.correctAnswerIndex, 10);
let currentScore = parseInt(sessionAttributes.score, 10);
let currentQuestionIndex = parseInt(sessionAttributes.currentQuestionIndex, 10);
const { correctAnswerText } = sessionAttributes;
const requestAttributes = attributesManager.getRequestAttributes();
const translatedQuestions = requestAttributes.t('QUESTIONS');
if (answerSlotValid
&& parseInt(intent.slots.Answer.value, 10) ===
sessionAttributes.correctAnswerIndex) {
currentScore += 1;
speechOutputAnalysis = requestAttributes.t('ANSWER_CORRECT_MESSAGE');
} else {
if (!userGaveUp) {
speechOutputAnalysis = requestAttributes.t('ANSWER_WRONG_MESSAGE');
}
speechOutputAnalysis += requestAttributes.t(
'CORRECT_ANSWER_MESSAGE',
correctAnswerIndex,
correctAnswerText
);
}
Если вам нужно больше кода логики бэкэнда c, дайте мне знать Спасибо за вашу помощь:)