@cognigy/rest-api-client 0.13.2 → 0.14.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/build/apigroups/ResourcesAPIGroup_2_0.js +15 -3
  3. package/build/shared/charts/descriptors/apps/setHtmlAppState.js +83 -13
  4. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/azureOpenAIProviderConnection.js +14 -0
  5. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/index.js +19 -0
  6. package/build/shared/charts/descriptors/connectionNodes/generativeAIProviders/openAIProviderConnection.js +11 -0
  7. package/build/shared/charts/descriptors/index.js +8 -5
  8. package/build/shared/charts/descriptors/message/question/optionalQuestion.js +22 -6
  9. package/build/shared/charts/descriptors/message/question/question.js +193 -25
  10. package/build/shared/charts/descriptors/message/say.js +33 -2
  11. package/build/shared/charts/descriptors/service/completeText.js +316 -0
  12. package/build/shared/charts/descriptors/service/handoverV2.js +47 -1
  13. package/build/shared/charts/descriptors/service/index.js +3 -1
  14. package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +40 -7
  15. package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +93 -32
  16. package/build/shared/charts/descriptors/voice/nodes/play.js +8 -6
  17. package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +90 -8
  18. package/build/shared/charts/descriptors/voice/nodes/transfer.js +2 -2
  19. package/build/shared/charts/descriptors/voice/utils/helper.js +11 -1
  20. package/build/shared/charts/descriptors/voicegateway/nodes/agentAssist.js +2 -2
  21. package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +4 -1
  22. package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +3 -3
  23. package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +125 -26
  24. package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +91 -7
  25. package/build/shared/charts/descriptors/voicegateway2/utils/helper.js +18 -11
  26. package/build/shared/charts/descriptors/voicegateway2/utils/strip-nulls.js +4 -1
  27. package/build/shared/charts/helpers/generativeAI/getRephraseWithAIFields.js +100 -0
  28. package/build/shared/charts/helpers/generativeAI/rephraseSentenceWithAi.js +44 -0
  29. package/build/shared/constants.js +2 -1
  30. package/build/shared/interfaces/ai.js +16 -0
  31. package/build/shared/interfaces/analytics/IAnalyticsDataGoals.js +3 -0
  32. package/build/shared/interfaces/endpointInterface.js +1 -0
  33. package/build/shared/interfaces/filemanager/IRuntimeFile.js +30 -0
  34. package/build/shared/interfaces/filemanager/index.js +1 -0
  35. package/build/shared/interfaces/handover.js +39 -3
  36. package/build/shared/interfaces/messageAPI/endpoints.js +2 -0
  37. package/build/shared/interfaces/messageAPI/handover.js +6 -0
  38. package/build/shared/interfaces/resources/IConnectionSchema.js +2 -1
  39. package/build/shared/interfaces/resources/IExtension.js +2 -1
  40. package/build/shared/interfaces/resources/IFlow.js +2 -1
  41. package/build/shared/interfaces/resources/ILexicon.js +15 -2
  42. package/build/shared/interfaces/resources/INodeDescriptorSet.js +1 -1
  43. package/build/shared/interfaces/resources/intent/IIntent.js +5 -2
  44. package/build/shared/interfaces/resources/intent/IIntentRelation.js +3 -1
  45. package/build/shared/interfaces/resources/settings/IAgentSettings.js +9 -4
  46. package/build/shared/interfaces/resources/settings/IGenerativeAISettings.js +136 -0
  47. package/build/shared/interfaces/resources/settings/index.js +7 -1
  48. package/build/shared/interfaces/restAPI/resources/flow/v2.0/sentence/IGenerateSentencesRest_2_0.js +3 -0
  49. package/package.json +1 -1
  50. package/types/index.d.ts +569 -184
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.14.0
2
+ Released: February 7th, 2023
3
+
4
+ Released state of package up to date with Cognigy.AI v4.44.0
1
5
 
2
6
  # 0.13.2
3
7
  Released: December 21st, 2022
@@ -15,7 +19,7 @@ Updated changelog
15
19
  # 0.13.0
16
20
  Released: November 22nd, 2022
17
21
 
18
- Released state of package up to date with Cognigy.AI v4.44.0
22
+ Released state of package up to date with Cognigy.AI v4.39.1
19
23
 
