@cognigy/rest-api-client
Version:
Cognigy REST-Client
73 lines • 2.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CONTINUOUS_ASR = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
/** Helper Modules */
const setSessionConfig_mapper_1 = require("../mappers/setSessionConfig.mapper");
const design_1 = require("../utils/design");
const setSessionConfig_mapper_2 = require("../mappers/setSessionConfig.mapper");
const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode");
exports.CONTINUOUS_ASR = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "continuousASR",
defaultLabel: "Continuous ASR - Config",
tags: [""],
appearance: {
color: design_1.nodeColor,
},
summary: "UI__NODE_EDITOR__CONTINUOUS_ASR__SUMMARY",
fields: [
{
key: "asrEnabled",
type: "toggle",
label: "UI__NODE_EDITOR__CONTINUOUS_ASR__FIELDS__ASR_ENABLED__LABEL",
description: "UI__NODE_EDITOR__CONTINUOUS_ASR__FIELDS__ASR_ENABLED__DESCRIPTION",
defaultValue: false,
},
{
key: "asrDigit",
type: "cognigyText",
label: "UI__NODE_EDITOR__CONTINUOUS_ASR__FIELDS__ASR_DIGIT__LABEL",
description: "UI__NODE_EDITOR__CONTINUOUS_ASR__FIELDS__ASR_DIGIT__DESCRIPTION",
defaultValue: "#",
condition: {
key: "asrEnabled",
value: true,
},
params: {
type: "string",
minLength: 1,
maxLength: 1,
},
},
{
key: "asrTimeout",
type: "number",
label: "UI__NODE_EDITOR__CONTINUOUS_ASR__FIELDS__ASR_TIMEOUT__LABEL",
description: "UI__NODE_EDITOR__CONTINUOUS_ASR__FIELDS__ASR_TIMEOUT__DESCRIPTION",
defaultValue: 3000,
params: {
min: 2000
},
condition: {
key: "asrEnabled",
value: true,
},
},
],
function: async ({ cognigy, config }) => {
const { api, input } = cognigy;
const { endpointType } = input;
try {
const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(config, api));
await api.say(null, {
_cognigy: payload,
});
(0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, config);
}
catch (error) {
throw new Error(`Error on Continuous ASR node. Error message: ${error.message}`);
}
},
});
//# sourceMappingURL=continuousAsr.js.map