@cognigy/rest-api-client 4.95.0 → 4.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/apigroups/ManagementAPIGroup_2_0.js +2 -1
- package/build/apigroups/ResourcesAPIGroup_2_0.js +9 -0
- package/build/authentication/AuthenticationAPI.js +6 -1
- package/build/authentication/JWT/IJwtTokenAuthentication.js +3 -0
- package/build/authentication/JWT/JwtTokenAuthentication.js +22 -0
- package/build/shared/charts/descriptors/allFields.js +6 -0
- package/build/shared/charts/descriptors/analytics/addMemory.js +1 -1
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +6 -2
- package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAICompatibleProviderConnection.js +11 -0
- package/build/shared/charts/descriptors/connectionNodes/speechProviders/deepgramSpeechProviderConnection.js +11 -0
- package/build/shared/charts/descriptors/connectionNodes/speechProviders/index.js +2 -0
- package/build/shared/charts/descriptors/index.js +6 -0
- package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +13 -1
- package/build/shared/charts/descriptors/message/question/question.js +21 -13
- package/build/shared/charts/descriptors/message/say.js +25 -2
- package/build/shared/charts/descriptors/service/GPTPrompt.js +10 -2
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +184 -51
- package/build/shared/charts/descriptors/service/checkAgentAvailability.js +63 -3
- package/build/shared/charts/descriptors/service/handoverConnections.js +51 -0
- package/build/shared/charts/descriptors/service/handoverV2.js +124 -64
- package/build/shared/charts/descriptors/service/index.js +8 -1
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -1
- package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/dtmf.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/hangup.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/noUserInput.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/play.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/sendMetadata.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/transfer.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/record.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +47 -2
- package/build/shared/constants.js +10 -1
- package/build/shared/helper/nlu/textCleaner.js +10 -2
- package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +3 -0
- package/build/shared/interfaces/handover.js +74 -10
- package/build/shared/interfaces/handoverProviders.js +23 -0
- package/build/shared/interfaces/messageAPI/endpoints.js +2 -0
- package/build/shared/interfaces/messageAPI/handover.js +25 -5
- package/build/shared/interfaces/resources/IAiAgent.js +10 -0
- package/build/shared/interfaces/resources/IExternalModel.js +3 -0
- package/build/shared/interfaces/resources/IHandoverProvider.js +3 -0
- package/build/shared/interfaces/resources/ILargeLanguageModel.js +13 -2
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +9 -5
- package/build/shared/interfaces/resources/TResourceType.js +6 -0
- package/build/shared/interfaces/resources/intent/IDefaultReply.js +0 -1
- package/build/shared/interfaces/resources/settings/IAudioPreviewSettings.js +8 -2
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/ICreateHandoverProviderRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IDeleteHandoverProviderRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IHandoverProvider_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IHandoverService_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IIndexHandoverProvidersRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IIndexHandoverServicesRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IReadHandoverProviderRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IUpdateHandoverProviderRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/handoverProvider/v2.0/index.js +3 -0
- package/build/shared/interfaces/security/IPermission.js +2 -0
- package/build/shared/interfaces/security/IRole.js +2 -0
- package/build/shared/interfaces/security/index.js +1 -1
- package/dist/esm/apigroups/ManagementAPIGroup_2_0.js +2 -1
- package/dist/esm/apigroups/ResourcesAPIGroup_2_0.js +9 -0
- package/dist/esm/authentication/AuthenticationAPI.js +6 -1
- package/dist/esm/authentication/JWT/IJwtTokenAuthentication.js +2 -0
- package/dist/esm/authentication/JWT/JwtTokenAuthentication.js +21 -0
- package/dist/esm/shared/charts/descriptors/allFields.js +6 -0
- package/dist/esm/shared/charts/descriptors/analytics/addMemory.js +1 -1
- package/dist/esm/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +4 -1
- package/dist/esm/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAICompatibleProviderConnection.js +8 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/speechProviders/deepgramSpeechProviderConnection.js +8 -0
- package/dist/esm/shared/charts/descriptors/connectionNodes/speechProviders/index.js +2 -0
- package/dist/esm/shared/charts/descriptors/index.js +7 -1
- package/dist/esm/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +13 -1
- package/dist/esm/shared/charts/descriptors/message/question/question.js +21 -13
- package/dist/esm/shared/charts/descriptors/message/say.js +25 -2
- package/dist/esm/shared/charts/descriptors/service/GPTPrompt.js +10 -2
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +184 -51
- package/dist/esm/shared/charts/descriptors/service/checkAgentAvailability.js +63 -3
- package/dist/esm/shared/charts/descriptors/service/handoverConnections.js +48 -0
- package/dist/esm/shared/charts/descriptors/service/handoverV2.js +124 -64
- package/dist/esm/shared/charts/descriptors/service/index.js +1 -0
- package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/bargeIn.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/continuousAsr.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/dtmf.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/hangup.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/noUserInput.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/play.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/sendMetadata.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/transfer.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/hangup.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/play.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/record.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/refer.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +47 -2
- package/dist/esm/shared/constants.js +9 -0
- package/dist/esm/shared/helper/nlu/textCleaner.js +10 -2
- package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +3 -0
- package/dist/esm/shared/interfaces/handover.js +73 -9
- package/dist/esm/shared/interfaces/handoverProviders.js +20 -0
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +2 -0
- package/dist/esm/shared/interfaces/messageAPI/handover.js +24 -4
- package/dist/esm/shared/interfaces/resources/IAiAgent.js +10 -0
- package/dist/esm/shared/interfaces/resources/IExternalModel.js +2 -0
- package/dist/esm/shared/interfaces/resources/IHandoverProvider.js +2 -0
- package/dist/esm/shared/interfaces/resources/ILargeLanguageModel.js +12 -1
- package/dist/esm/shared/interfaces/resources/INodeDescriptorSet.js +9 -5
- package/dist/esm/shared/interfaces/resources/TResourceType.js +6 -0
- package/dist/esm/shared/interfaces/resources/intent/IDefaultReply.js +0 -1
- package/dist/esm/shared/interfaces/resources/settings/IAudioPreviewSettings.js +8 -2
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/ICreateHandoverProviderRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IDeleteHandoverProviderRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IHandoverProvider_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IHandoverService_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IIndexHandoverProvidersRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IIndexHandoverServicesRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IReadHandoverProviderRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/IUpdateHandoverProviderRest_2_0.js +2 -0
- package/dist/esm/shared/interfaces/restAPI/resources/handoverProvider/v2.0/index.js +2 -0
- package/dist/esm/shared/interfaces/security/IPermission.js +2 -0
- package/dist/esm/shared/interfaces/security/IRole.js +2 -0
- package/dist/esm/shared/interfaces/security/index.js +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +626 -25
|
@@ -14,6 +14,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.AI_AGENT_JOB = void 0;
|
|
15
15
|
/* Custom modules */
|
|
16
16
|
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
|
|
17
|
+
const crypto_1 = require("crypto");
|
|
18
|
+
const setSessionConfig_mapper_1 = require("../../voice/mappers/setSessionConfig.mapper");
|
|
19
|
+
const setSessionConfig_mapper_2 = require("../../voice/mappers/setSessionConfig.mapper");
|
|
20
|
+
const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode");
|
|
17
21
|
const transcripts_1 = require("../../../../interfaces/transcripts/transcripts");
|
|
18
22
|
const createSystemMessage_1 = require("./helpers/createSystemMessage");
|
|
19
23
|
const generateSearchPrompt_1 = require("./helpers/generateSearchPrompt");
|
|
@@ -83,7 +87,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
83
87
|
{
|
|
84
88
|
key: "description",
|
|
85
89
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__JOB_DESCRIPTION__LABEL",
|
|
86
|
-
type: "
|
|
90
|
+
type: "cognigyLLMText",
|
|
87
91
|
defaultValue: "You resolve customer issues, ensure a positive experience, troubleshoot problems, and escalate complex cases as needed. You provide product guidance, communicate effectively, and stay calm under pressure.",
|
|
88
92
|
params: {
|
|
89
93
|
required: false,
|
|
@@ -97,7 +101,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
97
101
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__INSCTRUCTIONS__DESCRIPTION",
|
|
98
102
|
defaultValue: `- Pretend to be an expert in your area.
|
|
99
103
|
- Never answer questions that are outside your job.`,
|
|
100
|
-
type: "
|
|
104
|
+
type: "cognigyLLMText",
|
|
101
105
|
params: {
|
|
102
106
|
required: false,
|
|
103
107
|
rows: 5,
|
|
@@ -177,7 +181,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
177
181
|
},
|
|
178
182
|
{
|
|
179
183
|
key: "memoryContextInjection",
|
|
180
|
-
type: "
|
|
184
|
+
type: "cognigyLLMText",
|
|
181
185
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CONTEXT_INJECTION__LABEL",
|
|
182
186
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__CONTEXT_INJECTION__DESCRIPTION",
|
|
183
187
|
defaultValue: "[[snippet-eyJ0eXBlIjoiY29udGV4dCIsImxhYmVsIjoiU2hvcnQtVGVybSBNZW1vcnkiLCJzY3JpcHQiOiJjb250ZXh0LnNob3J0VGVybU1lbW9yeSJ9]]",
|
|
@@ -623,6 +627,60 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
623
627
|
}
|
|
624
628
|
],
|
|
625
629
|
},
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
key: "voiceSetting",
|
|
633
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__VOICE_SETTING__LABEL",
|
|
634
|
+
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__VOICE_SETTING__DESCRIPTION",
|
|
635
|
+
type: "select",
|
|
636
|
+
defaultValue: "inheritFromAiAgent",
|
|
637
|
+
params: {
|
|
638
|
+
options: [
|
|
639
|
+
{
|
|
640
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__VOICE_SETTING__OPTIONS__INHERIT__LABEL",
|
|
641
|
+
value: "inheritFromAiAgent"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__VOICE_SETTING__OPTIONS__USE_JOB_VOICE__LABEL",
|
|
645
|
+
value: "jobVoice"
|
|
646
|
+
}
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
key: "ttsVendor",
|
|
652
|
+
defaultValue: "",
|
|
653
|
+
type: "ttsSelect",
|
|
654
|
+
label: "_unused_",
|
|
655
|
+
description: "_unused_",
|
|
656
|
+
params: {
|
|
657
|
+
languageKey: "config.ttsLanguage",
|
|
658
|
+
modelKey: "config.ttsModel",
|
|
659
|
+
voiceKey: "config.ttsVoice"
|
|
660
|
+
},
|
|
661
|
+
condition: {
|
|
662
|
+
key: "voiceSetting",
|
|
663
|
+
value: "jobVoice"
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
key: "ttsLanguage",
|
|
668
|
+
type: "ttsSelect",
|
|
669
|
+
defaultValue: "",
|
|
670
|
+
label: "_unused_",
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
key: "ttsModel",
|
|
674
|
+
type: "ttsSelect",
|
|
675
|
+
label: "_unused_",
|
|
676
|
+
description: "_unused_",
|
|
677
|
+
defaultValue: "",
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
key: "ttsVoice",
|
|
681
|
+
type: "ttsSelect",
|
|
682
|
+
defaultValue: "",
|
|
683
|
+
label: "_unused_",
|
|
626
684
|
}
|
|
627
685
|
],
|
|
628
686
|
sections: [
|
|
@@ -666,6 +724,15 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
666
724
|
"streamStopTokens"
|
|
667
725
|
]
|
|
668
726
|
},
|
|
727
|
+
{
|
|
728
|
+
key: "voice",
|
|
729
|
+
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__VOICE__LABEL",
|
|
730
|
+
defaultCollapsed: true,
|
|
731
|
+
fields: [
|
|
732
|
+
"voiceSetting",
|
|
733
|
+
"ttsVendor",
|
|
734
|
+
],
|
|
735
|
+
},
|
|
669
736
|
{
|
|
670
737
|
key: "toolSettings",
|
|
671
738
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__TOOL_SETTINGS__LABEL",
|
|
@@ -727,6 +794,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
727
794
|
{ type: "section", key: "memory" },
|
|
728
795
|
{ type: "section", key: "knowledgeSearch" },
|
|
729
796
|
{ type: "section", key: "storage" },
|
|
797
|
+
{ type: "section", key: "voice" },
|
|
730
798
|
{ type: "section", key: "toolSettings" },
|
|
731
799
|
{ type: "section", key: "imageHandling" },
|
|
732
800
|
{ type: "section", key: "advanced" },
|
|
@@ -735,23 +803,62 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
735
803
|
],
|
|
736
804
|
tags: ["ai", "aiAgent"],
|
|
737
805
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
738
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
806
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
739
807
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
740
|
-
const { aiAgent, llmProviderReferenceId, name: jobName, description: jobDescription, instructions: jobInstructions, outputImmediately, toolChoice, useStrict, memoryType, selectedProfileFields, memoryContextInjection, knowledgeSearchBehavior, knowledgeSearchTags, knowledgeSearchTagsFilterOp, knowledgeSearchAiAgentKnowledge, knowledgeSearchJobKnowledge, knowledgeSearchJobStore, knowledgeSearchGenerateSearchPrompt, knowledgeSearchTopK, timeoutInMs, maxTokens, temperature, logErrorToSystem, storeErrorInInput, errorHandling, errorHandlingGotoTarget, errorMessage, debugConfig, debugLogTokenCount, debugResult, storeLocation, contextKey, inputKey, streamStoreCopyInInput, streamStopTokens, processImages, transcriptImageHandling, } = config;
|
|
808
|
+
const { aiAgent, llmProviderReferenceId, name: jobName, description: jobDescription, instructions: jobInstructions, outputImmediately, toolChoice, useStrict, memoryType, selectedProfileFields, memoryContextInjection, knowledgeSearchBehavior, knowledgeSearchTags, knowledgeSearchTagsFilterOp, knowledgeSearchAiAgentKnowledge, knowledgeSearchJobKnowledge, knowledgeSearchJobStore, knowledgeSearchGenerateSearchPrompt, knowledgeSearchTopK, timeoutInMs, maxTokens, temperature, logErrorToSystem, storeErrorInInput, errorHandling, errorHandlingGotoTarget, errorMessage, debugConfig, debugLogTokenCount, debugResult, storeLocation, contextKey, inputKey, streamStoreCopyInInput, streamStopTokens, processImages, transcriptImageHandling, sessionParams } = config;
|
|
741
809
|
try {
|
|
742
810
|
if (!aiAgent) {
|
|
743
811
|
throw new Error("Could not resolve AI Agent reference in AI Agent Node");
|
|
744
812
|
}
|
|
745
|
-
|
|
813
|
+
// Determine if the job should inherit voice settings from the AI Agent
|
|
814
|
+
if (config.voiceSetting === "inheritFromAiAgent") {
|
|
815
|
+
if (aiAgent.enableVoiceConfigs && ((_a = aiAgent.voiceConfigs) === null || _a === void 0 ? void 0 : _a.ttsVendor) && aiAgent.voiceConfigs.ttsVendor !== "none") {
|
|
816
|
+
// Inherit voice configurations from the AI Agent if valid
|
|
817
|
+
Object.assign(config, {
|
|
818
|
+
ttsVendor: aiAgent.voiceConfigs.ttsVendor,
|
|
819
|
+
ttsLanguage: aiAgent.voiceConfigs.ttsLanguage,
|
|
820
|
+
ttsModel: aiAgent.voiceConfigs.ttsModel,
|
|
821
|
+
ttsVoice: aiAgent.voiceConfigs.ttsVoice,
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
// Reset voice settings if AI Agent lacks configurations
|
|
826
|
+
Object.assign(config, {
|
|
827
|
+
ttsVendor: "none",
|
|
828
|
+
ttsLanguage: "",
|
|
829
|
+
ttsModel: "",
|
|
830
|
+
ttsVoice: "",
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
// After inheriting or directly setting voice configurations from the AI Agent wizard,
|
|
835
|
+
// we need to apply these settings to the voice gateway
|
|
836
|
+
// Only proceed if we have a valid TTS vendor configured
|
|
837
|
+
if (config.ttsVendor && config.ttsVendor !== "none") {
|
|
838
|
+
try {
|
|
839
|
+
const voiceSettings = (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(config, api);
|
|
840
|
+
const payload = setSessionConfig_mapper_1.setSessionConfig.handleVGInput(voiceSettings, sessionParams || {}, api);
|
|
841
|
+
if (payload && Object.keys(payload).length > 0) {
|
|
842
|
+
api.say(null, {
|
|
843
|
+
_cognigy: payload,
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
(0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, voiceSettings);
|
|
847
|
+
}
|
|
848
|
+
catch (error) {
|
|
849
|
+
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
const _13 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _13, cleanedProfile = __rest(_13, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
746
853
|
const userMemory = (0, getUserMemory_1.getUserMemory)(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
747
854
|
/**
|
|
748
855
|
* ----- Knowledge Search Section -----
|
|
749
856
|
*/
|
|
750
857
|
let knowledgeSearchResponseData;
|
|
751
858
|
const sessionState = await api.loadSessionState();
|
|
752
|
-
const lastToolCall = (
|
|
859
|
+
const lastToolCall = (_b = sessionState.lastToolCall) === null || _b === void 0 ? void 0 : _b.toolCall;
|
|
753
860
|
if (knowledgeSearchBehavior === "always" ||
|
|
754
|
-
(knowledgeSearchBehavior === "onDemand" && ((
|
|
861
|
+
(knowledgeSearchBehavior === "onDemand" && ((_c = lastToolCall === null || lastToolCall === void 0 ? void 0 : lastToolCall.function) === null || _c === void 0 ? void 0 : _c.name) === "retrieve_knowledge")) {
|
|
755
862
|
const knowledgeStoreIds = [];
|
|
756
863
|
if (knowledgeSearchAiAgentKnowledge && aiAgent.knowledgeReferenceId) {
|
|
757
864
|
knowledgeStoreIds.push(aiAgent.knowledgeReferenceId);
|
|
@@ -759,8 +866,8 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
759
866
|
if (knowledgeSearchJobKnowledge && knowledgeSearchJobStore) {
|
|
760
867
|
knowledgeStoreIds.push(knowledgeSearchJobStore);
|
|
761
868
|
}
|
|
762
|
-
if (knowledgeStoreIds.length > 0 && (input.text || ((
|
|
763
|
-
let query = ((
|
|
869
|
+
if (knowledgeStoreIds.length > 0 && (input.text || ((_e = (_d = lastToolCall === null || lastToolCall === void 0 ? void 0 : lastToolCall.function) === null || _d === void 0 ? void 0 : _d.arguments) === null || _e === void 0 ? void 0 : _e.generated_prompt))) {
|
|
870
|
+
let query = ((_g = (_f = lastToolCall === null || lastToolCall === void 0 ? void 0 : lastToolCall.function) === null || _f === void 0 ? void 0 : _f.arguments) === null || _g === void 0 ? void 0 : _g.generated_prompt) || input.text;
|
|
764
871
|
if (knowledgeSearchBehavior === "always" && knowledgeSearchGenerateSearchPrompt) {
|
|
765
872
|
const generatedSearchPrompt = await (0, generateSearchPrompt_1.generateSearchPrompt)({ api, userMemory, llmProviderReferenceId, debugLogTokenCount, memoryContextInjection });
|
|
766
873
|
if (generatedSearchPrompt === null || generatedSearchPrompt === void 0 ? void 0 : generatedSearchPrompt.generated_prompt) {
|
|
@@ -776,10 +883,10 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
776
883
|
knowledgeStoreIds,
|
|
777
884
|
};
|
|
778
885
|
if (knowledgeSearchBehavior === "onDemand") {
|
|
779
|
-
const generated_buffer_phrase = (
|
|
886
|
+
const generated_buffer_phrase = (_j = (_h = lastToolCall === null || lastToolCall === void 0 ? void 0 : lastToolCall.function) === null || _h === void 0 ? void 0 : _h.arguments) === null || _j === void 0 ? void 0 : _j.generated_buffer_phrase;
|
|
780
887
|
if (generated_buffer_phrase) {
|
|
781
888
|
// output the generated buffer phrase. Don't add it to the transcript, else the LLM will repeat it next time.
|
|
782
|
-
await ((
|
|
889
|
+
await ((_k = api.output) === null || _k === void 0 ? void 0 : _k.call(api, generated_buffer_phrase, {
|
|
783
890
|
_cognigy: {
|
|
784
891
|
_preventTranscript: true
|
|
785
892
|
}
|
|
@@ -809,7 +916,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
809
916
|
if (query) {
|
|
810
917
|
messageLines.push(`\n<b>UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__SEARCH_PROMPT</b> ${query}`);
|
|
811
918
|
}
|
|
812
|
-
if ((
|
|
919
|
+
if ((_l = knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK) === null || _l === void 0 ? void 0 : _l.length) {
|
|
813
920
|
knowledgeSearchResponseData === null || knowledgeSearchResponseData === void 0 ? void 0 : knowledgeSearchResponseData.topK.forEach((result, index) => {
|
|
814
921
|
var _a;
|
|
815
922
|
messageLines.push(`\nTop ${index + 1}:`);
|
|
@@ -821,7 +928,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
821
928
|
else {
|
|
822
929
|
messageLines.push("UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__NO_RESULTS");
|
|
823
930
|
}
|
|
824
|
-
(
|
|
931
|
+
(_m = api.logDebugMessage) === null || _m === void 0 ? void 0 : _m.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__KNOWLEDGE_SEARCH__HEADER");
|
|
825
932
|
}
|
|
826
933
|
// Knowledge Search "onDemand" responds to a tool call
|
|
827
934
|
if (knowledgeSearchBehavior === "onDemand") {
|
|
@@ -850,7 +957,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
850
957
|
await api.addTranscriptStep(toolAnswer);
|
|
851
958
|
}
|
|
852
959
|
}
|
|
853
|
-
if (((
|
|
960
|
+
if (((_o = lastToolCall === null || lastToolCall === void 0 ? void 0 : lastToolCall.function) === null || _o === void 0 ? void 0 : _o.name) === "retrieve_knowledge") {
|
|
854
961
|
// remove the retrieve_knowledge toolCall from session state to avoid infinite loops
|
|
855
962
|
api.updateSessionStateValues({
|
|
856
963
|
lastToolCall: undefined
|
|
@@ -858,26 +965,35 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
858
965
|
}
|
|
859
966
|
}
|
|
860
967
|
// ----- End of Knowledge Search Section ----- //
|
|
968
|
+
const isOnDemandKnowledgeStoreConfigured = knowledgeSearchBehavior === "onDemand" && ((knowledgeSearchAiAgentKnowledge && aiAgent.knowledgeReferenceId) || (knowledgeSearchJobKnowledge && knowledgeSearchJobStore));
|
|
861
969
|
// create the system Message from the AI Agent resource and this Node's config storage
|
|
862
|
-
const systemMessage = (0, createSystemMessage_1.createSystemMessage)(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection,
|
|
970
|
+
const systemMessage = (0, createSystemMessage_1.createSystemMessage)(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection, isOnDemandKnowledgeStoreConfigured ? "onDemand" : "none");
|
|
863
971
|
// Create Tools JSON
|
|
864
972
|
const tools = [];
|
|
865
973
|
const toolIds = [];
|
|
866
974
|
childConfigs.forEach(child => {
|
|
975
|
+
if (child.type === "aiAgentJobDefault") {
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
;
|
|
867
979
|
const toolId = child.config.toolId;
|
|
868
|
-
if (!
|
|
869
|
-
throw new Error(`Tool ID
|
|
980
|
+
if (!toolId) {
|
|
981
|
+
throw new Error(`Tool ID is missing in Tool Node configuration.`);
|
|
982
|
+
}
|
|
983
|
+
const parsedToolId = api.parseCognigyScriptText(toolId);
|
|
984
|
+
if (!(0, createSystemMessage_1.validateToolId)(parsedToolId)) {
|
|
985
|
+
throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
|
|
870
986
|
}
|
|
871
|
-
if (toolIds.includes(
|
|
872
|
-
throw new Error(`Tool ID ${
|
|
987
|
+
if (toolIds.includes(parsedToolId)) {
|
|
988
|
+
throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
|
|
873
989
|
}
|
|
874
|
-
toolIds.push(
|
|
990
|
+
toolIds.push(parsedToolId);
|
|
875
991
|
if (child.type === "aiAgentJobTool" && (!child.config.condition || !!api.parseCognigyScriptCondition(child.config.condition))) {
|
|
876
992
|
const tool = {
|
|
877
993
|
type: "function",
|
|
878
994
|
function: {
|
|
879
|
-
name:
|
|
880
|
-
description: child.config.description,
|
|
995
|
+
name: parsedToolId,
|
|
996
|
+
description: api.parseCognigyScriptText(child.config.description),
|
|
881
997
|
}
|
|
882
998
|
};
|
|
883
999
|
if (useStrict) {
|
|
@@ -896,10 +1012,10 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
896
1012
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__AI_AGENT_NAME__LABEL</b> ${aiAgent.name}`);
|
|
897
1013
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__JOB_NAME__LABEL</b> ${jobName}`);
|
|
898
1014
|
// Safety settings
|
|
899
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_HARMFUL_CONTENT</b> ${(
|
|
900
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_UNGROUNDED_CONTENT</b> ${(
|
|
901
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_COPYRIGHT_INFRINGEMENTS</b> ${(
|
|
902
|
-
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_PREVENT_JAILBREAK_AND_MANIPULATION</b> ${(
|
|
1015
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_HARMFUL_CONTENT</b> ${(_p = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _p === void 0 ? void 0 : _p.avoidHarmfulContent}`);
|
|
1016
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_UNGROUNDED_CONTENT</b> ${(_q = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _q === void 0 ? void 0 : _q.avoidUngroundedContent}`);
|
|
1017
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_AVOID_COPYRIGHT_INFRINGEMENTS</b> ${(_r = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _r === void 0 ? void 0 : _r.avoidCopyrightInfringements}`);
|
|
1018
|
+
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__SAFETY_SETTINGS_PREVENT_JAILBREAK_AND_MANIPULATION</b> ${(_s = aiAgent === null || aiAgent === void 0 ? void 0 : aiAgent.safetySettings) === null || _s === void 0 ? void 0 : _s.preventJailbreakAndManipulation}`);
|
|
903
1019
|
// Tools
|
|
904
1020
|
if (tools.length > 0) {
|
|
905
1021
|
messageLines.push("<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__TOOLS__LABEL</b>");
|
|
@@ -942,11 +1058,22 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
942
1058
|
knowledgeSearchTags.forEach(tag => messageLines.push(`- ${tag}`));
|
|
943
1059
|
}
|
|
944
1060
|
}
|
|
945
|
-
|
|
1061
|
+
// Add voice configuration debug info
|
|
1062
|
+
if (config.voiceSetting === "inheritFromAiAgent") {
|
|
1063
|
+
messageLines.push("\n<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__INHERIT</b>");
|
|
1064
|
+
}
|
|
1065
|
+
else {
|
|
1066
|
+
messageLines.push("\n<b>UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__JOB_VOICE</b>");
|
|
1067
|
+
}
|
|
1068
|
+
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_VENDOR ${config.ttsVendor || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1069
|
+
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_LANGUAGE ${config.ttsLanguage || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1070
|
+
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_MODEL ${config.ttsModel || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1071
|
+
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_VOICE ${config.ttsVoice || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1072
|
+
(_t = api.logDebugMessage) === null || _t === void 0 ? void 0 : _t.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__HEADER");
|
|
946
1073
|
}
|
|
947
1074
|
// keep this after the debug message since the "retrieve_knowledge" tool is implicit
|
|
948
1075
|
// we only add this tool if at least one knowledge source is enabled
|
|
949
|
-
if (
|
|
1076
|
+
if (isOnDemandKnowledgeStoreConfigured) {
|
|
950
1077
|
const knowledgeTool = {
|
|
951
1078
|
type: "function",
|
|
952
1079
|
function: {
|
|
@@ -986,23 +1113,26 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
986
1113
|
transcript.length > 0 &&
|
|
987
1114
|
transcript[transcript.length - 1].role === transcripts_1.TranscriptRole.USER) {
|
|
988
1115
|
const userInput = transcript[transcript.length - 1];
|
|
989
|
-
const enhancedInput = `## Knowledge Source Context\nAdditional Context from the knowledge source: \n${JSON.stringify(knowledgeSearchResponseData)}\n\n\n${((
|
|
1116
|
+
const enhancedInput = `## Knowledge Source Context\nAdditional Context from the knowledge source: \n${JSON.stringify(knowledgeSearchResponseData)}\n\n\n${((_u = userInput === null || userInput === void 0 ? void 0 : userInput.payload) === null || _u === void 0 ? void 0 : _u.text) || input.text}`;
|
|
990
1117
|
transcript[transcript.length - 1].payload.text = enhancedInput;
|
|
991
1118
|
}
|
|
1119
|
+
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
1120
|
+
const _messageId = (0, crypto_1.randomUUID)();
|
|
992
1121
|
const llmPromptOptions = Object.assign(Object.assign({ prompt: "", chat: systemMessage,
|
|
993
1122
|
// Temp fix to override the transcript if needed
|
|
994
|
-
transcript: ((
|
|
1123
|
+
transcript: ((_v = context === null || context === void 0 ? void 0 : context._cognigy) === null || _v === void 0 ? void 0 : _v.transcript) ? [...context._cognigy.transcript] : transcript, detailedResults: true, timeoutInMs: timeoutInMs !== null && timeoutInMs !== void 0 ? timeoutInMs : 8000, maxTokens: maxTokens !== null && maxTokens !== void 0 ? maxTokens : 4000, temperature: temperature !== null && temperature !== void 0 ? temperature : 0.7, topP: 1, frequencyPenalty: 0, presencePenalty: 0, responseFormat: "text", stream: storeLocation === "stream", streamOnDataHandler: (text) => {
|
|
995
1124
|
var _a;
|
|
996
|
-
text = text.trim();
|
|
1125
|
+
text = isStreamingChannel ? text : text.trim();
|
|
997
1126
|
if (text) {
|
|
998
1127
|
// if we got text, we output it, but prevent it from being added to the transcript
|
|
999
1128
|
(_a = api.output) === null || _a === void 0 ? void 0 : _a.call(api, text, {
|
|
1000
1129
|
_cognigy: {
|
|
1001
|
-
_preventTranscript: true
|
|
1130
|
+
_preventTranscript: true,
|
|
1131
|
+
_messageId,
|
|
1002
1132
|
}
|
|
1003
1133
|
});
|
|
1004
1134
|
}
|
|
1005
|
-
}, streamStopTokens: streamStopTokens || [".", "!", "?", "\\n"] }, (tools.length > 0 && { tools })), (tools.length > 0 && { toolChoice: toolChoice }));
|
|
1135
|
+
}, streamStopTokens: streamStopTokens || [".", "!", "?", "\\n"], preventNewLineRemoval: isStreamingChannel ? true : false }, (tools.length > 0 && { tools })), (tools.length > 0 && { toolChoice: toolChoice }));
|
|
1006
1136
|
// llmProviderReferenceId `default` value is not a responseFormat, rather it is LLM Model default selection.
|
|
1007
1137
|
if (llmProviderReferenceId && llmProviderReferenceId !== "default") {
|
|
1008
1138
|
llmPromptOptions["llmProviderReferenceId"] = llmProviderReferenceId;
|
|
@@ -1014,22 +1144,25 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1014
1144
|
};
|
|
1015
1145
|
}
|
|
1016
1146
|
// Set understood to true so that an AI Agent interaction doesn't look false in our analytics
|
|
1017
|
-
(
|
|
1147
|
+
(_w = api.setAnalyticsData) === null || _w === void 0 ? void 0 : _w.call(api, "understood", "true");
|
|
1018
1148
|
input.understood = true;
|
|
1019
|
-
const fullLlmResult = await ((
|
|
1149
|
+
const fullLlmResult = await ((_x = api.runGenerativeAIPrompt) === null || _x === void 0 ? void 0 : _x.call(api, llmPromptOptions, "aiAgent"));
|
|
1020
1150
|
const { messages } = fullLlmResult, llmResult = __rest(fullLlmResult, ["messages"]);
|
|
1021
1151
|
const llmProvider = llmResult === null || llmResult === void 0 ? void 0 : llmResult.provider;
|
|
1022
1152
|
const tokenUsage = fullLlmResult.tokenUsage;
|
|
1023
1153
|
// Send optional debug message with token usage
|
|
1024
1154
|
if (debugLogTokenCount && tokenUsage) {
|
|
1025
|
-
(
|
|
1155
|
+
(_y = api.logDebugMessage) === null || _y === void 0 ? void 0 : _y.call(api, tokenUsage, "UI__DEBUG_MODE__AI_AGENT_JOB__TOKEN_USAGE__HEADER");
|
|
1026
1156
|
}
|
|
1027
1157
|
// Identify if the result is a tool call
|
|
1028
1158
|
// If response is a tool call, set next node for Tools
|
|
1029
1159
|
if (llmResult.finishReason === "tool_calls" && llmResult.toolCalls.length > 0) {
|
|
1030
1160
|
const mainToolCall = llmResult.toolCalls[0];
|
|
1031
1161
|
// Find the child node with the toolId of the tool call
|
|
1032
|
-
const toolChild = childConfigs.find(child => { var _a; return child.type === "aiAgentJobTool" && ((_a = child.config) === null || _a === void 0 ? void 0 : _a.toolId) === mainToolCall.function.name; });
|
|
1162
|
+
const toolChild = childConfigs.find(child => { var _a, _b; return child.type === "aiAgentJobTool" && ((_a = child.config) === null || _a === void 0 ? void 0 : _a.toolId) && api.parseCognigyScriptText((_b = child.config) === null || _b === void 0 ? void 0 : _b.toolId) === mainToolCall.function.name; });
|
|
1163
|
+
if (toolChild === undefined) {
|
|
1164
|
+
(_z = api.logDebugError) === null || _z === void 0 ? void 0 : _z.call(api, `UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__BODY <b>${mainToolCall.function.name}</b>`, "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__ERROR__HEADER");
|
|
1165
|
+
}
|
|
1033
1166
|
// Add last tool call to session state for loading it from Tool Answer Node
|
|
1034
1167
|
api.updateSessionStateValues({
|
|
1035
1168
|
lastToolCall: {
|
|
@@ -1043,13 +1176,13 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1043
1176
|
});
|
|
1044
1177
|
// if there are any parameters/arguments, add them to the input slots
|
|
1045
1178
|
if (mainToolCall.function.arguments) {
|
|
1046
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1179
|
+
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (_1 = (_0 = input.aiAgent) === null || _0 === void 0 ? void 0 : _0.toolArgs) !== null && _1 !== void 0 ? _1 : {}), mainToolCall.function.arguments) });
|
|
1047
1180
|
}
|
|
1048
1181
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1049
|
-
if (toolChild === null || toolChild === void 0 ? void 0 : toolChild.config.debugMessage) {
|
|
1050
|
-
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolChild.config.toolId}`];
|
|
1182
|
+
if ((_2 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _2 === void 0 ? void 0 : _2.debugMessage) {
|
|
1183
|
+
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${api.parseCognigyScriptText(toolChild.config.toolId)}`];
|
|
1051
1184
|
// Arguments / Parameters Slots
|
|
1052
|
-
const slots = ((
|
|
1185
|
+
const slots = ((_3 = mainToolCall === null || mainToolCall === void 0 ? void 0 : mainToolCall.function) === null || _3 === void 0 ? void 0 : _3.arguments) && Object.keys(mainToolCall.function.arguments);
|
|
1053
1186
|
const hasSlots = slots && slots.length > 0;
|
|
1054
1187
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1055
1188
|
if (hasSlots) {
|
|
@@ -1064,7 +1197,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1064
1197
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1065
1198
|
});
|
|
1066
1199
|
}
|
|
1067
|
-
(
|
|
1200
|
+
(_4 = api.logDebugMessage) === null || _4 === void 0 ? void 0 : _4.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER");
|
|
1068
1201
|
}
|
|
1069
1202
|
if (toolChild) {
|
|
1070
1203
|
api.setNextNode(toolChild.id);
|
|
@@ -1089,7 +1222,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1089
1222
|
}
|
|
1090
1223
|
// Optionally output the result immediately
|
|
1091
1224
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1092
|
-
await ((
|
|
1225
|
+
await ((_5 = api.output) === null || _5 === void 0 ? void 0 : _5.call(api, llmResult.result, {}));
|
|
1093
1226
|
}
|
|
1094
1227
|
// If we are streaming and we got a result, also store it into the transcript, since streamed chunks are not stored there
|
|
1095
1228
|
if (llmResult.result && llmPromptOptions.stream) {
|
|
@@ -1106,7 +1239,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1106
1239
|
}
|
|
1107
1240
|
// Add response to Cognigy Input/Context for further usage
|
|
1108
1241
|
if (storeLocation === "context") {
|
|
1109
|
-
(
|
|
1242
|
+
(_6 = api.addToContext) === null || _6 === void 0 ? void 0 : _6.call(api, contextKey, llmResult, "simple");
|
|
1110
1243
|
}
|
|
1111
1244
|
else if (storeLocation === "input") {
|
|
1112
1245
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1119,14 +1252,14 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1119
1252
|
const errorDetails = {
|
|
1120
1253
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1121
1254
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1122
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1255
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_7 = error.originalErrorDetails) === null || _7 === void 0 ? void 0 : _7.message),
|
|
1123
1256
|
};
|
|
1124
|
-
(
|
|
1257
|
+
(_8 = api.emitEvent) === null || _8 === void 0 ? void 0 : _8.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1125
1258
|
if (logErrorToSystem) {
|
|
1126
|
-
(
|
|
1259
|
+
(_9 = api.log) === null || _9 === void 0 ? void 0 : _9.call(api, "error", JSON.stringify(errorDetails));
|
|
1127
1260
|
}
|
|
1128
1261
|
if (errorHandling !== "stop") {
|
|
1129
|
-
(
|
|
1262
|
+
(_10 = api.logDebugError) === null || _10 === void 0 ? void 0 : _10.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1130
1263
|
}
|
|
1131
1264
|
if (storeErrorInInput) {
|
|
1132
1265
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1135,7 +1268,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1135
1268
|
if (errorHandling === "continue") {
|
|
1136
1269
|
// output the timeout message
|
|
1137
1270
|
if (errorMessage) {
|
|
1138
|
-
await ((
|
|
1271
|
+
await ((_11 = api.output) === null || _11 === void 0 ? void 0 : _11.call(api, errorMessage, null));
|
|
1139
1272
|
}
|
|
1140
1273
|
// Set default node as next node
|
|
1141
1274
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1147,7 +1280,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1147
1280
|
if (!errorHandlingGotoTarget) {
|
|
1148
1281
|
throw new Error("GoTo Target is required");
|
|
1149
1282
|
}
|
|
1150
|
-
if (!((
|
|
1283
|
+
if (!((_12 = api.checkThink) === null || _12 === void 0 ? void 0 : _12.call(api, nodeId))) {
|
|
1151
1284
|
api.resetNextNodes();
|
|
1152
1285
|
await api.executeFlow({
|
|
1153
1286
|
flowNode: {
|
|
@@ -19,6 +19,26 @@ exports.CHECK_AGENT_AVAILABILITY = (0, createNodeDescriptor_1.createNodeDescript
|
|
|
19
19
|
},
|
|
20
20
|
tags: ["service"],
|
|
21
21
|
fields: [
|
|
22
|
+
{
|
|
23
|
+
key: "checkAgentAvailabilityProvider",
|
|
24
|
+
label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__LABEL",
|
|
25
|
+
type: "checkAgentAvailabilityProvider",
|
|
26
|
+
description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__DESCRIPTION",
|
|
27
|
+
defaultValue: "legacyEndpoint",
|
|
28
|
+
params: {
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "checkAgentAvailabilityConfig",
|
|
34
|
+
label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__LABEL",
|
|
35
|
+
type: "json",
|
|
36
|
+
description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__DESCRIPTION",
|
|
37
|
+
defaultValue: {},
|
|
38
|
+
params: {
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
22
42
|
{
|
|
23
43
|
key: "chatwootInboxId",
|
|
24
44
|
type: "cognigyText",
|
|
@@ -153,7 +173,20 @@ exports.CHECK_AGENT_AVAILABILITY = (0, createNodeDescriptor_1.createNodeDescript
|
|
|
153
173
|
defaultCollapsed: true,
|
|
154
174
|
fields: [
|
|
155
175
|
"chatwootInboxId",
|
|
156
|
-
]
|
|
176
|
+
],
|
|
177
|
+
condition: {
|
|
178
|
+
or: [
|
|
179
|
+
{
|
|
180
|
+
key: "checkAgentAvailabilityProvider",
|
|
181
|
+
value: "legacyEndpoint"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "checkAgentAvailabilityProvider",
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
value: null
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
157
190
|
},
|
|
158
191
|
{
|
|
159
192
|
key: "liveAgentSettings",
|
|
@@ -163,7 +196,20 @@ exports.CHECK_AGENT_AVAILABILITY = (0, createNodeDescriptor_1.createNodeDescript
|
|
|
163
196
|
constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_INBOX_ID,
|
|
164
197
|
constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_SKILLS,
|
|
165
198
|
constants_1.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_LANGUAGES,
|
|
166
|
-
]
|
|
199
|
+
],
|
|
200
|
+
condition: {
|
|
201
|
+
or: [
|
|
202
|
+
{
|
|
203
|
+
key: "checkAgentAvailabilityProvider",
|
|
204
|
+
value: "legacyEndpoint"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
key: "checkAgentAvailabilityProvider",
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
value: null
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
167
213
|
},
|
|
168
214
|
{
|
|
169
215
|
key: "genesysCloudSettings",
|
|
@@ -173,7 +219,20 @@ exports.CHECK_AGENT_AVAILABILITY = (0, createNodeDescriptor_1.createNodeDescript
|
|
|
173
219
|
"genesysCloudSkills",
|
|
174
220
|
"genesysCloudProfileSkills",
|
|
175
221
|
"genesysCloudLanguageSkills"
|
|
176
|
-
]
|
|
222
|
+
],
|
|
223
|
+
condition: {
|
|
224
|
+
or: [
|
|
225
|
+
{
|
|
226
|
+
key: "checkAgentAvailabilityProvider",
|
|
227
|
+
value: "legacyEndpoint"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
key: "checkAgentAvailabilityProvider",
|
|
231
|
+
// @ts-ignore
|
|
232
|
+
value: null
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
177
236
|
},
|
|
178
237
|
{
|
|
179
238
|
key: "storage",
|
|
@@ -197,6 +256,7 @@ exports.CHECK_AGENT_AVAILABILITY = (0, createNodeDescriptor_1.createNodeDescript
|
|
|
197
256
|
}
|
|
198
257
|
],
|
|
199
258
|
form: [
|
|
259
|
+
{ type: "field", key: "checkAgentAvailabilityProvider" },
|
|
200
260
|
{ type: "section", key: "genesysCloudSettings" },
|
|
201
261
|
// only render this field if "live agent" is enabled
|
|
202
262
|
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT === "true" && {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GENESYS_CLOUD_CONNECTION_OM = exports.GENESYS_CLOUD_CONNECTION = exports.EIGHT_BY_EIGHT_CONNECTION = exports.CHATWOOT_CONNECTION = exports.RINGCENTRAL_ENGAGE_CONNECTION = exports.LIVE_AGENT_CONNECTION = void 0;
|
|
4
|
+
exports.LIVE_AGENT_CONNECTION = {
|
|
5
|
+
type: "live_agent",
|
|
6
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__LIVE_AGENT_CONNECTION_AUTHENTICATION__LABEL",
|
|
7
|
+
fields: [
|
|
8
|
+
{ fieldName: "apiKey", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__LIVE_AGENT__API_KEY__LABEL" }
|
|
9
|
+
]
|
|
10
|
+
};
|
|
11
|
+
exports.RINGCENTRAL_ENGAGE_CONNECTION = {
|
|
12
|
+
type: "ringcentral_engage",
|
|
13
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE_CONNECTION_AUTHENTICATION__LABEL",
|
|
14
|
+
fields: [
|
|
15
|
+
{ fieldName: "webhookSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE__WEBHOOK_SECRET__LABEL" },
|
|
16
|
+
{ fieldName: "realtimeAccessToken", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE__REALTIME_ACCESS_TOKEN__LABEL" },
|
|
17
|
+
{ fieldName: "apiAccessToken", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE__API_ACCESS_TOKEN__LABEL" }
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
exports.CHATWOOT_CONNECTION = {
|
|
21
|
+
type: "chatwoot",
|
|
22
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__CHATWOOT_CONNECTION_AUTHENTICATION__LABEL",
|
|
23
|
+
fields: [
|
|
24
|
+
{ fieldName: "apiKey", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__CHATWOOT__API_KEY__LABEL" }
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
exports.EIGHT_BY_EIGHT_CONNECTION = {
|
|
28
|
+
type: "eight_by_eight",
|
|
29
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__EIGHTBYEIGHT_CONNECTION_AUTHENTICATION__LABEL",
|
|
30
|
+
fields: [
|
|
31
|
+
{ fieldName: "apiAccessToken", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__EIGHTBYEIGHT__API_ACCESS_TOKEN__LABEL" }
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
exports.GENESYS_CLOUD_CONNECTION = {
|
|
35
|
+
type: "genesys_cloud",
|
|
36
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD_CONNECTION_AUTHENTICATION__LABEL",
|
|
37
|
+
fields: [
|
|
38
|
+
{ fieldName: "clientId", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_ID__LABEL" },
|
|
39
|
+
{ fieldName: "clientSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_SECRET__LABEL" },
|
|
40
|
+
]
|
|
41
|
+
};
|
|
42
|
+
exports.GENESYS_CLOUD_CONNECTION_OM = {
|
|
43
|
+
type: "genesys_cloud_om",
|
|
44
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD_CONNECTION_AUTHENTICATION__LABEL",
|
|
45
|
+
fields: [
|
|
46
|
+
{ fieldName: "clientId", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_ID__LABEL" },
|
|
47
|
+
{ fieldName: "clientSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_SECRET__LABEL" },
|
|
48
|
+
{ fieldName: "webhookSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__WEBHOOK_SECRET__LABEL" }
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=handoverConnections.js.map
|