20
24
  # 0.12.0
21
25
 
@@ -86,7 +86,15 @@ const ResourcesAPIGroup_2_0 = (instance) => {
86
86
  var { projectId } = _a, args = __rest(_a, ["projectId"]);
87
87
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/lexicons?${(0, query_1.stringifyQuery)({ projectId })}`, "PATCH", self)(args, options);
88
88
  },
89
- createLexicon: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/lexicons", "POST", self)(args, options),
89
+ createLexicon: (_a, options) => {
90
+ var { shouldGenerateLexiconEntries, generateLexiconEntriesLimit, defaultSlot, languageCode } = _a, args = __rest(_a, ["shouldGenerateLexiconEntries", "generateLexiconEntriesLimit", "defaultSlot", "languageCode"]);
91
+ return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/lexicons?${(0, query_1.stringifyQuery)({
92
+ shouldGenerateLexiconEntries,
93
+ generateLexiconEntriesLimit,
94
+ defaultSlot,
95
+ languageCode
96
+ })}`, "POST", self)(args, options);
97
+ },
90
98
  readLexicon: ({ lexiconId, metaOnly }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/lexicons/${lexiconId}?${(0, query_1.stringifyQuery)({ metaOnly })}`, "GET", self)(undefined, options),
91
99
  updateLexicon: (_a, options) => {
92
100
  var { lexiconId } = _a, args = __rest(_a, ["lexiconId"]);
@@ -290,8 +298,11 @@ const ResourcesAPIGroup_2_0 = (instance) => {
290
298
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents`, "PATCH", self)(args, options);
291
299
  },
292
300
  createIntent: (_a, options) => {
293
- var { flowId } = _a, args = __rest(_a, ["flowId"]);
294
- return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents`, "POST", self)(args, options);
301
+ var { flowId, shouldGenerateSentences, generateSentenceLimit } = _a, args = __rest(_a, ["flowId", "shouldGenerateSentences", "generateSentenceLimit"]);
302
+ return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents?${(0, query_1.stringifyQuery)({
303
+ shouldGenerateSentences,
304
+ generateSentenceLimit
305
+ })}`, "POST", self)(args, options);
295
306
  },
