@cognigy/rest-api-client 4.96.0 → 4.98.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 +12 -3
- 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/completeGoal.js +2 -2
- 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 +5 -1
- package/build/shared/charts/descriptors/logic/think.js +2 -4
- package/build/shared/charts/descriptors/message/question/question.js +21 -13
- package/build/shared/charts/descriptors/message/say.js +29 -3
- package/build/shared/charts/descriptors/service/GPTPrompt.js +1 -1
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +80 -30
- 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/constants.js +8 -1
- package/build/shared/interfaces/IProfileSchema.js +1 -1
- 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 +6 -1
- package/build/shared/interfaces/messageAPI/handover.js +27 -2
- package/build/shared/interfaces/resources/IAiAgent.js +3 -1
- 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/settings/IAudioPreviewSettings.js +8 -2
- package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -0
- 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/completeGoal.js +2 -2
- 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 +5 -1
- package/dist/esm/shared/charts/descriptors/logic/think.js +2 -4
- package/dist/esm/shared/charts/descriptors/message/question/question.js +21 -13
- package/dist/esm/shared/charts/descriptors/message/say.js +29 -3
- package/dist/esm/shared/charts/descriptors/service/GPTPrompt.js +1 -1
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +80 -30
- 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/constants.js +7 -0
- package/dist/esm/shared/interfaces/IProfileSchema.js +1 -1
- 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 +6 -1
- package/dist/esm/shared/interfaces/messageAPI/handover.js +27 -2
- package/dist/esm/shared/interfaces/resources/IAiAgent.js +3 -1
- 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/settings/IAudioPreviewSettings.js +8 -2
- package/dist/esm/shared/interfaces/resources/settings/IGenerativeAISettings.js +4 -0
- 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 +573 -23
|
@@ -87,7 +87,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
87
87
|
{
|
|
88
88
|
key: "description",
|
|
89
89
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__JOB_DESCRIPTION__LABEL",
|
|
90
|
-
type: "
|
|
90
|
+
type: "cognigyLLMText",
|
|
91
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.",
|
|
92
92
|
params: {
|
|
93
93
|
required: false,
|
|
@@ -101,7 +101,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
101
101
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__INSCTRUCTIONS__DESCRIPTION",
|
|
102
102
|
defaultValue: `- Pretend to be an expert in your area.
|
|
103
103
|
- Never answer questions that are outside your job.`,
|
|
104
|
-
type: "
|
|
104
|
+
type: "cognigyLLMText",
|
|
105
105
|
params: {
|
|
106
106
|
required: false,
|
|
107
107
|
rows: 5,
|
|
@@ -652,11 +652,10 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
652
652
|
defaultValue: "",
|
|
653
653
|
type: "ttsSelect",
|
|
654
654
|
label: "_unused_",
|
|
655
|
-
description: "_unused_",
|
|
656
655
|
params: {
|
|
657
656
|
languageKey: "config.ttsLanguage",
|
|
658
657
|
modelKey: "config.ttsModel",
|
|
659
|
-
voiceKey: "config.ttsVoice"
|
|
658
|
+
voiceKey: "config.ttsVoice",
|
|
660
659
|
},
|
|
661
660
|
condition: {
|
|
662
661
|
key: "voiceSetting",
|
|
@@ -681,6 +680,37 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
681
680
|
type: "ttsSelect",
|
|
682
681
|
defaultValue: "",
|
|
683
682
|
label: "_unused_",
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
key: "ttsLabel",
|
|
686
|
+
type: "cognigyText",
|
|
687
|
+
defaultValue: "",
|
|
688
|
+
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_LABEL__LABEL",
|
|
689
|
+
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_LABEL__DESCRIPTION",
|
|
690
|
+
condition: {
|
|
691
|
+
and: [
|
|
692
|
+
{
|
|
693
|
+
negate: true,
|
|
694
|
+
key: "ttsVendor",
|
|
695
|
+
value: "", // We show the field for all vendors as soon as it is defined
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
key: "voiceSetting",
|
|
699
|
+
value: "jobVoice"
|
|
700
|
+
}
|
|
701
|
+
]
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
key: "ttsDisableCache",
|
|
706
|
+
type: "toggle",
|
|
707
|
+
defaultValue: false,
|
|
708
|
+
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_DISABLE_CACHE__LABEL",
|
|
709
|
+
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_DISABLE_CACHE__DESCRIPTION",
|
|
710
|
+
condition: {
|
|
711
|
+
key: "voiceSetting",
|
|
712
|
+
value: "jobVoice"
|
|
713
|
+
},
|
|
684
714
|
}
|
|
685
715
|
],
|
|
686
716
|
sections: [
|
|
@@ -731,6 +761,8 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
731
761
|
fields: [
|
|
732
762
|
"voiceSetting",
|
|
733
763
|
"ttsVendor",
|
|
764
|
+
"ttsLabel",
|
|
765
|
+
"ttsDisableCache",
|
|
734
766
|
],
|
|
735
767
|
},
|
|
736
768
|
{
|
|
@@ -803,7 +835,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
803
835
|
],
|
|
804
836
|
tags: ["ai", "aiAgent"],
|
|
805
837
|
function: async ({ cognigy, config, childConfigs, nodeId }) => {
|
|
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;
|
|
838
|
+
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;
|
|
807
839
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
808
840
|
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;
|
|
809
841
|
try {
|
|
@@ -819,6 +851,8 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
819
851
|
ttsLanguage: aiAgent.voiceConfigs.ttsLanguage,
|
|
820
852
|
ttsModel: aiAgent.voiceConfigs.ttsModel,
|
|
821
853
|
ttsVoice: aiAgent.voiceConfigs.ttsVoice,
|
|
854
|
+
ttsLabel: aiAgent.voiceConfigs.ttsLabel,
|
|
855
|
+
ttsDisableCache: aiAgent.voiceConfigs.ttsDisableCache,
|
|
822
856
|
});
|
|
823
857
|
}
|
|
824
858
|
else {
|
|
@@ -828,6 +862,8 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
828
862
|
ttsLanguage: "",
|
|
829
863
|
ttsModel: "",
|
|
830
864
|
ttsVoice: "",
|
|
865
|
+
ttsLabel: "",
|
|
866
|
+
ttsDisableCache: false,
|
|
831
867
|
});
|
|
832
868
|
}
|
|
833
869
|
}
|
|
@@ -849,7 +885,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
849
885
|
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
850
886
|
}
|
|
851
887
|
}
|
|
852
|
-
const
|
|
888
|
+
const _13 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _13, cleanedProfile = __rest(_13, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
853
889
|
const userMemory = (0, getUserMemory_1.getUserMemory)(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
854
890
|
/**
|
|
855
891
|
* ----- Knowledge Search Section -----
|
|
@@ -965,26 +1001,35 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
965
1001
|
}
|
|
966
1002
|
}
|
|
967
1003
|
// ----- End of Knowledge Search Section ----- //
|
|
1004
|
+
const isOnDemandKnowledgeStoreConfigured = knowledgeSearchBehavior === "onDemand" && ((knowledgeSearchAiAgentKnowledge && aiAgent.knowledgeReferenceId) || (knowledgeSearchJobKnowledge && knowledgeSearchJobStore));
|
|
968
1005
|
// create the system Message from the AI Agent resource and this Node's config storage
|
|
969
|
-
const systemMessage = (0, createSystemMessage_1.createSystemMessage)(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection,
|
|
1006
|
+
const systemMessage = (0, createSystemMessage_1.createSystemMessage)(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection, isOnDemandKnowledgeStoreConfigured ? "onDemand" : "none");
|
|
970
1007
|
// Create Tools JSON
|
|
971
1008
|
const tools = [];
|
|
972
1009
|
const toolIds = [];
|
|
973
1010
|
childConfigs.forEach(child => {
|
|
1011
|
+
if (child.type === "aiAgentJobDefault") {
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
;
|
|
974
1015
|
const toolId = child.config.toolId;
|
|
975
|
-
if (!
|
|
976
|
-
throw new Error(`Tool ID
|
|
1016
|
+
if (!toolId) {
|
|
1017
|
+
throw new Error(`Tool ID is missing in Tool Node configuration.`);
|
|
1018
|
+
}
|
|
1019
|
+
const parsedToolId = api.parseCognigyScriptText(toolId);
|
|
1020
|
+
if (!(0, createSystemMessage_1.validateToolId)(parsedToolId)) {
|
|
1021
|
+
throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
|
|
977
1022
|
}
|
|
978
|
-
if (toolIds.includes(
|
|
979
|
-
throw new Error(`Tool ID ${
|
|
1023
|
+
if (toolIds.includes(parsedToolId)) {
|
|
1024
|
+
throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
|
|
980
1025
|
}
|
|
981
|
-
toolIds.push(
|
|
1026
|
+
toolIds.push(parsedToolId);
|
|
982
1027
|
if (child.type === "aiAgentJobTool" && (!child.config.condition || !!api.parseCognigyScriptCondition(child.config.condition))) {
|
|
983
1028
|
const tool = {
|
|
984
1029
|
type: "function",
|
|
985
1030
|
function: {
|
|
986
|
-
name:
|
|
987
|
-
description: child.config.description,
|
|
1031
|
+
name: parsedToolId,
|
|
1032
|
+
description: api.parseCognigyScriptText(child.config.description),
|
|
988
1033
|
}
|
|
989
1034
|
};
|
|
990
1035
|
if (useStrict) {
|
|
@@ -1060,11 +1105,13 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1060
1105
|
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'}`);
|
|
1061
1106
|
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'}`);
|
|
1062
1107
|
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'}`);
|
|
1108
|
+
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_LABEL ${config.ttsLabel || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1109
|
+
messageLines.push(`UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__TTS_DISABLE_CACHE ${config.ttsDisableCache || 'UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__VOICE_SETTING__NOT_SET'}`);
|
|
1063
1110
|
(_t = api.logDebugMessage) === null || _t === void 0 ? void 0 : _t.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__HEADER");
|
|
1064
1111
|
}
|
|
1065
1112
|
// keep this after the debug message since the "retrieve_knowledge" tool is implicit
|
|
1066
1113
|
// we only add this tool if at least one knowledge source is enabled
|
|
1067
|
-
if (
|
|
1114
|
+
if (isOnDemandKnowledgeStoreConfigured) {
|
|
1068
1115
|
const knowledgeTool = {
|
|
1069
1116
|
type: "function",
|
|
1070
1117
|
function: {
|
|
@@ -1107,7 +1154,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1107
1154
|
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}`;
|
|
1108
1155
|
transcript[transcript.length - 1].payload.text = enhancedInput;
|
|
1109
1156
|
}
|
|
1110
|
-
const isStreamingChannel = input.channel === "webchat3";
|
|
1157
|
+
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
1111
1158
|
const _messageId = (0, crypto_1.randomUUID)();
|
|
1112
1159
|
const llmPromptOptions = Object.assign(Object.assign({ prompt: "", chat: systemMessage,
|
|
1113
1160
|
// Temp fix to override the transcript if needed
|
|
@@ -1150,7 +1197,10 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1150
1197
|
if (llmResult.finishReason === "tool_calls" && llmResult.toolCalls.length > 0) {
|
|
1151
1198
|
const mainToolCall = llmResult.toolCalls[0];
|
|
1152
1199
|
// Find the child node with the toolId of the tool call
|
|
1153
|
-
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; });
|
|
1200
|
+
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; });
|
|
1201
|
+
if (mainToolCall.function.name !== "retrieve_knowledge" && toolChild === undefined) {
|
|
1202
|
+
(_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");
|
|
1203
|
+
}
|
|
1154
1204
|
// Add last tool call to session state for loading it from Tool Answer Node
|
|
1155
1205
|
api.updateSessionStateValues({
|
|
1156
1206
|
lastToolCall: {
|
|
@@ -1164,13 +1214,13 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1164
1214
|
});
|
|
1165
1215
|
// if there are any parameters/arguments, add them to the input slots
|
|
1166
1216
|
if (mainToolCall.function.arguments) {
|
|
1167
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1217
|
+
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) });
|
|
1168
1218
|
}
|
|
1169
1219
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1170
|
-
if (toolChild === null || toolChild === void 0 ? void 0 : toolChild.config.debugMessage) {
|
|
1171
|
-
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolChild.config.toolId}`];
|
|
1220
|
+
if ((_2 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _2 === void 0 ? void 0 : _2.debugMessage) {
|
|
1221
|
+
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${api.parseCognigyScriptText(toolChild.config.toolId)}`];
|
|
1172
1222
|
// Arguments / Parameters Slots
|
|
1173
|
-
const slots = ((
|
|
1223
|
+
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);
|
|
1174
1224
|
const hasSlots = slots && slots.length > 0;
|
|
1175
1225
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1176
1226
|
if (hasSlots) {
|
|
@@ -1185,7 +1235,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1185
1235
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1186
1236
|
});
|
|
1187
1237
|
}
|
|
1188
|
-
(
|
|
1238
|
+
(_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");
|
|
1189
1239
|
}
|
|
1190
1240
|
if (toolChild) {
|
|
1191
1241
|
api.setNextNode(toolChild.id);
|
|
@@ -1210,7 +1260,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1210
1260
|
}
|
|
1211
1261
|
// Optionally output the result immediately
|
|
1212
1262
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1213
|
-
await ((
|
|
1263
|
+
await ((_5 = api.output) === null || _5 === void 0 ? void 0 : _5.call(api, llmResult.result, {}));
|
|
1214
1264
|
}
|
|
1215
1265
|
// If we are streaming and we got a result, also store it into the transcript, since streamed chunks are not stored there
|
|
1216
1266
|
if (llmResult.result && llmPromptOptions.stream) {
|
|
@@ -1227,7 +1277,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1227
1277
|
}
|
|
1228
1278
|
// Add response to Cognigy Input/Context for further usage
|
|
1229
1279
|
if (storeLocation === "context") {
|
|
1230
|
-
(
|
|
1280
|
+
(_6 = api.addToContext) === null || _6 === void 0 ? void 0 : _6.call(api, contextKey, llmResult, "simple");
|
|
1231
1281
|
}
|
|
1232
1282
|
else if (storeLocation === "input") {
|
|
1233
1283
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1240,14 +1290,14 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1240
1290
|
const errorDetails = {
|
|
1241
1291
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1242
1292
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1243
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1293
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_7 = error.originalErrorDetails) === null || _7 === void 0 ? void 0 : _7.message),
|
|
1244
1294
|
};
|
|
1245
|
-
(
|
|
1295
|
+
(_8 = api.emitEvent) === null || _8 === void 0 ? void 0 : _8.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1246
1296
|
if (logErrorToSystem) {
|
|
1247
|
-
(
|
|
1297
|
+
(_9 = api.log) === null || _9 === void 0 ? void 0 : _9.call(api, "error", JSON.stringify(errorDetails));
|
|
1248
1298
|
}
|
|
1249
1299
|
if (errorHandling !== "stop") {
|
|
1250
|
-
(
|
|
1300
|
+
(_10 = api.logDebugError) === null || _10 === void 0 ? void 0 : _10.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1251
1301
|
}
|
|
1252
1302
|
if (storeErrorInInput) {
|
|
1253
1303
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1256,7 +1306,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1256
1306
|
if (errorHandling === "continue") {
|
|
1257
1307
|
// output the timeout message
|
|
1258
1308
|
if (errorMessage) {
|
|
1259
|
-
await ((
|
|
1309
|
+
await ((_11 = api.output) === null || _11 === void 0 ? void 0 : _11.call(api, errorMessage, null));
|
|
1260
1310
|
}
|
|
1261
1311
|
// Set default node as next node
|
|
1262
1312
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1268,7 +1318,7 @@ exports.AI_AGENT_JOB = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
1268
1318
|
if (!errorHandlingGotoTarget) {
|
|
1269
1319
|
throw new Error("GoTo Target is required");
|
|
1270
1320
|
}
|
|
1271
|
-
if (!((
|
|
1321
|
+
if (!((_12 = api.checkThink) === null || _12 === void 0 ? void 0 : _12.call(api, nodeId))) {
|
|
1272
1322
|
api.resetNextNodes();
|
|
1273
1323
|
await api.executeFlow({
|
|
1274
1324
|
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
|