Виды Caraousel для диалогового потока через node.js - PullRequest
0 голосов
/ 18 апреля 2019

Я использую диалоговый поток и интегрирую бот диалогового потока в приложения andriod и ios, и я не собираюсь использовать действия на google.But, как получить представление караул для их отображения и тестирование iam через консоль диалогового потока и iam не получаю вывод. Вот мой основной код.

 const agent = new WebhookClient({request: req, response: res});
 function welcome(agent) {
    agent.add('Welcome to the LTA Find Bus!');
    agent.add('I can help you to find the suitable bus stop, bus service, and arriving time. Where are you want to go?');
    agent.add(new Suggestion('Bedok'));
     agent.add(new Suggestion('Cancel'));
        }
  function getDestination(agent) {
              // Get parameters from Dialogflow to convert
  const Destination = req.body.queryResult.parameters.hello;;

           let conv=agent.conv();
         conv.ask(`User would like to go to ${Destination}. `);
         conv.ask('Please choose an bus stop:');
         conv.ask(new List({
          title: 'List of Bus Stops',
          items: {
          // Add the first item to the list
          '1': {
           title: 'Opp Our Tampines Hub - 76059',
             },
           // Add the second item to the list
           '2': {
            title: 'Blk 945 - 76111',
            }}}));

            agent.setContext({
               name: 'Destination',
               lifespan: 5,
               parameters:{Destination: Destination}
                `});
               agent.add(conv);}`

});
}
   let intentMap = new Map(); // Map functions to Dialogflow intent 
   names
      intentMap.set('Default Welcome Intent', welcome);
      intentMap.set('Goods', getDestination);
     // intentMap.set('actions.intent.OPTION', getOption);
      agent.handleRequest(intentMap);

Здесь я получаю сообщение об ошибке как «Ошибка типа: невозможно прочитать свойство 'ask' of null" Пожалуйста, помогите мне, Thnx

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...