wingbot 3.71.6 → 3.72.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/.babelrc +0 -0
- package/.github/workflows/deploy.yml +2 -2
- package/.github/workflows/pullRequest.yml +2 -2
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/index.js +0 -0
- package/jsconfig.json +0 -0
- package/package.json +1 -1
- package/plugins/ai.wingbot.clearMessageSequences/plugin.js +0 -0
- package/plugins/ai.wingbot.conditionIfGoBackPossible/plugin.js +0 -0
- package/plugins/ai.wingbot.disambiguation/plugin.js +0 -0
- package/plugins/ai.wingbot.goBack/plugin.js +0 -0
- package/plugins/ai.wingbot.goToLastBreadcrumb/plugin.js +0 -0
- package/plugins/ai.wingbot.ifImageDetected/plugin.js +0 -0
- package/plugins/ai.wingbot.ifStickerDetected/plugin.js +0 -0
- package/plugins/ai.wingbot.jumpBack/plugin.js +0 -0
- package/plugins/ai.wingbot.jumpTo/plugin.js +0 -0
- package/plugins/ai.wingbot.keepInInteraction/plugin.js +0 -0
- package/plugins/ai.wingbot.keepInInteractionJustOnce/plugin.js +0 -0
- package/plugins/ai.wingbot.keepPreviousHandlers/plugin.js +0 -0
- package/plugins/ai.wingbot.keepPreviousHandlersJustOnce/plugin.js +0 -0
- package/plugins/ai.wingbot.oneTimeNotificationRequest/plugin.js +0 -0
- package/plugins/ai.wingbot.openai/plugin.js +0 -0
- package/plugins/ai.wingbot.passThreadToBot/plugin.js +0 -0
- package/plugins/ai.wingbot.persona/plugin.js +0 -0
- package/plugins/ai.wingbot.putABreadcrumb/plugin.js +0 -0
- package/plugins/ai.wingbot.regexp/plugin.js +0 -0
- package/plugins/ai.wingbot.setState/plugin.js +0 -0
- package/plugins/ai.wingbot.setStateFromInput/plugin.js +0 -0
- package/plugins/ai.wingbot.slotsContinue/plugin.js +0 -0
- package/plugins/ai.wingbot.slotsRegister/plugin.js +0 -0
- package/plugins/ai.wingbot.stopResponding/plugin.js +0 -0
- package/plugins/ai.wingbot.trackingEvent/plugin.js +0 -0
- package/plugins/ai.wingbot.upload/plugin.js +0 -0
- package/plugins/ai.wingbot.waitASecond/plugin.js +0 -0
- package/plugins/index.js +0 -0
- package/plugins/plugins.json +0 -0
- package/src/Ai.js +44 -3
- package/src/AiMatching.js +66 -40
- package/src/BatchConversationTester.js +0 -0
- package/src/BotApp.js +0 -0
- package/src/BotAppSender.js +0 -0
- package/src/BuildRouter.js +2 -0
- package/src/CallbackAuditLog.js +0 -0
- package/src/ChatGpt.js +0 -0
- package/src/ConversationTester.js +0 -0
- package/src/LLM.js +183 -2
- package/src/LLMMockProvider.js +0 -0
- package/src/LLMSession.js +90 -3
- package/src/MockAiModel.js +0 -0
- package/src/OrchestratorClient.js +0 -0
- package/src/Plugins.js +0 -0
- package/src/Processor.js +1 -1
- package/src/ReducerWrapper.js +0 -0
- package/src/Request.js +0 -0
- package/src/Responder.js +143 -3
- package/src/ReturnSender.js +4 -4
- package/src/Router.js +0 -0
- package/src/RouterWrap.js +0 -0
- package/src/SecurityMiddleware.js +0 -0
- package/src/Tester.js +44 -2
- package/src/analytics/GA4.js +0 -0
- package/src/analytics/consts.js +0 -0
- package/src/analytics/onInteractionHandler.js +0 -0
- package/src/defaultResourceMap.js +0 -0
- package/src/features.js +0 -0
- package/src/flags.js +0 -0
- package/src/fuzzy/factoryFuzzySearch.js +0 -0
- package/src/fuzzy/fuzzyUtils.js +0 -0
- package/src/fuzzy/index.js +0 -0
- package/src/fuzzy/levenshtein.js +0 -0
- package/src/fuzzy/normalize.js +0 -0
- package/src/fuzzy/prepareFuzzyIndex.js +0 -0
- package/src/graphApi/GraphApi.js +0 -0
- package/src/graphApi/WingbotApiConnector.js +0 -0
- package/src/graphApi/apiAuthorizer.js +0 -0
- package/src/graphApi/conversationTestApi.js +0 -0
- package/src/graphApi/conversationsApi.js +0 -0
- package/src/graphApi/index.js +0 -0
- package/src/graphApi/postBackApi.js +0 -0
- package/src/graphApi/schema.gql +0 -0
- package/src/graphApi/validateBotApi.js +0 -0
- package/src/notifications/Notifications.js +0 -0
- package/src/notifications/NotificationsStorage.js +0 -0
- package/src/notifications/api/index.js +0 -0
- package/src/notifications/api/notificationsApiFactory.js +0 -0
- package/src/notifications/index.js +0 -0
- package/src/resolvers/bounce.js +0 -0
- package/src/resolvers/button.js +0 -0
- package/src/resolvers/carousel.js +0 -0
- package/src/resolvers/contextMessage.js +21 -4
- package/src/resolvers/expected.js +0 -0
- package/src/resolvers/expectedInput.js +0 -0
- package/src/resolvers/hbs.js +0 -0
- package/src/resolvers/include.js +0 -0
- package/src/resolvers/index.js +0 -0
- package/src/resolvers/media.js +0 -0
- package/src/resolvers/message.js +43 -1
- package/src/resolvers/passThread.js +0 -0
- package/src/resolvers/path.js +0 -0
- package/src/resolvers/plugin.js +0 -0
- package/src/resolvers/postback.js +0 -0
- package/src/resolvers/resolverTags.js +0 -0
- package/src/resolvers/setState.js +0 -0
- package/src/resolvers/skip.js +0 -0
- package/src/resolvers/subscribtions.js +0 -0
- package/src/resolvers/utils.js +14 -5
- package/src/systemEntities/email.js +0 -0
- package/src/systemEntities/index.js +0 -0
- package/src/systemEntities/phone.js +0 -0
- package/src/systemEntities/regexps.js +0 -0
- package/src/templates/BaseTemplate.js +0 -0
- package/src/templates/ButtonTemplate.js +0 -0
- package/src/templates/GenericTemplate.js +0 -0
- package/src/templates/ListTemplate.js +0 -0
- package/src/templates/ReceiptTemplate.js +0 -0
- package/src/testTools/AnyResponseAssert.js +0 -0
- package/src/testTools/PromptAssert.js +184 -0
- package/src/testTools/ResponseAssert.js +0 -0
- package/src/testTools/asserts.js +42 -4
- package/src/testTools/index.js +0 -0
- package/src/tools/MemoryBotConfigStorage.js +0 -0
- package/src/tools/MemoryChatLogStorage.js +0 -0
- package/src/tools/MemoryStateStorage.js +0 -0
- package/src/tools/bufferloader.js +0 -0
- package/src/tools/index.js +0 -0
- package/src/tools/routeToEvents.js +0 -0
- package/src/transcript/extractText.js +0 -0
- package/src/transcript/textBodyFromTranscript.js +0 -0
- package/src/transcript/transcriptFromHistory.js +0 -0
- package/src/utils/ai.js +0 -0
- package/src/utils/compileWithState.js +0 -0
- package/src/utils/customCondition.js +14 -1
- package/src/utils/customFn.js +0 -0
- package/src/utils/datetime.js +0 -0
- package/src/utils/deepMapTools.js +0 -0
- package/src/utils/generateToken.js +0 -0
- package/src/utils/getCondition.js +16 -4
- package/src/utils/getUpdate.js +4 -4
- package/src/utils/headersToAuditMeta.js +0 -0
- package/src/utils/index.js +0 -0
- package/src/utils/pathUtils.js +0 -0
- package/src/utils/quickReplies.js +0 -0
- package/src/utils/slots.js +0 -0
- package/src/utils/stateData.js +2 -0
- package/src/utils/stateVariables.js +0 -0
- package/src/utils/tokenizer.js +0 -0
- package/src/utils/wrapPluginFunction.js +0 -0
- package/src/wingbot/CachedModel.js +0 -0
- package/src/wingbot/CustomEntityDetectionModel.js +0 -0
- package/src/wingbot/WingbotModel.js +0 -0
- package/src/wingbot/index.js +0 -0
package/src/utils/ai.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -175,9 +175,22 @@ const compare = (variable, operator, value = undefined) => {
|
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
+
/** @typedef {'if'|'it'|'c'|'nc'|'mr'|'nmr'|'st'|'gt'|'set'|'get'|'eq'|'neq'} ConditionOperator */
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @typedef {object} EditableConditionRule
|
|
182
|
+
* @prop {string} value
|
|
183
|
+
* @prop {ConditionOperator} operator
|
|
184
|
+
* @prop {string} variable
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @typedef {EditableConditionRule[][]} EditableCondition
|
|
189
|
+
*/
|
|
190
|
+
|
|
178
191
|
/**
|
|
179
192
|
*
|
|
180
|
-
* @param {
|
|
193
|
+
* @param {EditableCondition} condition
|
|
181
194
|
* @param {object} configuration
|
|
182
195
|
* @param {string} description
|
|
183
196
|
*/
|
package/src/utils/customFn.js
CHANGED
|
File without changes
|
package/src/utils/datetime.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -7,11 +7,23 @@ const customCondition = require('./customCondition');
|
|
|
7
7
|
const customFn = require('./customFn');
|
|
8
8
|
|
|
9
9
|
/** @typedef {import('../BuildRouter').BotContext} BotContext */
|
|
10
|
+
/** @typedef {import('./customCondition').EditableCondition} EditableCondition */
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line max-len
|
|
13
|
+
/** @typedef {Pick<BotContext,'configuration'|'allowForbiddenSnippetWords'|'linksMap'|'ai'>} ConditionContext */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} ConditionDefinition
|
|
17
|
+
* @prop {boolean} [hasCondition]
|
|
18
|
+
* @prop {string} [conditionFn]
|
|
19
|
+
* @prop {boolean} [hasEditableCondition]
|
|
20
|
+
* @prop {EditableCondition} [editableCondition]
|
|
21
|
+
*/
|
|
10
22
|
|
|
11
23
|
/**
|
|
12
24
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
25
|
+
* @param {ConditionDefinition} params
|
|
26
|
+
* @param {ConditionContext} context
|
|
15
27
|
* @param {string} description
|
|
16
28
|
* @returns {Function}
|
|
17
29
|
*/
|
|
@@ -27,7 +39,7 @@ module.exports = function getCondition (params, context, description = '') {
|
|
|
27
39
|
editableCondition = []
|
|
28
40
|
} = params;
|
|
29
41
|
|
|
30
|
-
let condition
|
|
42
|
+
let condition;
|
|
31
43
|
|
|
32
44
|
if (hasCondition) {
|
|
33
45
|
if (hasEditableCondition) {
|
|
@@ -36,7 +48,7 @@ module.exports = function getCondition (params, context, description = '') {
|
|
|
36
48
|
condition = customFn(conditionFn, description, allowForbiddenSnippetWords);
|
|
37
49
|
}
|
|
38
50
|
} else {
|
|
39
|
-
condition =
|
|
51
|
+
condition = () => true;
|
|
40
52
|
}
|
|
41
53
|
return condition;
|
|
42
54
|
};
|
package/src/utils/getUpdate.js
CHANGED
|
@@ -88,7 +88,7 @@ function toArray (previousValue) {
|
|
|
88
88
|
const ENTITY_HBS_REGEXP = /^\s*\{\{\[?@([^@[\]{}\s]+)(\])?\}\}\s*$/;
|
|
89
89
|
const VARIABLE_HBS_REGEXP = /^\s*\{\{\[?([^$@[\]{}\s]+)\]?\}\}\s*$/;
|
|
90
90
|
|
|
91
|
-
function getSetState (setState, req, res = null,
|
|
91
|
+
function getSetState (setState, req, res = null, stateOverride = null, configuration = null) {
|
|
92
92
|
if (!setState) {
|
|
93
93
|
return {};
|
|
94
94
|
}
|
|
@@ -96,7 +96,7 @@ function getSetState (setState, req, res = null, useState = null, configuration
|
|
|
96
96
|
.filter((k) => k !== '_');
|
|
97
97
|
|
|
98
98
|
let obj = {};
|
|
99
|
-
let state = stateData(req, res, configuration,
|
|
99
|
+
let state = stateData(req, res, configuration, stateOverride);
|
|
100
100
|
|
|
101
101
|
keys.forEach((k) => {
|
|
102
102
|
const val = setState[k];
|
|
@@ -166,8 +166,8 @@ function getSetState (setState, req, res = null, useState = null, configuration
|
|
|
166
166
|
if (entity && (!rear || req.entities.some((e) => e.entity === entity))) {
|
|
167
167
|
values = req.entities.filter((e) => e.entity === entity)
|
|
168
168
|
.map((e) => e.value);
|
|
169
|
-
if (values.length === 0 &&
|
|
170
|
-
values = [
|
|
169
|
+
if (values.length === 0 && stateOverride && stateOverride[`@${entity}`]) {
|
|
170
|
+
values = [stateOverride[`@${entity}`]];
|
|
171
171
|
}
|
|
172
172
|
} else if (variable) {
|
|
173
173
|
values = toArray(getValue(variable, state));
|
|
File without changes
|
package/src/utils/index.js
CHANGED
|
File without changes
|
package/src/utils/pathUtils.js
CHANGED
|
File without changes
|
|
File without changes
|
package/src/utils/slots.js
CHANGED
|
File without changes
|
package/src/utils/stateData.js
CHANGED
|
@@ -16,6 +16,7 @@ const { dateToISO8601String, zeroHourDate } = require('./datetime');
|
|
|
16
16
|
* @prop {object} [configuration]
|
|
17
17
|
* @prop {Function} text
|
|
18
18
|
* @prop {Function} [actionData]
|
|
19
|
+
* @prop {Function} [isConfidentInput]
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -68,6 +69,7 @@ module.exports = function stateData (
|
|
|
68
69
|
$today,
|
|
69
70
|
$tomorrow,
|
|
70
71
|
$yesterday,
|
|
72
|
+
$llmResult: res?.llm?.lastResult?.content,
|
|
71
73
|
// yes - res because of circular dependency
|
|
72
74
|
...(res && req && req.actionData()),
|
|
73
75
|
...(res ? res.data : {}),
|
|
File without changes
|
package/src/utils/tokenizer.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/wingbot/index.js
CHANGED
|
File without changes
|