@cognigy/rest-api-client
Version:
Cognigy REST-Client
46 lines • 1.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ENABLE_SLOT_FILLERS = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
/**
* Node name: 'enableSlotFillers'
*
* Purpose:
* Enables slot fillers
*/
exports.ENABLE_SLOT_FILLERS = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "enableSlotFillers",
defaultLabel: "Enable Slot Fillers",
summary: "UI__NODE_EDITOR__ENABLE_SLOT_FILLERS__SUMMARY",
appearance: {
showIcon: false
},
fields: [
{
key: "slotFillersToEnable",
type: "slotFillerArray",
label: "UI__NODE_EDITOR__ENABLE_SLOT_FILLERS__SLOT_FILLERS_TO_ENABLE__LABEL",
description: "UI__NODE_EDITOR__ENABLE_SLOT_FILLERS__SLOT_FILLERS_TO_ENABLE__DESCRIPTION"
}
],
tags: ["ai", "nlu"],
function: async ({ cognigy, config }) => {
const { slotFillersToEnable } = config;
const { api, flowReferenceId } = cognigy;
let slotFillers = api.getSystemContext("slotFillers");
if (slotFillers && slotFillers[flowReferenceId]) {
const flowSlotFillerSet = new Set(slotFillers[flowReferenceId]);
slotFillersToEnable.forEach((value) => { flowSlotFillerSet.add(value); });
slotFillers[flowReferenceId] = [...flowSlotFillerSet];
}
else {
if (slotFillers === undefined) {
slotFillers = {};
}
slotFillers[flowReferenceId] = slotFillersToEnable;
}
api.setSystemContext("slotFillers", slotFillers);
}
});
//# sourceMappingURL=enableSlotFillers.js.map