@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
|
@@ -47,6 +47,13 @@ export const SAY = createNodeDescriptor({
|
|
|
47
47
|
],
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
key: "preventTranscript",
|
|
52
|
+
type: "toggle",
|
|
53
|
+
defaultValue: false,
|
|
54
|
+
label: "UI__NODE_EDITOR__MESSAGE__SAY__FIELDS__PREVENT_TRANSCRIPT__LABEL",
|
|
55
|
+
description: "UI__NODE_EDITOR__MESSAGE__SAY__FIELDS__PREVENT_TRANSCRIPT__DESCRIPTION",
|
|
56
|
+
},
|
|
50
57
|
...getRephraseWithAIFields(),
|
|
51
58
|
].filter(field => !!field),
|
|
52
59
|
sections: [
|
|
@@ -58,12 +65,21 @@ export const SAY = createNodeDescriptor({
|
|
|
58
65
|
fields: [
|
|
59
66
|
"handoverOutput",
|
|
60
67
|
]
|
|
61
|
-
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "advanced",
|
|
71
|
+
label: "UI__NODE_EDITOR__MESSAGE__SAY__SECTIONS__ADVANCED__LABEL",
|
|
72
|
+
defaultCollapsed: true,
|
|
73
|
+
fields: [
|
|
74
|
+
"preventTranscript",
|
|
75
|
+
],
|
|
76
|
+
},
|
|
62
77
|
].filter(section => !!section),
|
|
63
78
|
form: [
|
|
64
79
|
{ type: "field", key: "say" },
|
|
65
80
|
{ type: "section", key: "aiEnhancedOutput" },
|
|
66
81
|
{ type: "section", key: "handoverSettings" },
|
|
82
|
+
{ type: "section", key: "advanced" }
|
|
67
83
|
],
|
|
68
84
|
preview: {
|
|
69
85
|
key: "say",
|
|
@@ -121,8 +137,14 @@ export const SAY = createNodeDescriptor({
|
|
|
121
137
|
if ((_a = _data === null || _data === void 0 ? void 0 : _data._cognigy) === null || _a === void 0 ? void 0 : _a._default) {
|
|
122
138
|
delete _data._cognigy._default;
|
|
123
139
|
}
|
|
140
|
+
let sayData = _data;
|
|
141
|
+
if (config.preventTranscript) {
|
|
142
|
+
sayData = sayData || {};
|
|
143
|
+
sayData._cognigy = sayData._cognigy || {};
|
|
144
|
+
sayData._cognigy._preventTranscript = true;
|
|
145
|
+
}
|
|
124
146
|
outputText = yield rephraseSentenceWithAI(outputText, config, api, organisationId);
|
|
125
|
-
yield api.say(outputText,
|
|
147
|
+
yield api.say(outputText, sayData, settings);
|
|
126
148
|
}
|
|
127
149
|
else {
|
|
128
150
|
const _cognigyDefault = (_b = _data === null || _data === void 0 ? void 0 : _data._cognigy) === null || _b === void 0 ? void 0 : _b._default;
|
|
@@ -145,11 +167,15 @@ export const SAY = createNodeDescriptor({
|
|
|
145
167
|
else if ((_f = _cognigyDefault === null || _cognigyDefault === void 0 ? void 0 : _cognigyDefault[typeKey]) === null || _f === void 0 ? void 0 : _f.fallbackText) {
|
|
146
168
|
_cognigyDefault[typeKey].fallbackText = yield rephraseSentenceWithAI(_cognigyDefault[typeKey].fallbackText, config, api, organisationId);
|
|
147
169
|
}
|
|
170
|
+
const data = config.say;
|
|
171
|
+
if (config.preventTranscript) {
|
|
172
|
+
data._cognigy = Object.assign(Object.assign({}, (data._cognigy || {})), { _preventTranscript: true });
|
|
173
|
+
}
|
|
148
174
|
/**
|
|
149
175
|
* This is a say node which is set to a type other than 'text' -
|
|
150
176
|
* so we have one of the new rich-media types such as 'gallery'
|
|
151
177
|
*/
|
|
152
|
-
yield api.say(null,
|
|
178
|
+
yield api.say(null, data, settings);
|
|
153
179
|
}
|
|
154
180
|
}),
|
|
155
181
|
});
|
|
@@ -625,7 +625,7 @@ export const GPT_PROMPT = createNodeDescriptor({
|
|
|
625
625
|
}
|
|
626
626
|
});
|
|
627
627
|
try {
|
|
628
|
-
const isStreamingChannel = input.channel === "webchat3";
|
|
628
|
+
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
629
629
|
const _messageId = randomUUID();
|
|
630
630
|
const data = {
|
|
631
631
|
prompt,
|
|
@@ -74,7 +74,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
74
74
|
{
|
|
75
75
|
key: "description",
|
|
76
76
|
label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__JOB_DESCRIPTION__LABEL",
|
|
77
|
-
type: "
|
|
77
|
+
type: "cognigyLLMText",
|
|
78
78
|
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.",
|
|
79
79
|
params: {
|
|
80
80
|
required: false,
|
|
@@ -88,7 +88,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
88
88
|
description: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__FIELDS__INSCTRUCTIONS__DESCRIPTION",
|
|
89
89
|
defaultValue: `- Pretend to be an expert in your area.
|
|
90
90
|
- Never answer questions that are outside your job.`,
|
|
91
|
-
type: "
|
|
91
|
+
type: "cognigyLLMText",
|
|
92
92
|
params: {
|
|
93
93
|
required: false,
|
|
94
94
|
rows: 5,
|
|
@@ -639,11 +639,10 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
639
639
|
defaultValue: "",
|
|
640
640
|
type: "ttsSelect",
|
|
641
641
|
label: "_unused_",
|
|
642
|
-
description: "_unused_",
|
|
643
642
|
params: {
|
|
644
643
|
languageKey: "config.ttsLanguage",
|
|
645
644
|
modelKey: "config.ttsModel",
|
|
646
|
-
voiceKey: "config.ttsVoice"
|
|
645
|
+
voiceKey: "config.ttsVoice",
|
|
647
646
|
},
|
|
648
647
|
condition: {
|
|
649
648
|
key: "voiceSetting",
|
|
@@ -668,6 +667,37 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
668
667
|
type: "ttsSelect",
|
|
669
668
|
defaultValue: "",
|
|
670
669
|
label: "_unused_",
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
key: "ttsLabel",
|
|
673
|
+
type: "cognigyText",
|
|
674
|
+
defaultValue: "",
|
|
675
|
+
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_LABEL__LABEL",
|
|
676
|
+
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_LABEL__DESCRIPTION",
|
|
677
|
+
condition: {
|
|
678
|
+
and: [
|
|
679
|
+
{
|
|
680
|
+
negate: true,
|
|
681
|
+
key: "ttsVendor",
|
|
682
|
+
value: "", // We show the field for all vendors as soon as it is defined
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
key: "voiceSetting",
|
|
686
|
+
value: "jobVoice"
|
|
687
|
+
}
|
|
688
|
+
]
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
key: "ttsDisableCache",
|
|
693
|
+
type: "toggle",
|
|
694
|
+
defaultValue: false,
|
|
695
|
+
label: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_DISABLE_CACHE__LABEL",
|
|
696
|
+
description: "UI__NODE_EDITOR__VOICEGATEWAY2__SET_SESSION_CONFIG__TTS_DISABLE_CACHE__DESCRIPTION",
|
|
697
|
+
condition: {
|
|
698
|
+
key: "voiceSetting",
|
|
699
|
+
value: "jobVoice"
|
|
700
|
+
},
|
|
671
701
|
}
|
|
672
702
|
],
|
|
673
703
|
sections: [
|
|
@@ -718,6 +748,8 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
718
748
|
fields: [
|
|
719
749
|
"voiceSetting",
|
|
720
750
|
"ttsVendor",
|
|
751
|
+
"ttsLabel",
|
|
752
|
+
"ttsDisableCache",
|
|
721
753
|
],
|
|
722
754
|
},
|
|
723
755
|
{
|
|
@@ -790,7 +822,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
790
822
|
],
|
|
791
823
|
tags: ["ai", "aiAgent"],
|
|
792
824
|
function: ({ cognigy, config, childConfigs, nodeId }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
793
|
-
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;
|
|
825
|
+
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;
|
|
794
826
|
const { api, context, input, profile, flowReferenceId } = cognigy;
|
|
795
827
|
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;
|
|
796
828
|
try {
|
|
@@ -806,6 +838,8 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
806
838
|
ttsLanguage: aiAgent.voiceConfigs.ttsLanguage,
|
|
807
839
|
ttsModel: aiAgent.voiceConfigs.ttsModel,
|
|
808
840
|
ttsVoice: aiAgent.voiceConfigs.ttsVoice,
|
|
841
|
+
ttsLabel: aiAgent.voiceConfigs.ttsLabel,
|
|
842
|
+
ttsDisableCache: aiAgent.voiceConfigs.ttsDisableCache,
|
|
809
843
|
});
|
|
810
844
|
}
|
|
811
845
|
else {
|
|
@@ -815,6 +849,8 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
815
849
|
ttsLanguage: "",
|
|
816
850
|
ttsModel: "",
|
|
817
851
|
ttsVoice: "",
|
|
852
|
+
ttsLabel: "",
|
|
853
|
+
ttsDisableCache: false,
|
|
818
854
|
});
|
|
819
855
|
}
|
|
820
856
|
}
|
|
@@ -836,7 +872,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
836
872
|
throw new Error(`[VG2] Error on AI Agent Job node. Error message: ${error.message}`);
|
|
837
873
|
}
|
|
838
874
|
}
|
|
839
|
-
const
|
|
875
|
+
const _13 = profile, { profileId, accepted_gdpr, prevent_data_collection, privacy_policy } = _13, cleanedProfile = __rest(_13, ["profileId", "accepted_gdpr", "prevent_data_collection", "privacy_policy"]);
|
|
840
876
|
const userMemory = getUserMemory(memoryType, selectedProfileFields, aiAgent, cleanedProfile);
|
|
841
877
|
/**
|
|
842
878
|
* ----- Knowledge Search Section -----
|
|
@@ -952,26 +988,35 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
952
988
|
}
|
|
953
989
|
}
|
|
954
990
|
// ----- End of Knowledge Search Section ----- //
|
|
991
|
+
const isOnDemandKnowledgeStoreConfigured = knowledgeSearchBehavior === "onDemand" && ((knowledgeSearchAiAgentKnowledge && aiAgent.knowledgeReferenceId) || (knowledgeSearchJobKnowledge && knowledgeSearchJobStore));
|
|
955
992
|
// create the system Message from the AI Agent resource and this Node's config storage
|
|
956
|
-
const systemMessage = createSystemMessage(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection,
|
|
993
|
+
const systemMessage = createSystemMessage(aiAgent, input, jobName, jobDescription, jobInstructions, userMemory, memoryContextInjection, isOnDemandKnowledgeStoreConfigured ? "onDemand" : "none");
|
|
957
994
|
// Create Tools JSON
|
|
958
995
|
const tools = [];
|
|
959
996
|
const toolIds = [];
|
|
960
997
|
childConfigs.forEach(child => {
|
|
998
|
+
if (child.type === "aiAgentJobDefault") {
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
;
|
|
961
1002
|
const toolId = child.config.toolId;
|
|
962
|
-
if (!
|
|
963
|
-
throw new Error(`Tool ID
|
|
1003
|
+
if (!toolId) {
|
|
1004
|
+
throw new Error(`Tool ID is missing in Tool Node configuration.`);
|
|
1005
|
+
}
|
|
1006
|
+
const parsedToolId = api.parseCognigyScriptText(toolId);
|
|
1007
|
+
if (!validateToolId(parsedToolId)) {
|
|
1008
|
+
throw new Error(`Tool ID ${parsedToolId} is not valid. Please use only alphanumeric characters, dashes and underscores.`);
|
|
964
1009
|
}
|
|
965
|
-
if (toolIds.includes(
|
|
966
|
-
throw new Error(`Tool ID ${
|
|
1010
|
+
if (toolIds.includes(parsedToolId)) {
|
|
1011
|
+
throw new Error(`Tool ID ${parsedToolId} is not unique. Please ensure each tool has a unique id.`);
|
|
967
1012
|
}
|
|
968
|
-
toolIds.push(
|
|
1013
|
+
toolIds.push(parsedToolId);
|
|
969
1014
|
if (child.type === "aiAgentJobTool" && (!child.config.condition || !!api.parseCognigyScriptCondition(child.config.condition))) {
|
|
970
1015
|
const tool = {
|
|
971
1016
|
type: "function",
|
|
972
1017
|
function: {
|
|
973
|
-
name:
|
|
974
|
-
description: child.config.description,
|
|
1018
|
+
name: parsedToolId,
|
|
1019
|
+
description: api.parseCognigyScriptText(child.config.description),
|
|
975
1020
|
}
|
|
976
1021
|
};
|
|
977
1022
|
if (useStrict) {
|
|
@@ -1047,11 +1092,13 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1047
1092
|
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'}`);
|
|
1048
1093
|
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'}`);
|
|
1049
1094
|
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'}`);
|
|
1095
|
+
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'}`);
|
|
1096
|
+
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'}`);
|
|
1050
1097
|
(_t = api.logDebugMessage) === null || _t === void 0 ? void 0 : _t.call(api, messageLines.join("\n"), "UI__DEBUG_MODE__AI_AGENT_JOB__CONFIGURATION__HEADER");
|
|
1051
1098
|
}
|
|
1052
1099
|
// keep this after the debug message since the "retrieve_knowledge" tool is implicit
|
|
1053
1100
|
// we only add this tool if at least one knowledge source is enabled
|
|
1054
|
-
if (
|
|
1101
|
+
if (isOnDemandKnowledgeStoreConfigured) {
|
|
1055
1102
|
const knowledgeTool = {
|
|
1056
1103
|
type: "function",
|
|
1057
1104
|
function: {
|
|
@@ -1094,7 +1141,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1094
1141
|
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}`;
|
|
1095
1142
|
transcript[transcript.length - 1].payload.text = enhancedInput;
|
|
1096
1143
|
}
|
|
1097
|
-
const isStreamingChannel = input.channel === "webchat3";
|
|
1144
|
+
const isStreamingChannel = input.channel === "webchat3" || input.channel === "adminconsole";
|
|
1098
1145
|
const _messageId = randomUUID();
|
|
1099
1146
|
const llmPromptOptions = Object.assign(Object.assign({ prompt: "", chat: systemMessage,
|
|
1100
1147
|
// Temp fix to override the transcript if needed
|
|
@@ -1137,7 +1184,10 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1137
1184
|
if (llmResult.finishReason === "tool_calls" && llmResult.toolCalls.length > 0) {
|
|
1138
1185
|
const mainToolCall = llmResult.toolCalls[0];
|
|
1139
1186
|
// Find the child node with the toolId of the tool call
|
|
1140
|
-
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; });
|
|
1187
|
+
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; });
|
|
1188
|
+
if (mainToolCall.function.name !== "retrieve_knowledge" && toolChild === undefined) {
|
|
1189
|
+
(_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");
|
|
1190
|
+
}
|
|
1141
1191
|
// Add last tool call to session state for loading it from Tool Answer Node
|
|
1142
1192
|
api.updateSessionStateValues({
|
|
1143
1193
|
lastToolCall: {
|
|
@@ -1151,13 +1201,13 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1151
1201
|
});
|
|
1152
1202
|
// if there are any parameters/arguments, add them to the input slots
|
|
1153
1203
|
if (mainToolCall.function.arguments) {
|
|
1154
|
-
input.aiAgent = Object.assign(Object.assign({}, input.aiAgent), { toolArgs: Object.assign(Object.assign({}, (
|
|
1204
|
+
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) });
|
|
1155
1205
|
}
|
|
1156
1206
|
// Debug Message for Tool Calls, configured in the Tool Node
|
|
1157
|
-
if (toolChild === null || toolChild === void 0 ? void 0 : toolChild.config.debugMessage) {
|
|
1158
|
-
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${toolChild.config.toolId}`];
|
|
1207
|
+
if ((_2 = toolChild === null || toolChild === void 0 ? void 0 : toolChild.config) === null || _2 === void 0 ? void 0 : _2.debugMessage) {
|
|
1208
|
+
const messageLines = [`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__HEADER:</b> ${api.parseCognigyScriptText(toolChild.config.toolId)}`];
|
|
1159
1209
|
// Arguments / Parameters Slots
|
|
1160
|
-
const slots = ((
|
|
1210
|
+
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);
|
|
1161
1211
|
const hasSlots = slots && slots.length > 0;
|
|
1162
1212
|
messageLines.push(`<b>UI__DEBUG_MODE__AI_AGENT_JOB__TOOL_CALL__DEBUG_MESSAGE__SLOTS</b>${hasSlots ? "" : " -"}`);
|
|
1163
1213
|
if (hasSlots) {
|
|
@@ -1172,7 +1222,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1172
1222
|
messageLines.push(`- ${slot}: ${slotValueAsString}`);
|
|
1173
1223
|
});
|
|
1174
1224
|
}
|
|
1175
|
-
(
|
|
1225
|
+
(_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");
|
|
1176
1226
|
}
|
|
1177
1227
|
if (toolChild) {
|
|
1178
1228
|
api.setNextNode(toolChild.id);
|
|
@@ -1197,7 +1247,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1197
1247
|
}
|
|
1198
1248
|
// Optionally output the result immediately
|
|
1199
1249
|
if (llmResult.result && outputImmediately && !llmPromptOptions.stream) {
|
|
1200
|
-
yield ((
|
|
1250
|
+
yield ((_5 = api.output) === null || _5 === void 0 ? void 0 : _5.call(api, llmResult.result, {}));
|
|
1201
1251
|
}
|
|
1202
1252
|
// If we are streaming and we got a result, also store it into the transcript, since streamed chunks are not stored there
|
|
1203
1253
|
if (llmResult.result && llmPromptOptions.stream) {
|
|
@@ -1214,7 +1264,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1214
1264
|
}
|
|
1215
1265
|
// Add response to Cognigy Input/Context for further usage
|
|
1216
1266
|
if (storeLocation === "context") {
|
|
1217
|
-
(
|
|
1267
|
+
(_6 = api.addToContext) === null || _6 === void 0 ? void 0 : _6.call(api, contextKey, llmResult, "simple");
|
|
1218
1268
|
}
|
|
1219
1269
|
else if (storeLocation === "input") {
|
|
1220
1270
|
api.addToInput(inputKey, llmResult);
|
|
@@ -1227,14 +1277,14 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1227
1277
|
const errorDetails = {
|
|
1228
1278
|
name: (error === null || error === void 0 ? void 0 : error.name) || "Error",
|
|
1229
1279
|
code: (error === null || error === void 0 ? void 0 : error.code) || (error === null || error === void 0 ? void 0 : error.httpStatusCode),
|
|
1230
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || ((
|
|
1280
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || ((_7 = error.originalErrorDetails) === null || _7 === void 0 ? void 0 : _7.message),
|
|
1231
1281
|
};
|
|
1232
|
-
(
|
|
1282
|
+
(_8 = api.emitEvent) === null || _8 === void 0 ? void 0 : _8.call(api, "nodeError", { nodeId, flowId: flowReferenceId, errorMessage: error });
|
|
1233
1283
|
if (logErrorToSystem) {
|
|
1234
|
-
(
|
|
1284
|
+
(_9 = api.log) === null || _9 === void 0 ? void 0 : _9.call(api, "error", JSON.stringify(errorDetails));
|
|
1235
1285
|
}
|
|
1236
1286
|
if (errorHandling !== "stop") {
|
|
1237
|
-
(
|
|
1287
|
+
(_10 = api.logDebugError) === null || _10 === void 0 ? void 0 : _10.call(api, errorDetails.message + (errorDetails.code ? ` (error code: ${errorDetails.code})` : ""), errorDetails.name);
|
|
1238
1288
|
}
|
|
1239
1289
|
if (storeErrorInInput) {
|
|
1240
1290
|
input.aiAgent = input.aiAgent || {};
|
|
@@ -1243,7 +1293,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1243
1293
|
if (errorHandling === "continue") {
|
|
1244
1294
|
// output the timeout message
|
|
1245
1295
|
if (errorMessage) {
|
|
1246
|
-
yield ((
|
|
1296
|
+
yield ((_11 = api.output) === null || _11 === void 0 ? void 0 : _11.call(api, errorMessage, null));
|
|
1247
1297
|
}
|
|
1248
1298
|
// Set default node as next node
|
|
1249
1299
|
const defaultChild = childConfigs.find(child => child.type === "aiAgentJobDefault");
|
|
@@ -1255,7 +1305,7 @@ export const AI_AGENT_JOB = createNodeDescriptor({
|
|
|
1255
1305
|
if (!errorHandlingGotoTarget) {
|
|
1256
1306
|
throw new Error("GoTo Target is required");
|
|
1257
1307
|
}
|
|
1258
|
-
if (!((
|
|
1308
|
+
if (!((_12 = api.checkThink) === null || _12 === void 0 ? void 0 : _12.call(api, nodeId))) {
|
|
1259
1309
|
api.resetNextNodes();
|
|
1260
1310
|
yield api.executeFlow({
|
|
1261
1311
|
flowNode: {
|
|
@@ -17,6 +17,26 @@ export const CHECK_AGENT_AVAILABILITY = createNodeDescriptor({
|
|
|
17
17
|
},
|
|
18
18
|
tags: ["service"],
|
|
19
19
|
fields: [
|
|
20
|
+
{
|
|
21
|
+
key: "checkAgentAvailabilityProvider",
|
|
22
|
+
label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__LABEL",
|
|
23
|
+
type: "checkAgentAvailabilityProvider",
|
|
24
|
+
description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__DESCRIPTION",
|
|
25
|
+
defaultValue: "legacyEndpoint",
|
|
26
|
+
params: {
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: "checkAgentAvailabilityConfig",
|
|
32
|
+
label: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__LABEL",
|
|
33
|
+
type: "json",
|
|
34
|
+
description: "UI__NODE_EDITOR__SERVICE__HANDOVER_TO_AGENT__FIELDS__HANDOVER_PROVIDER__DESCRIPTION",
|
|
35
|
+
defaultValue: {},
|
|
36
|
+
params: {
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
20
40
|
{
|
|
21
41
|
key: "chatwootInboxId",
|
|
22
42
|
type: "cognigyText",
|
|
@@ -151,7 +171,20 @@ export const CHECK_AGENT_AVAILABILITY = createNodeDescriptor({
|
|
|
151
171
|
defaultCollapsed: true,
|
|
152
172
|
fields: [
|
|
153
173
|
"chatwootInboxId",
|
|
154
|
-
]
|
|
174
|
+
],
|
|
175
|
+
condition: {
|
|
176
|
+
or: [
|
|
177
|
+
{
|
|
178
|
+
key: "checkAgentAvailabilityProvider",
|
|
179
|
+
value: "legacyEndpoint"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
key: "checkAgentAvailabilityProvider",
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
value: null
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
155
188
|
},
|
|
156
189
|
{
|
|
157
190
|
key: "liveAgentSettings",
|
|
@@ -161,7 +194,20 @@ export const CHECK_AGENT_AVAILABILITY = createNodeDescriptor({
|
|
|
161
194
|
COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_INBOX_ID,
|
|
162
195
|
COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_SKILLS,
|
|
163
196
|
COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS.LIVE_AGENT_LANGUAGES,
|
|
164
|
-
]
|
|
197
|
+
],
|
|
198
|
+
condition: {
|
|
199
|
+
or: [
|
|
200
|
+
{
|
|
201
|
+
key: "checkAgentAvailabilityProvider",
|
|
202
|
+
value: "legacyEndpoint"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
key: "checkAgentAvailabilityProvider",
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
value: null
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
165
211
|
},
|
|
166
212
|
{
|
|
167
213
|
key: "genesysCloudSettings",
|
|
@@ -171,7 +217,20 @@ export const CHECK_AGENT_AVAILABILITY = createNodeDescriptor({
|
|
|
171
217
|
"genesysCloudSkills",
|
|
172
218
|
"genesysCloudProfileSkills",
|
|
173
219
|
"genesysCloudLanguageSkills"
|
|
174
|
-
]
|
|
220
|
+
],
|
|
221
|
+
condition: {
|
|
222
|
+
or: [
|
|
223
|
+
{
|
|
224
|
+
key: "checkAgentAvailabilityProvider",
|
|
225
|
+
value: "legacyEndpoint"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
key: "checkAgentAvailabilityProvider",
|
|
229
|
+
// @ts-ignore
|
|
230
|
+
value: null
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}
|
|
175
234
|
},
|
|
176
235
|
{
|
|
177
236
|
key: "storage",
|
|
@@ -195,6 +254,7 @@ export const CHECK_AGENT_AVAILABILITY = createNodeDescriptor({
|
|
|
195
254
|
}
|
|
196
255
|
],
|
|
197
256
|
form: [
|
|
257
|
+
{ type: "field", key: "checkAgentAvailabilityProvider" },
|
|
198
258
|
{ type: "section", key: "genesysCloudSettings" },
|
|
199
259
|
// only render this field if "live agent" is enabled
|
|
200
260
|
process.env.FEATURE_USE_COGNIGY_LIVE_AGENT === "true" && {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const LIVE_AGENT_CONNECTION = {
|
|
2
|
+
type: "live_agent",
|
|
3
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__LIVE_AGENT_CONNECTION_AUTHENTICATION__LABEL",
|
|
4
|
+
fields: [
|
|
5
|
+
{ fieldName: "apiKey", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__LIVE_AGENT__API_KEY__LABEL" }
|
|
6
|
+
]
|
|
7
|
+
};
|
|
8
|
+
export const RINGCENTRAL_ENGAGE_CONNECTION = {
|
|
9
|
+
type: "ringcentral_engage",
|
|
10
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE_CONNECTION_AUTHENTICATION__LABEL",
|
|
11
|
+
fields: [
|
|
12
|
+
{ fieldName: "webhookSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE__WEBHOOK_SECRET__LABEL" },
|
|
13
|
+
{ fieldName: "realtimeAccessToken", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE__REALTIME_ACCESS_TOKEN__LABEL" },
|
|
14
|
+
{ fieldName: "apiAccessToken", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__RINGCENTRAL_ENGAGE__API_ACCESS_TOKEN__LABEL" }
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
export const CHATWOOT_CONNECTION = {
|
|
18
|
+
type: "chatwoot",
|
|
19
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__CHATWOOT_CONNECTION_AUTHENTICATION__LABEL",
|
|
20
|
+
fields: [
|
|
21
|
+
{ fieldName: "apiKey", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__CHATWOOT__API_KEY__LABEL" }
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export const EIGHT_BY_EIGHT_CONNECTION = {
|
|
25
|
+
type: "eight_by_eight",
|
|
26
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__EIGHTBYEIGHT_CONNECTION_AUTHENTICATION__LABEL",
|
|
27
|
+
fields: [
|
|
28
|
+
{ fieldName: "apiAccessToken", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__EIGHTBYEIGHT__API_ACCESS_TOKEN__LABEL" }
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
export const GENESYS_CLOUD_CONNECTION = {
|
|
32
|
+
type: "genesys_cloud",
|
|
33
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD_CONNECTION_AUTHENTICATION__LABEL",
|
|
34
|
+
fields: [
|
|
35
|
+
{ fieldName: "clientId", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_ID__LABEL" },
|
|
36
|
+
{ fieldName: "clientSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_SECRET__LABEL" },
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
export const GENESYS_CLOUD_CONNECTION_OM = {
|
|
40
|
+
type: "genesys_cloud_om",
|
|
41
|
+
label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD_CONNECTION_AUTHENTICATION__LABEL",
|
|
42
|
+
fields: [
|
|
43
|
+
{ fieldName: "clientId", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_ID__LABEL" },
|
|
44
|
+
{ fieldName: "clientSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__CLIENT_SECRET__LABEL" },
|
|
45
|
+
{ fieldName: "webhookSecret", label: "UI__HANDOVER_PROVIDER_EDITOR__HANDOVER_FORM__GENESYS_CLOUD__WEBHOOK_SECRET__LABEL" }
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=handoverConnections.js.map
|