UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

44 lines 1.62 kB
import { __awaiter } from "tslib"; /* Custom modules */ import { createNodeDescriptor } from "../../createNodeDescriptor"; /** * Node name: 'enableSlotFillers' * * Purpose: * Enables slot fillers */ export const ENABLE_SLOT_FILLERS = 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: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () { 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