296
307
  readIntent: (_a, options) => {
297
308
  var { intentId, flowId } = _a, args = __rest(_a, ["intentId", "flowId"]);
@@ -357,6 +368,7 @@ const ResourcesAPIGroup_2_0 = (instance) => {
357
368
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents/${intentId}/sentences/${sentenceId}`, "PATCH", self)(args, options);
358
369
  },
359
370
  deleteSentence: ({ sentenceId, intentId, flowId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents/${intentId}/sentences/${sentenceId}`, "DELETE", self)(undefined, options),
371
+ generateSentences: ({ intentId, flowId, localeId, limit }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents/${intentId}/sentences/generate?${(0, query_1.stringifyQuery)({ localeId, limit })}`, "POST", self)(undefined, options),
360
372
  indexLearningSentences: (_a, options) => {
361
373
  var { flowId, intentId } = _a, args = __rest(_a, ["flowId", "intentId"]);
362
374
  return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/flows/${flowId}/intents/learningsentences?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options);
@@ -3,18 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SET_HTML_APP_STATE = void 0;
4
4
  /* Custom modules */
5
5
  const createNodeDescriptor_1 = require("../../createNodeDescriptor");
6
- const getEasyHtmlValue = (body) => `<!DOCTYPE html>
6
+ const getEasyHtmlValue = (body) => /* html */ `<!DOCTYPE html>
7
7
  <html lang="en">
8
+
8
9
  <head>
9
- <script>
10
- var c=Object.defineProperty;var u=(a,e,t)=>e in a?c(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var s=(a,e,t)=>(u(a,typeof e!="symbol"?e+"":e,t),t);const h=a=>({__INTER_FRAME_SOCKET_MESSAGE:!0,appEvent:a}),l=(a,e)=>({type:a,payload:e}),p=a=>{var e;return!!((e=a.data)!=null&&e.__INTER_FRAME_SOCKET_MESSAGE)};class m{constructor(e,t){s(this,"unsubscribers",new Set);s(this,"emit",(e,t)=>{const i=l(e,t),n=h(i);this.targetWindow.postMessage(n,"*")});s(this,"on",(e,t)=>{const i=r=>{if(r.source===this.targetWindow&&!!p(r)&&r.data.appEvent.type===e)try{t(r.data.appEvent)}catch{}};this.sourceWindow.addEventListener("message",i);const n=()=>{this.sourceWindow.removeEventListener("message",i),this.unsubscribers.delete(n)};return this.unsubscribers.add(n),n});s(this,"once",(e,t)=>{const i=this.on(e,n=>{t(n),i()});return i});s(this,"cleanup",()=>{for(const e of this.unsubscribers)e()});this.sourceWindow=e,this.targetWindow=t}}class o{constructor(){s(this,"appTemplateData");s(this,"_ready",!1);s(this,"_loaded",!1);s(this,"_customReadyCheckRequested",!1);s(this,"_customReadyCheckDone",!1);s(this,"_appTemplateDataInitialized",!1);s(this,"socket",new m(window,window.parent));s(this,"sendReady",()=>{this._ready||(this.socket.emit("ready"),o.log("ready!"),this._ready=!0)});s(this,"doReadinessCheck",()=>{if(!this._ready){if(!this._appTemplateDataInitialized){o.log("not yet ready: initial app template data missing");return}if(!this._customReadyCheckRequested&&!this._loaded){o.log("not yet ready: page not loaded, yet");return}if(this._customReadyCheckRequested&&!this._customReadyCheckDone){o.log("not yet ready: custom readiness check not called");return}this.sendReady()}});s(this,"getCustomReadyHandler",()=>(o.log("switching to 'manual ready check'"),this._customReadyCheckRequested=!0,()=>{o.log("'manual ready check' done"),this._customReadyCheckDone=!0,this.doReadinessCheck()}));s(this,"onAppTemplateData",e=>this.socket.on("appTemplateData",t=>{e(t.payload)}));s(this,"getAppTemplateData",async()=>this._appTemplateDataInitialized?this.appTemplateData:new Promise(e=>{const t=this.onAppTemplateData(i=>{t(),e(i)})}));s(this,"submit",e=>new Promise((t,i)=>{const n=[],r=()=>{n.forEach(d=>{d()})};n.push(this.socket.once("submit-accepted",()=>{r(),t()})),n.push(this.socket.once("submit-rejected",()=>{r(),i()})),this.socket.emit("submit",e)}));window.addEventListener("load",()=>{this._loaded=!0,this.doReadinessCheck()}),this.onAppTemplateData(e=>{this._appTemplateDataInitialized=!0,this.appTemplateData=e,o.log("received data from shell page",e),this.doReadinessCheck()}),this.socket.emit("sdk-loaded"),o.log("initialized")}static log(...e){console.log("[AppPageSDK]",...e)}}window.SDK=new o;
11
- </script>
10
+ <!--
11
+ loads the App Page SDK, provided by Cognigy,
12
+ exposed as a global variable called "SDK".
13
+ -->
14
+ <script src="/sdk/app-page-sdk.js"></script>
15
+
16
+ <!--
17
+ Example: Form Submission
18
+
19
+ This example shows how you can use native HTML
20
+ form functionality to submit data from your App.
21
+
22
+ We're rendering a simple form with a text input
23
+ and a submit button.
24
+
25
+ The "name" attribute is important and will be used
26
+ to identify this field in the result!
27
+
28
+ Using this example, the end user can type a nickname
29
+ and submit it either via the button or by hitting "return".
30
+
31
+ The script will pick the first "form" element on the page
32
+ and configures it to submit its result via the "App Page SDK"
33
+ -->
34
+ <form>
35
+ <input name="nickname" placeholder="your nickname" />
36
+ <button>submit</button>
37
+ </form>
12
38
  <script>
13
39
  window.addEventListener("load", () => {
14
- const form = document.querySelector('form');
15
- form.onsubmit = e => {
16
- e.preventDefault();
17
- e.stopPropagation();
40
+ const form = document.querySelector('form');
41
+ form.onsubmit = e => {
42
+ e.preventDefault();
43
+ e.stopPropagation();
18
44
  const formData = new FormData(form);
19
45
  const values = [...formData.entries()].reduce((obj, [key, value]) => {
20
46
  obj[key] = value;
@@ -25,18 +51,62 @@ const getEasyHtmlValue = (body) => `<!DOCTYPE html>
25
51
  };
26
52
  });
