@cognigy/rest-api-client
Version:
Cognigy REST-Client
115 lines • 3.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PLAY = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
/** Helper Modules */
const play_mapper_1 = require("../mappers/play.mapper");
const design_1 = require("../utils/design");
const setSessionConfig_1 = require("../../voicegateway2/nodes/setSessionConfig");
const fields = (setSessionConfig_1.voiceConfigFields.map(field => {
if (field.key !== "sttDisablePunctuation" &&
field.key !== "sttVadEnabled" &&
field.key !== "sttVadMode" &&
field.key !== "sttVadVoiceMs") {
return field;
}
return null;
})).filter(f => !!f);
exports.PLAY = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "play",
defaultLabel: "Play URL",
tags: [''],
preview: {
key: "url",
type: "text"
},
appearance: {
color: design_1.nodeColor
},
fields: [
{
key: "url",
label: "UI__NODE_EDITOR__PLAY__FIELDS__URL__LABEL",
type: "cognigyText",
description: "UI__NODE_EDITOR__PLAY__FIELDS__URL__DESCRIPTION",
params: {
required: true
},
defaultValue: "https://www2.cs.uic.edu/~i101/SoundFiles/PinkPanther30.wav"
},
{
key: "setActivityParams",
label: "UI__NODE_EDITOR__PLAY__FIELDS__SET_ACTIVITY_PARAMS__LABEL",
type: "toggle",
defaultValue: false
},
...fields
],
sections: [
{
key: "params_stt",
label: "UI__NODE_EDITOR__PLAY__SECTIONS__STT__LABEL",
defaultCollapsed: true,
fields: [
"sttVendor",
"sttHints",
"enableAdvancedSTTConfig",
"azureSttContextId",
"azureEnableAudioLogging",
"googleModel"
],
condition: {
key: "setActivityParams",
value: true
}
},
{
key: "params_bargein",
label: "UI__NODE_EDITOR__PLAY__SECTIONS__BARGEIN__LABEL",
defaultCollapsed: true,
fields: ["bargeInOnSpeech", "bargeInOnDtmf", "bargeInMinWordCount"],
condition: {
key: "setActivityParams",
value: true
}
},
{
key: "params_dtmf",
label: "UI__NODE_EDITOR__PLAY__SECTIONS__DTMF__LABEL",
defaultCollapsed: true,
fields: ["dtmfEnable", "dtmfInterDigitTimeout", "dtmfMaxDigits", "dtmfSubmitDigit"],
condition: {
key: "setActivityParams",
value: true
}
},
],
form: [
{ type: "field", key: "url" },
{ type: "field", key: "setActivityParams" },
{ type: "section", key: "params_stt" },
{ type: "section", key: "params_bargein" },
{ type: "section", key: "params_dtmf" },
],
summary: "UI__NODE_EDITOR__PLAY__SUMMARY",
function: async ({ cognigy, config }) => {
const { api, input } = cognigy;
const { endpointType } = input;
try {
const payload = play_mapper_1.play.handleInput({
endpointType,
config,
api,
});
await api.say(null, {
_cognigy: payload
});
}
catch (error) {
throw new Error(`Error on play node. Error message: ${error.message}`);
}
;
}
});
//# sourceMappingURL=play.js.map