Получите данные (значения) из облачной базы данных для пользовательских вводов, таких как разговоры в чате - PullRequest
0 голосов
/ 02 апреля 2019

1. Можно ли создать таблицу продаж в базе данных Cloudant.

2.Как получить данные из облачной базы данных, используя nodejs для ввода данных пользователем.

Например, я передаю МОБИЛЬНЫЕ ПРОДАЖИ моему чатботу, затем он будет искать в облачной базе данных и возвращать значение в чатботе. Как это?

Я пытаюсь это ниже код:

function updateMessage(input, response) { 
//var responseText = null;


if (response.intents && response.intents[0]) {
    var intent = response.intents[0];
    if (intent.intent==='Sales-1'){

      //books.get('dc746ec43a56435c6e7a06230acdb8c9',function(err,body){
        //console.log(body);
       //})

        nano.db.use('sample');
        var response= {   "selector": {
  "India": "5,564,546"
 }
}



       response.output.text="This is the modified output:"+" "+ "5,564,546";

    }
}

   return response;      

  if (response.intents && response.intents[0]) {
  var intent = response.intents[0];
 // Depending on the confidence of the response the app can return 
  different
 // messages.
  // The confidence will vary depending on how well the system is 
  trained. 
  The
 // service will always try to assign
// a class/intent to the input. If the confidence is low, then it 
 suggests
// the service is unsure of the
// user's intent . In these cases it is usually best to return a
// disambiguation message
// ('I did not understand your intent, please rephrase your question',
// etc..)

if (intent.confidence >= 0.75) {
  responseText = 'I understood your intent was ' + intent.intent;
} else if (intent.confidence >= 0.5) {
  responseText = 'I think your intent was ' + intent.intent;
} else {
  responseText = 'I did not understand your intent';
 }
}
  response.output.text = responseText;
  return response;
...