27
53
  </script>
54
+
55
+
56
+
57
+ <!--
58
+ Example: Submitting fixed values
59
+
60
+ This example shows how to submit fixed values by clicking a button.
61
+ Clicking the "OK" button will submit { option: "ok" },
62
+ while clicking the "Cancel" button will submit { option: "cancel" }
63
+ -->
64
+ <!--
65
+ <button type="button" onclick="SDK.submit({ option: 'ok' })">OK</button>
66
+ <button type="button" onclick="SDK.submit({ option: 'cancel' })">Cancel</button>
67
+ -->
68
+
69
+
70
+
71
+ <!--
72
+ Example: Custom Readiness Handler
73
+
74
+ If your App Page needs to load additional resources
75
+ before being "ready", you can postpone the "readiness"
76
+ of your App Page with a "custom ready handler".
77
+
78
+ If you do this, the App Shell Page will show a "loading"
79
+ screen until you decide that this App Page is ready!
80
+
81
+ Beware: your App Page has 10 seconds to get ready,
82
+ otherwise it will be treated as "failed to load".
83
+ -->
84
+ <script>
85
+ const ready = SDK.getCustomReadyHandler();
86
+
87
+ // App Page "ready" after 2 seconds
88
+ setTimeout(() => {
89
+ ready();
90
+ }, 2000);
91
+ </script>
28
92
  </head>
93
+
29
94
  <body>
30
- ${body}
95
+ ${body}
31
96
  </body>
32
- </html>`;
33
- const defaultBody = `<form>
97
+
98
+ </html>
99
+ `;
100
+ const defaultBody =
101
+ /* html */
102
+ `<form>
34
103
  <input
35
104
  name="nickname"
36
- placeholder="your nickname"
105
+ placeholder="your nickname"
37
106
  />
38
107
  <button>submit</button>
39
- </form>`;
108
+ </form>
109
+ `;
40
110
  const defaultFullHTMLDocument = getEasyHtmlValue("");
