Open lbustelo opened 7 years ago
There has been an update that fixes it. But I think the package is not update in npm. I installed it using npm today and I get the older version where wit.hear method handles for the old API response.
The code on git however is updated and works as it should.
Update: This is how I got it to work. Taking a look at the message returned from the API, I saw it was kind of weird. This is a very hacky fix but this is giving me the expected behavior.
middleware.hears = function(tests, message) { //console.log(message); obj = message.intents[0].entities var count = Object.keys(obj).length; if (count != 0) { for (var i = 0; i < message.intents[0].entities.intent.length; i++) { for (var t = 0; t < tests.length; t++) { if (message.intents[0].entities.intent[0].value == tests[t] && message.intents[0].entities.intent[0].confidence >= config.minimum_confidence) { return true; } } } } return false; };
I think this may be related: https://github.com/wit-ai/node-wit#changing-the-api-version
On 2016, May 11th, the /message API was updated to reflect the new Bot Engine model: intent are now entities. We updated the SDK to the latest version: 20160516. You can target a specific version by passing the apiVersion parameter when creating the Wit object.
Getting "WARNING":"DEPRECATED" in the returned payload. I can see my intent in the
intent
array, but not on the top object underoutcomes
.