lexica-dialog-core
Version:
Core server for Lexica dialog agent.
18 lines • 712 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = require("lodash");
const newIntentMiddleware = async (context, next) => {
const { uni, commands, intentRepository, sessionService } = context;
await Promise.all(commands
.toArray()
.filter(command => lodash_1.isNil(command.intent))
.map(async (command) => {
if (!lodash_1.isNil(command.name)) {
const intent = await intentRepository.findByUniCommandName(uni, command.name);
command.intent = intent == null ? undefined : intent;
}
}));
await next();
};
exports.default = newIntentMiddleware;
//# sourceMappingURL=NewIntentMiddleware.js.map