41
111
  /**
42
112
  * Node name: 'setHTMLAppState'
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
+ exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = {
5
+ type: "AzureOpenAIProvider",
6
+ label: "A Connection to Azure Open.AI",
7
+ fields: [
8
+ { fieldName: "apiKey" },
9
+ { fieldName: "resourceName" },
10
+ { fieldName: "deploymentName" },
11
+ { fieldName: "apiVersion", required: false },
12
+ ]
13
+ };
14
+ //# sourceMappingURL=azureOpenAIProviderConnection.js.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cognigyGenerativeAIProviderModule = exports.AZURE_OPEAN_AI_PROVIDER_CONNECTION = exports.OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
+ /* Custom modules */
5
+ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
+ const openAIProviderConnection_1 = require("./openAIProviderConnection");
7
+ const azureOpenAIProviderConnection_1 = require("./azureOpenAIProviderConnection");
8
+ var openAIProviderConnection_2 = require("./openAIProviderConnection");
9
+ Object.defineProperty(exports, "OPEAN_AI_PROVIDER_CONNECTION", { enumerable: true, get: function () { return openAIProviderConnection_2.OPEAN_AI_PROVIDER_CONNECTION; } });
10
+ var azureOpenAIProviderConnection_2 = require("./azureOpenAIProviderConnection");
11
+ Object.defineProperty(exports, "AZURE_OPEAN_AI_PROVIDER_CONNECTION", { enumerable: true, get: function () { return azureOpenAIProviderConnection_2.AZURE_OPEAN_AI_PROVIDER_CONNECTION; } });
12
+ exports.cognigyGenerativeAIProviderModule = (0, createNodeDescriptor_1.createExtension)({
13
+ nodes: [],
14
+ connections: [
15
+ openAIProviderConnection_1.OPEAN_AI_PROVIDER_CONNECTION,
16
+ azureOpenAIProviderConnection_1.AZURE_OPEAN_AI_PROVIDER_CONNECTION
17
+ ]
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OPEAN_AI_PROVIDER_CONNECTION = void 0;
4
+ exports.OPEAN_AI_PROVIDER_CONNECTION = {
5
+ type: "OpenAIProvider",
6
+ label: "A Connection to Open.AI",
7
+ fields: [
8
+ { fieldName: "apiKey" },
9
+ ]
10
+ };
11
+ //# sourceMappingURL=openAIProviderConnection.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cognigyInternalStorageProviderModule = exports.cognigyVoiceGateway2Module = exports.cognigyMicrosoftModule = exports.cognigyVoiceGatewayModule = exports.cognigySMTPModule = exports.cognigySQLModule = exports.cognigyMongoDBModule = exports.cognigyBasicModule = void 0;
3
+ exports.cognigyGenerativeAIProviderModule = exports.cognigyInternalStorageProviderModule = exports.cognigyVoiceGateway2Module = exports.cognigyMicrosoftModule = exports.cognigyVoiceGatewayModule = exports.cognigySMTPModule = exports.cognigySQLModule = exports.cognigyMongoDBModule = exports.cognigyBasicModule = void 0;
4
4
  /* Custom modules */
5
5
  const createNodeDescriptor_1 = require("../createNodeDescriptor");
6
6
  /* Nodes */
@@ -79,19 +79,20 @@ const nodes = [
79
79
  service_1.HANDOVER_V2,
80
80
  service_1.CHECK_AGENT_AVAILABILITY,
81
81
  service_1.HTTP_REQUEST,
82
+ service_1.COMPLETE_TEXT,
82
83
  service_1.TRIGGER_FUNCTION,
83
84
  service_1.ON_SCHEDULING_ERROR,
84
85
  service_1.ON_SCHEDULED,
85
86
  // REQUIRED_FIELDS,
86
87
  // ALL_FIELDS,
87
88
  logic_1.ENABLE_SLOT_FILLERS,
88
- logic_1.DISABLE_SLOT_FILLERS,
89
+ logic_1.DISABLE_SLOT_FILLERS
89
90
  ];
90
91
  if (process.env.FEATURE_USE_COGNIGY_LIVE_AGENT === "true") {
91
92
  nodes.push(liveAgent_1.ASSIST_INFO);
92
93
  }
93
94
  if (process.env.FEATURE_USE_COGNIGY_APPS === "true") {
94
- nodes.push(apps_1.INIT_APP_SESSION, apps_1.SET_APP_STATE, apps_1.GET_APP_SESSION_PIN, apps_1.SET_HTML_APP_STATE, apps_1.SET_ADAPTIVE_CARD_APP_STATE);
95
+ nodes.push(apps_1.INIT_APP_SESSION, apps_1.GET_APP_SESSION_PIN, apps_1.SET_HTML_APP_STATE, apps_1.SET_ADAPTIVE_CARD_APP_STATE);
95
96
  }
96
97
  if (process.env.FEATURE_TMP_ENABLE_GENERIC_VOICE_NODES === "true") {
97
98
  nodes.push(voice_1.HANG_UP, voice_1.PLAY, voice_1.TRANSFER_VOICE, voice_1.BARGE_IN, voice_1.CONTINUOUS_ASR, voice_1.DTMF, voice_1.USER_INPUT_TIMEOUT, voice_1.SESSION_SPEECH_PARAMETERS);
@@ -108,8 +109,8 @@ exports.cognigyBasicModule = (0, createNodeDescriptor_1.createExtension)({
108
109
  service_1.HTTP_CONNECTION_BASIC,
109
110
  service_1.HTTP_CONNECTION_APIKEYAUTHKEY,
110
111
  service_1.HTTP_CONNECTION_APIKEYXKEY,
111
- service_1.HTTP_CONNECTION_OAUTH2,
112
- ],
112
+ service_1.HTTP_CONNECTION_OAUTH2
113
+ ]
113
114
  });
114
115
  var mongoDB_1 = require("./connectionNodes/mongoDB");
115
116
  Object.defineProperty(exports, "cognigyMongoDBModule", { enumerable: true, get: function () { return mongoDB_1.cognigyMongoDBModule; } });
@@ -125,4 +126,6 @@ var voicegateway2_1 = require("./voicegateway2");
125
126
  Object.defineProperty(exports, "cognigyVoiceGateway2Module", { enumerable: true, get: function () { return voicegateway2_1.cognigyVoiceGateway2Module; } });
126
127
  var internalStorageProviders_1 = require("./connectionNodes/internalStorageProviders");
127
128
  Object.defineProperty(exports, "cognigyInternalStorageProviderModule", { enumerable: true, get: function () { return internalStorageProviders_1.cognigyInternalStorageProviderModule; } });
129
+ var generativeAIProviders_1 = require("./connectionNodes/generativeAIProviders");
130
+ Object.defineProperty(exports, "cognigyGenerativeAIProviderModule", { enumerable: true, get: function () { return generativeAIProviders_1.cognigyGenerativeAIProviderModule; } });
128
131
  //# sourceMappingURL=index.js.map
@@ -6,6 +6,7 @@ const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
6
6
  const evaluateQuestionAnswer_1 = require("./utils/evaluateQuestionAnswer");
7
7
  const say_1 = require("../say");
8
8
  const BaseContext_1 = require("../../../../helper/BaseContext");
9
+ const getRephraseWithAIFields_1 = require("../../../helpers/generativeAI/getRephraseWithAIFields");
9
10
  exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
10
11
  type: "optionalQuestion",
11
12
  defaultLabel: "Optional Question",
@@ -178,8 +179,9 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
178
179
  ]
