AWS Lex - Custom Payload - PullRequest
       39

AWS Lex - Custom Payload

0 голосов
/ 28 апреля 2020

Я пытаюсь отправить пользователю форму с флажками, чтобы пользователь мог выбрать максимум два значения. В этом случае я пытаюсь вычислить от пользователя, каковы его 2 наиболее распространенных вида транспорта. Не могли бы вы посоветовать, как это сделать?

текущий код

  if (slots.TransportMode === null) {
      console.log('transport mode slot');

      let slotToElicit = 'TransportMode';
      let message = {
        contentType: "CustomPayload",
        content: "<div class='transport-mode'><p><strong>What are the 2 most common transport modes that you use?</strong></p><input class='single-checkbox' type='checkbox' name='Motorbike' value='Motorbike'>Motorbike<br><input class='single-checkbox' type='checkbox' name='Car' value='Car'>Car<br><input class='single-checkbox' type='checkbox' name='Bus' value='Bus'>Bus<br><input class='single-checkbox' type='checkbox' name='Train' value='Train'>Train<br></div>"
      };

      callback(lexResponses.ElicitSlot(intentRequest.sessionAttributes, intentRequest.currentIntent.name, slots, slotToElicit, message));
      return;

    }

функция явного слота

module.exports.ElicitSlot = function(sessionAttributes, intentName, slots, slotToElicit, message) {
  return {
    sessionAttributes,
    dialogAction: {
      type: 'ElicitSlot',
      intentName,
      slots,
      slotToElicit,
      message,
    },
  };
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...