UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

343 lines 11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SESSION_SPEECH_PARAMETERS = exports.voiceConfigFields = 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 vgConstants_1 = require("../utils/vgConstants"); const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode"); exports.voiceConfigFields = [ { key: "sttHints", type: "textArray", label: "UI__NODE_EDITOR__STT_HINTS__LABEL", description: "UI__NODE_EDITOR__STT_HINTS__DESCRIPTION", defaultValue: [""], condition: { or: [ { key: "sttVendor", value: "microsoft", }, { key: "sttVendor", value: "google", }, { key: "sttVendor", value: "aws", }, { key: "sttVendor", value: "soniox" } ] } }, { key: "sttHintsDynamicHints", type: "cognigyText", label: "UI__NODE_EDITOR__STT_HINTS_DYNAMIC_HINTS__LABEL", description: "UI__NODE_EDITOR__STT_HINTS_DYNAMIC_HINTS__DESCRIPTION", defaultValue: "", condition: { or: [ { key: "sttVendor", value: "microsoft", }, { key: "sttVendor", value: "google", }, { key: "sttVendor", value: "aws", }, { key: "sttVendor", value: "soniox" } ] } }, { key: "sttDisablePunctuation", type: "toggle", label: "UI__NODE_EDITOR__STT_DISABLE_PUNCTUATION__LABEL", description: "UI__NODE_EDITOR__STT_DISABLE_PUNCTUATION__DESCRIPTION", defaultValue: false, condition: { or: [ { key: "sttVendor", value: "google", }, { key: "sttVendor", value: "deepgram", }, ] } }, { key: "deepgramEndpointing", type: "toggle", label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING__LABEL", description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING__DESCRIPTION", defaultValue: true, condition: { key: "sttVendor", value: "deepgram" } }, { key: "deepgramEndpointingValue", type: "number", label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING_TIME__LABEL", description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_ENDPOINTING_TIME__DESCRIPTION", defaultValue: 250, params: { min: 10, max: 1000 }, condition: { and: [ { key: "sttVendor", value: "deepgram" }, { key: "deepgramEndpointing", value: true }, ] } }, { key: "deepgramSmartFormatting", type: "toggle", label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_SMART_FORMATTING__LABEL", description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__DEEPGRAM_SMART_FORMATTING__DESCRIPTION", defaultValue: false, condition: { key: "sttVendor", value: "deepgram" } }, { key: "enableAdvancedSTTConfig", type: "toggle", label: "UI__NODE_EDITOR__ENABLE_ADVANCED_STT_CONFIG__LABEL", description: "UI__NODE_EDITOR__ENABLE_ADVANCED_STT_CONFIG__DESCRIPTION", defaultValue: false, condition: { key: "sttVendor", value: "microsoft" } }, { key: "azureSttContextId", type: "cognigyText", label: "UI__NODE_EDITOR__AZURE_STT_CONTEXT_ID__LABEL", description: "UI__NODE_EDITOR__AZURE_STT_CONTEXT_ID__DESCRIPTION", defaultValue: "", condition: { and: [ { key: "enableAdvancedSTTConfig", value: true }, { key: "sttVendor", value: "microsoft" } ] } }, { key: "azureEnableAudioLogging", type: "toggle", label: "UI__NODE_EDITOR__AZURE_ENABLE_AUDIO_LOGGING__LABEL", description: "UI__NODE_EDITOR__AZURE_ENABLE_AUDIO_LOGGING__DESCRIPTION", defaultValue: false, condition: { and: [ { key: "enableAdvancedSTTConfig", value: true }, { key: "sttVendor", value: "microsoft" } ] } }, { key: "googleModel", type: "select", label: "UI__NODE_EDITOR__GOOGLE_MODEL__LABEL", description: "UI__NODE_EDITOR__GOOGLE_MODEL__DESCRIPTION", defaultValue: vgConstants_1.GoogleSpeechModel.LatestShort, condition: { key: "sttVendor", value: "google" }, params: { options: [ { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__LATEST_SHORT__LABEL", value: vgConstants_1.GoogleSpeechModel.LatestShort, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__LATEST_LONG__LABEL", value: vgConstants_1.GoogleSpeechModel.LatestLong, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__COMMAND_AND_SEARCH__LABEL", value: vgConstants_1.GoogleSpeechModel.CommandAndSearch, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__PHONE_CALL__LABEL", value: vgConstants_1.GoogleSpeechModel.PhoneCall, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__VIDEO__LABEL", value: vgConstants_1.GoogleSpeechModel.Video, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__MEDICAL_DICTATION__LABEL", value: vgConstants_1.GoogleSpeechModel.MedicalDictation, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__MEDICAL_CONVERSATION__LABEL", value: vgConstants_1.GoogleSpeechModel.MedicalConversation, }, { label: "UI__NODE_EDITOR__GOOGLE_MODEL__OPTIONS__DEFAULT__LABEL", value: vgConstants_1.GoogleSpeechModel.Default, }, ], }, }, { key: "ttsVendor", type: "ttsSelect", label: "_unused_", description: "_unused_", defaultValue: "", params: { modelKey: "config.ttsModel", languageKey: "config.ttsLanguage", voiceKey: "config.ttsVoice" } }, { key: "ttsModel", type: "ttsSelect", label: "_unused_", description: "_unused_", defaultValue: "", }, { key: "ttsVoice", type: "ttsSelect", label: "_unused_", description: "_unused_", defaultValue: "", }, { key: "ttsLanguage", type: "ttsSelect", label: "_unused_", description: "_unused_", defaultValue: "", }, { key: "sttVendor", type: "sttSelect", label: "_unused_", description: "_unused_", defaultValue: "", params: { languageKey: "config.sttLanguage", modelKey: "config.sttDeepgramModel", } }, { key: "sttLanguage", type: "sttSelect", label: "_unused_", description: "_unused_", defaultValue: "", }, { key: "sttDeepgramModel", type: "sttSelect", label: "_unused_", description: "_unused_", defaultValue: "", condition: { key: "sttVendor", value: "deepgram" } }, ]; exports.SESSION_SPEECH_PARAMETERS = (0, createNodeDescriptor_1.createNodeDescriptor)({ type: "sessionSpeechParameters", defaultLabel: "Session Speech Parameters - Config", summary: "UI__NODE_EDITOR__SESSION_SPEECH_PARAMETERS__SUMMARY", appearance: { color: design_1.nodeColor, }, tags: [""], fields: exports.voiceConfigFields, sections: [ { key: "params_stt", label: "UI__NODE_EDITOR__SESSION_SPEECH_PARAMETERS__SECTIONS__PARAMS_STT__LABEL", defaultCollapsed: true, fields: [ "sttVendor", "deepgramEndpointing", "deepgramEndpointingValue", "deepgramSmartFormatting", "sttHints", "sttHintsDynamicHints", "googleModel", "sttDisablePunctuation", "enableAdvancedSTTConfig", "azureSttContextId", "azureEnableAudioLogging" ], }, { key: "params_tts", label: "UI__NODE_EDITOR__SESSION_SPEECH_PARAMETERS__SECTIONS__PARAMS_TTS__LABEL", defaultCollapsed: true, fields: ["ttsVendor"], }, ], form: [ { type: "section", key: "params_tts" }, { type: "section", key: "params_stt" }, ], function: async ({ cognigy, config }) => { const { api, input } = cognigy; const { endpointType } = input; try { const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_1.voiceConfigParamsToVoiceSettings)(config, api)); await api.say(null, { _cognigy: payload, }); (0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, config); } catch (error) { throw new Error(`Error on Session Speech Parameters node. Error message: ${error.message}`); } }, }); //# sourceMappingURL=sessionSpeechParameters.js.map