@cognigy/rest-api-client 4.95.0 → 4.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/shared/charts/descriptors/analytics/addMemory.js +1 -1
- package/build/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +9 -1
- package/build/shared/charts/descriptors/service/GPTPrompt.js +10 -2
- package/build/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +158 -37
- package/build/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -1
- package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/continuousAsr.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/dtmf.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/hangup.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/noUserInput.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/play.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/sendMetadata.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +1 -1
- package/build/shared/charts/descriptors/voice/nodes/transfer.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/hangup.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/record.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/refer.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +1 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +47 -2
- package/build/shared/constants.js +10 -1
- package/build/shared/helper/nlu/textCleaner.js +10 -2
- package/build/shared/interfaces/generativeAI/IGenerativeAIModels.js +1 -0
- package/build/shared/interfaces/messageAPI/endpoints.js +2 -0
- package/build/shared/interfaces/messageAPI/handover.js +3 -3
- package/build/shared/interfaces/resources/IAiAgent.js +10 -0
- package/build/shared/interfaces/resources/intent/IDefaultReply.js +0 -1
- package/dist/esm/shared/charts/descriptors/analytics/addMemory.js +1 -1
- package/dist/esm/shared/charts/descriptors/knowledgeSearch/searchExtractOutput.js +9 -1
- package/dist/esm/shared/charts/descriptors/service/GPTPrompt.js +10 -2
- package/dist/esm/shared/charts/descriptors/service/aiAgent/aiAgentJob.js +158 -37
- package/dist/esm/shared/charts/descriptors/voice/mappers/transfer.mapper.js +4 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/bargeIn.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/continuousAsr.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/dtmf.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/hangup.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/muteSpeechInput.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/noUserInput.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/play.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/sendMetadata.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/sessionSpeechParameters.js +1 -1
- package/dist/esm/shared/charts/descriptors/voice/nodes/transfer.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/dtmf.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/hangup.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/muteSpeechInput.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/play.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/record.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/refer.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/sendMetadata.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +1 -1
- package/dist/esm/shared/charts/descriptors/voicegateway2/nodes/transfer.js +47 -2
- package/dist/esm/shared/constants.js +9 -0
- package/dist/esm/shared/helper/nlu/textCleaner.js +10 -2
- package/dist/esm/shared/interfaces/generativeAI/IGenerativeAIModels.js +1 -0
- package/dist/esm/shared/interfaces/messageAPI/endpoints.js +2 -0
- package/dist/esm/shared/interfaces/messageAPI/handover.js +2 -2
- package/dist/esm/shared/interfaces/resources/IAiAgent.js +10 -0
- package/dist/esm/shared/interfaces/resources/intent/IDefaultReply.js +0 -1
- package/package.json +2 -2
- package/types/index.d.ts +80 -6
|
@@ -10,7 +10,7 @@ exports.sendMetadataNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
10
10
|
type: "sendMetadata",
|
|
11
11
|
defaultLabel: "Send Metadata",
|
|
12
12
|
summary: "UI__NODE_EDITOR__VOICEGATEWAY2__SEND_METADATA__SUMMARY",
|
|
13
|
-
tags: ["
|
|
13
|
+
tags: ["voice"],
|
|
14
14
|
fields: [
|
|
15
15
|
{
|
|
16
16
|
key: "metadata",
|
|
@@ -1051,7 +1051,7 @@ exports.setSessionConfigNode = (0, createNodeDescriptor_1.createNodeDescriptor)(
|
|
|
1051
1051
|
fields: ["sessionParams"],
|
|
1052
1052
|
},
|
|
1053
1053
|
],
|
|
1054
|
-
tags: ["
|
|
1054
|
+
tags: ["voice"],
|
|
1055
1055
|
form: [
|
|
1056
1056
|
{ type: "section", key: "params_tts" },
|
|
1057
1057
|
{ type: "section", key: "params_stt" },
|
|
@@ -18,7 +18,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
18
18
|
appearance: {
|
|
19
19
|
color: design_1.nodeColor,
|
|
20
20
|
},
|
|
21
|
-
tags: ["
|
|
21
|
+
tags: ["voice"],
|
|
22
22
|
fields: [
|
|
23
23
|
{
|
|
24
24
|
key: "transferType",
|
|
@@ -157,6 +157,39 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
157
157
|
max: 300
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
|
+
{
|
|
161
|
+
key: "enableTimeLimit",
|
|
162
|
+
label: "UI__NODE_EDITOR__TRANSFER__FIELDS__ENABLE_DURATION_LIMIT__LABEL",
|
|
163
|
+
type: "toggle",
|
|
164
|
+
description: "UI__NODE_EDITOR__TRANSFER__FIELDS__ENABLE_DURATION_LIMIT__DESCRIPTION",
|
|
165
|
+
condition: {
|
|
166
|
+
key: "transferType",
|
|
167
|
+
value: "dial"
|
|
168
|
+
},
|
|
169
|
+
defaultValue: false,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
key: "timeLimit",
|
|
173
|
+
label: "UI__NODE_EDITOR__TRANSFER__FIELDS__DURATION_LIMIT__LABEL",
|
|
174
|
+
type: "number",
|
|
175
|
+
description: "UI__NODE_EDITOR__TRANSFER__FIELDS__DURATION_LIMIT__DESCRIPTION",
|
|
176
|
+
condition: {
|
|
177
|
+
and: [
|
|
178
|
+
{
|
|
179
|
+
key: "transferType",
|
|
180
|
+
value: "dial"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: "enableTimeLimit",
|
|
184
|
+
value: true
|
|
185
|
+
},
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
defaultValue: 600,
|
|
189
|
+
params: {
|
|
190
|
+
max: 12000
|
|
191
|
+
}
|
|
192
|
+
},
|
|
160
193
|
{
|
|
161
194
|
key: "agentAssistEnabled",
|
|
162
195
|
label: "UI__NODE_EDITOR__TRANSFER__FIELDS__AGENT_ASSIST_ENABLED__LABEL",
|
|
@@ -461,6 +494,14 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
461
494
|
type: "field",
|
|
462
495
|
key: "dialTimeout"
|
|
463
496
|
},
|
|
497
|
+
{
|
|
498
|
+
type: "field",
|
|
499
|
+
key: "enableTimeLimit"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
type: "field",
|
|
503
|
+
key: "timeLimit"
|
|
504
|
+
},
|
|
464
505
|
{
|
|
465
506
|
type: "field",
|
|
466
507
|
key: "agentAssistEnabled"
|
|
@@ -485,7 +526,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
485
526
|
summary: "UI__NODE_EDITOR__VOICEGATEWAY2__TRANSFER__SUMMARY",
|
|
486
527
|
function: async ({ cognigy, config, }) => {
|
|
487
528
|
const { api, input } = cognigy;
|
|
488
|
-
const { transferType, transferTarget, referredBy, anchorMedia, useTransferSipHeaders, transferSipHeaders = {}, transferReason, dialMusic, dialTranscriptionWebhook, dialCallerId, recognitionChannel, sttVendor, sttLanguage, sttDisablePunctuation, dialTimeout, amdEnabled, amdRedirectOnMachineDetected, amdRedirectText, sttLabel, googleModel, sttDeepgramModel, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, agentAssistEnabled, agentAssistHeadersKey = customHeaderDefaultValue } = config;
|
|
529
|
+
const { transferType, transferTarget, referredBy, anchorMedia, useTransferSipHeaders, transferSipHeaders = {}, transferReason, dialMusic, dialTranscriptionWebhook, dialCallerId, recognitionChannel, sttVendor, sttLanguage, sttDisablePunctuation, dialTimeout, enableTimeLimit, timeLimit, amdEnabled, amdRedirectOnMachineDetected, amdRedirectText, sttLabel, googleModel, sttDeepgramModel, deepgramEndpointing, deepgramEndpointingValue, deepgramSmartFormatting, agentAssistEnabled, agentAssistHeadersKey = customHeaderDefaultValue } = config;
|
|
489
530
|
const transferParams = {
|
|
490
531
|
transferType,
|
|
491
532
|
transferReason,
|
|
@@ -500,6 +541,7 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
500
541
|
amdRedirectOnMachineDetected,
|
|
501
542
|
amdRedirectText,
|
|
502
543
|
dialTimeout,
|
|
544
|
+
timeLimit,
|
|
503
545
|
sttLabel,
|
|
504
546
|
};
|
|
505
547
|
try {
|
|
@@ -511,6 +553,9 @@ exports.transferNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
511
553
|
await api.say(textWarningAdminChannel, null);
|
|
512
554
|
return;
|
|
513
555
|
}
|
|
556
|
+
if (!enableTimeLimit) {
|
|
557
|
+
delete transferParams.timeLimit;
|
|
558
|
+
}
|
|
514
559
|
if (agentAssistEnabled && dialTranscriptionWebhook) {
|
|
515
560
|
try {
|
|
516
561
|
const agentAssistConfigId = api.getAgentAssistConfigId();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SECONDS_PER_MINUTE = exports.IP_NOT_AVAILABLE = exports.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS = exports.DOCUMENT_PARSER_PROVIDER_EXTENSION = exports.TRANSLATION_PROVIDER_EXTENSION = exports.AUDIO_PREVIEW_PROVIDER_EXTENSION = exports.GENERATIVE_AI_PROVIDER_EXTENSION = exports.ADMIN_CONSOLE_URL_TOKEN = exports.X_COGNIGY_ORIGIN = exports.EMBEDDED_EXTENSION = exports.INTERNAL_STORAGE_PROVIDER_EXTENSION = exports.VOICE_GATEWAY_2_EXTENSION = exports.MICROSOFT_EXTENSION = exports.VOICE_GATEWAY_EXTENSION = exports.SMTP_EXTENSION = exports.SQL_EXTENSION = exports.MONGO_DB_EXTENSION = exports.BASIC_EXTENSION = exports.MAX_INT32 = exports.PASSWORD_RESET_TOKEN_TTL_IN_SECONDS = exports.SCOPED_USER = exports.SYSTEM_EMAIL = exports.SYSTEM = exports.CREATED_BY_SSO = void 0;
|
|
3
|
+
exports.PLATFORM_PROVIDED_LLM_CONNECTION_ID = exports.PLATFORM_PROVIDED_LLM_ID = exports.PLATFORM_PROVIDED_LLM_USE_CASES = exports.SECONDS_PER_MINUTE = exports.IP_NOT_AVAILABLE = exports.COGNIGY_LIVE_AGENT_DESCRIPTOR_FIELDS = exports.DOCUMENT_PARSER_PROVIDER_EXTENSION = exports.TRANSLATION_PROVIDER_EXTENSION = exports.AUDIO_PREVIEW_PROVIDER_EXTENSION = exports.GENERATIVE_AI_PROVIDER_EXTENSION = exports.ADMIN_CONSOLE_URL_TOKEN = exports.X_COGNIGY_ORIGIN = exports.EMBEDDED_EXTENSION = exports.INTERNAL_STORAGE_PROVIDER_EXTENSION = exports.VOICE_GATEWAY_2_EXTENSION = exports.MICROSOFT_EXTENSION = exports.VOICE_GATEWAY_EXTENSION = exports.SMTP_EXTENSION = exports.SQL_EXTENSION = exports.MONGO_DB_EXTENSION = exports.BASIC_EXTENSION = exports.MAX_INT32 = exports.PASSWORD_RESET_TOKEN_TTL_IN_SECONDS = exports.SCOPED_USER = exports.SYSTEM_EMAIL = exports.SYSTEM = exports.CREATED_BY_SSO = void 0;
|
|
4
4
|
exports.CREATED_BY_SSO = "000000000000000000000550";
|
|
5
5
|
exports.SYSTEM = "000000000000000000000000";
|
|
6
6
|
exports.SYSTEM_EMAIL = "system@mail.com";
|
|
@@ -53,4 +53,13 @@ exports.IP_NOT_AVAILABLE = "not available";
|
|
|
53
53
|
* Number of seconds in one minute.
|
|
54
54
|
*/
|
|
55
55
|
exports.SECONDS_PER_MINUTE = 60;
|
|
56
|
+
// Platform provided LLM
|
|
57
|
+
exports.PLATFORM_PROVIDED_LLM_USE_CASES = [
|
|
58
|
+
"intentSentenceGeneration",
|
|
59
|
+
"flowGeneration",
|
|
60
|
+
"lexiconGeneration",
|
|
61
|
+
"generateNodeOutput",
|
|
62
|
+
];
|
|
63
|
+
exports.PLATFORM_PROVIDED_LLM_ID = "aaaaaaaa-aaaa-aaaa-aaaa-000000000000";
|
|
64
|
+
exports.PLATFORM_PROVIDED_LLM_CONNECTION_ID = "aaaaaaaa-aaaa-aaaa-aaaa-000000000001";
|
|
56
65
|
//# sourceMappingURL=constants.js.map
|
|
@@ -176,9 +176,17 @@ class TextCleaner {
|
|
|
176
176
|
for (let phraseToDetect of Object.keys(this.dictSpecials)) {
|
|
177
177
|
// make phrase regex-safe
|
|
178
178
|
phraseToDetect = phraseToDetect.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
179
|
-
|
|
179
|
+
// check if phraseToDetect is a single special character (e.g., *, ., +)
|
|
180
|
+
const isSpecialChar = /^[-\/\\^$*+?.()|[\]{}#]$/.test(phraseToDetect.replace(/\\/g, '')); // Remove escaping before testing
|
|
181
|
+
// for special characters like '*', don't use word boundaries since they can appear between numbers
|
|
182
|
+
// for normal words like "hello", use word boundaries (\b) to match whole words only
|
|
183
|
+
const regexPattern = isSpecialChar
|
|
184
|
+
? `(${phraseToDetect})` // Match special char anywhere (e.g., in "8*4")
|
|
185
|
+
: `\\b(${phraseToDetect})\\b`; // Match whole words only (e.g., not "hello" in "hello123")
|
|
186
|
+
const matches = normalizedPhrase.match(new RegExp(regexPattern, 'gi'));
|
|
180
187
|
if (matches) {
|
|
181
|
-
normalizedPhrase = normalizedPhrase.replace(new RegExp(
|
|
188
|
+
normalizedPhrase = normalizedPhrase.replace(new RegExp(regexPattern, "gi"), this.dictSpecials[phraseToDetect.replace(/\\/g, '')] // Remove escaping to get original key
|
|
189
|
+
);
|
|
182
190
|
}
|
|
183
191
|
}
|
|
184
192
|
return normalizedPhrase;
|
|
@@ -138,6 +138,8 @@ const callFailoverSettingsSchema = {
|
|
|
138
138
|
dialCallerId: { type: "string" },
|
|
139
139
|
dialMusic: { type: "string" },
|
|
140
140
|
dialTimeout: { type: "number" },
|
|
141
|
+
timeLimit: { type: "number" },
|
|
142
|
+
enableTimeLimit: { type: "boolean" },
|
|
141
143
|
dialTranscribeEnabled: { type: "boolean" },
|
|
142
144
|
dialTranscribeVendor: { type: "string" },
|
|
143
145
|
dialTranscribeLanguage: { type: "string" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getQueueUpdateEventsSchema = exports.handleHandoverRpcEventSchema = exports.
|
|
3
|
+
exports.getQueueUpdateEventsSchema = exports.handleHandoverRpcEventSchema = exports.pollEventSchema = exports.activateHandoverConversationSchema = exports.sendMessageToProviderSchema = exports.getHandoverRequestDataSchema = exports.createHandoverRequestDataSchema = void 0;
|
|
4
4
|
const handover_1 = require("../handover");
|
|
5
5
|
exports.createHandoverRequestDataSchema = {
|
|
6
6
|
title: "createHandoverRequestDataSchema",
|
|
@@ -241,8 +241,8 @@ exports.activateHandoverConversationSchema = {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
|
-
exports.
|
|
245
|
-
title: "
|
|
244
|
+
exports.pollEventSchema = {
|
|
245
|
+
title: "pollEventSchema",
|
|
246
246
|
type: "object",
|
|
247
247
|
additionalProperties: false,
|
|
248
248
|
required: ["handoverSettings", "traceId", "disableSensitiveLogging"],
|
|
@@ -22,6 +22,16 @@ exports.aiAgentDataSchema = {
|
|
|
22
22
|
formality: { type: "string" }
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
+
voiceConfigs: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
ttsVoice: { type: "string" },
|
|
29
|
+
ttsLanguage: { type: "string" },
|
|
30
|
+
ttsVendor: { type: "string" },
|
|
31
|
+
ttsModel: { type: "string" }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
enableVoiceConfigs: { type: "boolean" },
|
|
25
35
|
safetySettings: {
|
|
26
36
|
type: "object",
|
|
27
37
|
properties: {
|
|
@@ -18,7 +18,6 @@ exports.defaultReplyInDBSchema = {
|
|
|
18
18
|
additionalProperties: false,
|
|
19
19
|
properties: Object.assign(Object.assign(Object.assign({}, IEntityMeta_1.entityMetaSchema.properties), exports.defaultReplyDataSchema.properties), { localeReference: { type: "string", format: "mongo-id" }, intentReference: { type: "string", format: "mongo-id" }, flowReference: { type: "string", format: "mongo-id" }, projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" } })
|
|
20
20
|
};
|
|
21
|
-
;
|
|
22
21
|
exports.defaultReplySchema = {
|
|
23
22
|
title: "defaultReplySchema",
|
|
24
23
|
type: "object",
|
|
@@ -28,7 +28,7 @@ export const ADD_MEMORY = createNodeDescriptor({
|
|
|
28
28
|
var _a, _b;
|
|
29
29
|
const { memory: memoryText } = config;
|
|
30
30
|
const { api } = cognigy;
|
|
31
|
-
if (memoryText) {
|
|
31
|
+
if (memoryText !== undefined && memoryText !== null && memoryText !== "") {
|
|
32
32
|
let memoryToAdd;
|
|
33
33
|
if (typeof memoryText === 'string') {
|
|
34
34
|
memoryToAdd = memoryText;
|
|
@@ -3,6 +3,7 @@ import { __awaiter } from "tslib";
|
|
|
3
3
|
import { createNodeDescriptor } from "../../createNodeDescriptor";
|
|
4
4
|
import { GO_TO } from "../logic";
|
|
5
5
|
import { writeLLMDebugLogs } from "../nlu/generativeSlotFiller/prompt";
|
|
6
|
+
import { randomUUID } from 'crypto';
|
|
6
7
|
import { InternalServerError } from "../../../errors";
|
|
7
8
|
/**
|
|
8
9
|
* Returns the simplified english name for a language given a language code
|
|
@@ -759,6 +760,8 @@ New: `;
|
|
|
759
760
|
if (documents && (mode !== "s")) {
|
|
760
761
|
// check if we received streamed output at all
|
|
761
762
|
let streamedOutput = false;
|
|
763
|
+
const isStreamingChannel = input.channel === "webchat3";
|
|
764
|
+
const _messageId = randomUUID();
|
|
762
765
|
const promptData = {
|
|
763
766
|
prompt,
|
|
764
767
|
temperature,
|
|
@@ -771,9 +774,14 @@ New: `;
|
|
|
771
774
|
stream: outputMode === "stream" && mode === "seo",
|
|
772
775
|
streamOnDataHandler: (text) => {
|
|
773
776
|
streamedOutput = true;
|
|
774
|
-
api.output(text,
|
|
777
|
+
api.output(text, {
|
|
778
|
+
_cognigy: {
|
|
779
|
+
_messageId,
|
|
780
|
+
}
|
|
781
|
+
});
|
|
775
782
|
},
|
|
776
783
|
streamStopTokens,
|
|
784
|
+
preventNewLineRemoval: isStreamingChannel ? true : false,
|
|
777
785
|
// set the detailed results to true to get the token usage
|
|
778
786
|
detailedResults: true
|
|
779
787
|
};
|
|
@@ -2,6 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
/* Custom modules */
|
|
3
3
|
import { createNodeDescriptor } from "../../createNodeDescriptor";
|
|
4
4
|
import { GO_TO } from "../logic";
|
|
5
|
+
import { randomUUID } from 'crypto';
|
|
5
6
|
import { createLastConverationString, createLastConversationChatObject, createLastUserInputString, writeLLMDebugLogs } from "../nlu/generativeSlotFiller/prompt";
|
|
6
7
|
import { InternalServerError } from "../../../errors";
|
|
7
8
|
export const GPT_PROMPT = createNodeDescriptor({
|
|
@@ -624,6 +625,8 @@ export const GPT_PROMPT = createNodeDescriptor({
|
|
|
624
625
|
}
|
|
625
626
|
});
|
|
626
627
|
try {
|
|
628
|
+
const isStreamingChannel = input.channel === "webchat3";
|
|
629
|
+
const _messageId = randomUUID();
|
|
627
630
|
const data = {
|
|
628
631
|
prompt,
|
|
629
632
|
temperature,
|
|
@@ -635,13 +638,18 @@ export const GPT_PROMPT = createNodeDescriptor({
|
|
|
635
638
|
useCase: "promptNode",
|
|
636
639
|
stream: storeLocation === "stream",
|
|
637
640
|
streamOnDataHandler: (text) => {
|
|
638
|
-
text = text
|
|
641
|
+
text = isStreamingChannel ? text : text.trim();
|
|
639
642
|
if (text) {
|
|
640
|
-
api.output(text,
|
|
643
|
+
api.output(text, {
|
|
644
|
+
_cognigy: {
|
|
645
|
+
_messageId,
|
|
646
|
+
}
|
|
647
|
+
});
|
|
641
648
|
}
|
|
642
649
|
},
|
|
643
650
|
streamStopTokens,
|
|
644
651
|
streamStopTokenOverrides,
|
|
652
|
+
preventNewLineRemoval: isStreamingChannel ? true : false,
|
|
645
653
|
// set to true in order to get token usage
|
|
646
654
|
detailedResults: true,
|
|
647
655
|
seed: Number(seed) ? Number(seed) : undefined,
|