Make chatbot (wit.ai) reply that it doesn't have a proper answer

假装没事ソ 提交于 2019-12-05 13:03:40

Right now the best way to deal with this problem is to create one or more stories with out-of-scope requests, and add a "catchall" entity with strategy "trait" to the user message (more details here).

In the simplest case, your "catchall" entity will have a single value. You could have several values, for example if you want different kind of answers for different kind of out-of-scope requests, but keep in mind that the more complex your bot is, the more stories and data you will need to have to make it working correctly.

We are also working on a more elegant solution. Stay tuned here: https://github.com/wit-ai/wit

A simple solution is to create a story without intent, with the bot answering something like "I don't understand"

This story will be started when no other intent is relevant. It works pretty well according to our experience.

You can create some function to handle intent of the user-input message.

   function handleIntent(intent, sender) {
  switch(intent) {
    case "jokes":
       //Do Something
      break;
    case "greeting":
       //Do Something
      break;
    case "identification":
       //Do Something
      break;
    case "movie": 
       //Do Something
      break;
    default: // Any other intensions go here..
      sendTextMessage(sender, "I couldn't understand that one :(")
      break;

  }
}

Hope the idea helps! :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!