179
180
  },
180
181
  defaultValue: "answer"
181
- }
182
- ],
182
+ },
183
+ ...(0, getRephraseWithAIFields_1.getRephraseWithAIFields)(),
184
+ ].filter(field => !!field),
183
185
  sections: [
184
186
  {
185
187
  key: "context",
@@ -201,8 +203,9 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
201
203
  "retentionTime",
202
204
  "cognigyScript"
203
205
  ]
204
- }
205
- ],
206
+ },
207
+ (0, getRephraseWithAIFields_1.getRephraseWithAISection)(),
208
+ ].filter(section => !!section),
206
209
  form: [
207
210
  { type: "field", key: "type" },
208
211
  { type: "field", key: "keyphraseTag" },
@@ -211,6 +214,7 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
211
214
  { type: "field", key: "say" },
212
215
  { type: "section", key: "advanced" },
213
216
  { type: "section", key: "context" },
217
+ { type: "section", key: "aiEnhancedOutput" },
214
218
  ],
215
219
  preview: {
216
220
  key: "say",
@@ -224,7 +228,7 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
224
228
  placement: {}
225
229
  },
226
230
  tags: ["basic", "message", "nlu"],
227
- function: async ({ cognigy, config, childConfigs, nodeId }) => {
231
+ function: async ({ cognigy, config, childConfigs, nodeId, organisationId, }) => {
228
232
  const { say, retentionTime = 3, type, executeChildrenOnly, cognigyScript, storeResultInContext, contextKey } = config;
229
233
  const { regex: regexField } = config;
230
234
  const { keyphraseTag, usePositiveOnly } = config;
@@ -292,7 +296,19 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
292
296
  addConditionalEntrypointParams.cognigyScriptInput = input;
293
297
  }
294
298
  api.addConditionalEntrypoint(addConditionalEntrypointParams);
295
- say_1.SAY.function({ cognigy, config: { say }, childConfigs: [], nodeId });
299
+ const rephraseWithAIParams = {
300
+ generativeAI_rephraseOutputMode: config.generativeAI_rephraseOutputMode,
301
+ generativeAI_temperature: config.generativeAI_temperature,
302
+ generativeAI_amountOfLastUserInputs: config.generativeAI_amountOfLastUserInputs,
303
+ generativeAI_customInputs: config.generativeAI_customInputs,
304
+ promtType: "question",
305
+ questionType: config.type,
306
+ question: undefined,
307
+ answer: undefined,
308
+ };
309
+ rephraseWithAIParams.promtType = "question";
310
+ rephraseWithAIParams.questionType = config.type;
311
+ await say_1.SAY.function({ cognigy, config: Object.assign({ say }, rephraseWithAIParams), childConfigs: [], nodeId, organisationId });
296
312
  if (onQuestionChild) {
297
313
  api.setNextNode(onQuestionChild.id);
298
314
  }