recime-bot-runtime
Version:
This runtime is intended to run inside a micro-service container with platform specific integration and module interpreter.
32 lines (31 loc) • 916 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var request = require("request");
var Rasa = /** @class */ (function () {
function Rasa(bot) {
this.bot = bot;
}
Rasa.prototype.process = function (payload) {
var _this = this;
return new Promise(function (resolve, reject) {
request({
uri: "https://nlu.smartloop.ai/parse/" + _this.bot.id,
method: 'POST',
qs: {
model: _this.bot.meta.model
},
body: {
q: (payload.text || "").toLowerCase()
},
json: true
}, function (err, response, body) {
if (err) {
reject(err);
}
resolve(body);
});
});
};
return Rasa;
}());
exports.Rasa = Rasa;