@botonic/plugin-flow-builder 0.35.2-alpha.0 → 0.35.3
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/lib/cjs/action/ai-agent.d.ts +3 -0
- package/lib/cjs/action/ai-agent.js +37 -0
- package/lib/cjs/action/ai-agent.js.map +1 -0
- package/lib/cjs/action/index.d.ts +3 -2
- package/lib/cjs/action/index.js +33 -11
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/api.d.ts +1 -0
- package/lib/cjs/api.js +7 -0
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/constants.d.ts +1 -0
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/content-fields/flow-ai-agent.d.ts +11 -0
- package/lib/cjs/content-fields/flow-ai-agent.js +26 -0
- package/lib/cjs/content-fields/flow-ai-agent.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/ai-agent.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +2 -1
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/cjs/content-fields/index.d.ts +3 -4
- package/lib/cjs/content-fields/index.js +7 -5
- package/lib/cjs/content-fields/index.js.map +1 -1
- package/lib/cjs/filters/index.d.ts +12 -0
- package/lib/cjs/filters/index.js +20 -0
- package/lib/cjs/filters/index.js.map +1 -0
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +5 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +15 -0
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/action/ai-agent.d.ts +3 -0
- package/lib/esm/action/ai-agent.js +33 -0
- package/lib/esm/action/ai-agent.js.map +1 -0
- package/lib/esm/action/index.d.ts +3 -2
- package/lib/esm/action/index.js +36 -14
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/api.d.ts +1 -0
- package/lib/esm/api.js +8 -1
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/constants.d.ts +1 -0
- package/lib/esm/constants.js +1 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent.d.ts +11 -0
- package/lib/esm/content-fields/flow-ai-agent.js +22 -0
- package/lib/esm/content-fields/flow-ai-agent.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +2 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/esm/content-fields/index.d.ts +3 -4
- package/lib/esm/content-fields/index.js +4 -3
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/filters/index.d.ts +12 -0
- package/lib/esm/filters/index.js +16 -0
- package/lib/esm/filters/index.js.map +1 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +6 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +15 -0
- package/lib/esm/types.js.map +1 -1
- package/package.json +1 -1
- package/src/action/ai-agent.ts +52 -0
- package/src/action/index.tsx +55 -14
- package/src/api.ts +18 -1
- package/src/constants.ts +1 -0
- package/src/content-fields/flow-ai-agent.tsx +23 -0
- package/src/content-fields/hubtype-fields/ai-agent.ts +10 -0
- package/src/content-fields/hubtype-fields/node-types.ts +1 -0
- package/src/content-fields/hubtype-fields/nodes.ts +2 -0
- package/src/content-fields/index.ts +5 -3
- package/src/filters/index.ts +27 -0
- package/src/index.ts +12 -0
- package/src/types.ts +28 -6
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContentsByAiAgent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const flow_ai_agent_1 = require("../content-fields/flow-ai-agent");
|
|
6
|
+
function getContentsByAiAgent({ cmsApi, flowBuilderPlugin, request, }) {
|
|
7
|
+
var _a;
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const startNodeAiAgentFlow = cmsApi.getStartNodeAiAgentFlow();
|
|
10
|
+
if (!startNodeAiAgentFlow) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
const contents = yield flowBuilderPlugin.getContentsByNode(startNodeAiAgentFlow);
|
|
14
|
+
const aiAgentContent = contents.find(content => content instanceof flow_ai_agent_1.FlowAiAgent);
|
|
15
|
+
if (!aiAgentContent) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const aiAgentResponse = yield ((_a = flowBuilderPlugin.getAiAgentResponse) === null || _a === void 0 ? void 0 : _a.call(flowBuilderPlugin, request, {
|
|
19
|
+
name: aiAgentContent.name,
|
|
20
|
+
instructions: aiAgentContent.instructions,
|
|
21
|
+
}));
|
|
22
|
+
if (!aiAgentResponse) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
return updateContentsWithAiAgentResponse(contents, aiAgentResponse);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.getContentsByAiAgent = getContentsByAiAgent;
|
|
29
|
+
function updateContentsWithAiAgentResponse(contents, aiAgentResponse) {
|
|
30
|
+
return contents.map(content => {
|
|
31
|
+
if (content instanceof flow_ai_agent_1.FlowAiAgent) {
|
|
32
|
+
content.text = aiAgentResponse.message.content;
|
|
33
|
+
}
|
|
34
|
+
return content;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ai-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.js","sourceRoot":"","sources":["../../../src/action/ai-agent.ts"],"names":[],"mappings":";;;;AACA,mEAA6D;AAI7D,SAAsB,oBAAoB,CAAC,EACzC,MAAM,EACN,iBAAiB,EACjB,OAAO,GACY;;;QACnB,MAAM,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,EAAE,CAAA;QAC7D,IAAI,CAAC,oBAAoB,EAAE;YACzB,OAAO,EAAE,CAAA;SACV;QAED,MAAM,QAAQ,GACZ,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAA;QACjE,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAClC,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,2BAAW,CAC3B,CAAA;QAEhB,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO,EAAE,CAAA;SACV;QAED,MAAM,eAAe,GAAG,MAAM,CAAA,MAAA,iBAAiB,CAAC,kBAAkB,kEAChE,OAAO,EACP;YACE,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,YAAY,EAAE,cAAc,CAAC,YAAY;SAC1C,CACF,CAAA,CAAA;QAED,IAAI,CAAC,eAAe,EAAE;YACpB,OAAO,EAAE,CAAA;SACV;QAED,OAAO,iCAAiC,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAA;;CACpE;AAjCD,oDAiCC;AAED,SAAS,iCAAiC,CACxC,QAAuB,EACvB,eAAgC;IAEhC,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,OAAO,YAAY,2BAAW,EAAE;YAClC,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAA;SAC/C;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { ActionRequest, RequestContext } from '@botonic/react';
|
|
1
|
+
import { ActionRequest, RequestContext, WebchatSettingsProps } from '@botonic/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FlowBuilderApi } from '../api';
|
|
4
4
|
import { FlowContent } from '../content-fields';
|
|
5
5
|
import BotonicPluginFlowBuilder from '../index';
|
|
6
6
|
export type FlowBuilderActionProps = {
|
|
7
7
|
contents: FlowContent[];
|
|
8
|
+
webchatSettingsParams?: WebchatSettingsProps;
|
|
8
9
|
};
|
|
9
10
|
export declare class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
10
11
|
static contextType: React.Context<ActionRequest>;
|
|
11
12
|
context: React.ContextType<typeof RequestContext>;
|
|
12
13
|
static executeConversationStart(request: ActionRequest): Promise<FlowBuilderActionProps>;
|
|
13
14
|
static botonicInit(request: ActionRequest, contentID?: string): Promise<FlowBuilderActionProps>;
|
|
14
|
-
|
|
15
|
+
static doHandoffAndBotActions(request: ActionRequest, contents: FlowContent[]): Promise<void>;
|
|
15
16
|
render(): JSX.Element | JSX.Element[];
|
|
16
17
|
}
|
|
17
18
|
export declare class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
package/lib/cjs/action/index.js
CHANGED
|
@@ -8,9 +8,11 @@ const react_1 = require("@botonic/react");
|
|
|
8
8
|
const react_2 = tslib_1.__importDefault(require("react"));
|
|
9
9
|
const content_fields_1 = require("../content-fields");
|
|
10
10
|
const flow_bot_action_1 = require("../content-fields/flow-bot-action");
|
|
11
|
+
const filters_1 = require("../filters");
|
|
11
12
|
const helpers_1 = require("../helpers");
|
|
12
13
|
const tracking_1 = require("../tracking");
|
|
13
14
|
const utils_1 = require("../utils");
|
|
15
|
+
const ai_agent_1 = require("./ai-agent");
|
|
14
16
|
const fallback_1 = require("./fallback");
|
|
15
17
|
const first_interaction_1 = require("./first-interaction");
|
|
16
18
|
const knowledge_bases_1 = require("./knowledge-bases");
|
|
@@ -20,17 +22,19 @@ class FlowBuilderAction extends react_2.default.Component {
|
|
|
20
22
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
23
|
const context = getContext(request);
|
|
22
24
|
const contents = yield (0, first_interaction_1.getContentsByFirstInteraction)(context);
|
|
23
|
-
yield (
|
|
24
|
-
yield
|
|
25
|
-
|
|
25
|
+
const filteredContents = yield filterContents(request, contents);
|
|
26
|
+
yield (0, tracking_1.trackFlowContent)(request, filteredContents);
|
|
27
|
+
yield FlowBuilderAction.doHandoffAndBotActions(request, filteredContents);
|
|
28
|
+
return { contents: filteredContents };
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
static botonicInit(request, contentID) {
|
|
29
32
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
33
|
const contents = yield getContents(request, contentID);
|
|
31
|
-
yield (
|
|
32
|
-
yield
|
|
33
|
-
|
|
34
|
+
const filteredContents = yield filterContents(request, contents);
|
|
35
|
+
yield (0, tracking_1.trackFlowContent)(request, filteredContents);
|
|
36
|
+
yield FlowBuilderAction.doHandoffAndBotActions(request, filteredContents);
|
|
37
|
+
return { contents: filteredContents };
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
40
|
static doHandoffAndBotActions(request, contents) {
|
|
@@ -46,18 +50,17 @@ class FlowBuilderAction extends react_2.default.Component {
|
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
render() {
|
|
49
|
-
const { contents } = this.props;
|
|
53
|
+
const { contents, webchatSettingsParams } = this.props;
|
|
50
54
|
const request = this.context;
|
|
51
|
-
return
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [((0, core_1.isWebchat)(request.session) || (0, core_1.isDev)(request.session)) &&
|
|
56
|
+
!!webchatSettingsParams && ((0, jsx_runtime_1.jsx)(react_1.WebchatSettings, Object.assign({}, webchatSettingsParams))), contents.map(content => content.toBotonic(content.id, request))] }));
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
exports.FlowBuilderAction = FlowBuilderAction;
|
|
55
60
|
FlowBuilderAction.contextType = react_1.RequestContext;
|
|
56
61
|
class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
|
57
62
|
render() {
|
|
58
|
-
|
|
59
|
-
const request = this.context;
|
|
60
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Multichannel, Object.assign({ text: { buttonsAsText: false } }, { children: contents.map(content => content.toBotonic(content.id, request)) })));
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Multichannel, Object.assign({ text: { buttonsAsText: false } }, { children: (0, jsx_runtime_1.jsx)(FlowBuilderAction, Object.assign({}, this.props)) })));
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
exports.FlowBuilderMultichannelAction = FlowBuilderMultichannelAction;
|
|
@@ -79,6 +82,10 @@ function getContents(request, contentID) {
|
|
|
79
82
|
return yield (0, fallback_1.getContentsByFallback)(context);
|
|
80
83
|
}
|
|
81
84
|
if ((0, utils_1.inputHasTextData)(request.input)) {
|
|
85
|
+
const aiAgentContents = yield (0, ai_agent_1.getContentsByAiAgent)(context);
|
|
86
|
+
if (aiAgentContents.length > 0) {
|
|
87
|
+
return aiAgentContents;
|
|
88
|
+
}
|
|
82
89
|
const knowledgeBaseContents = yield (0, knowledge_bases_1.getContentsByKnowledgeBase)(context);
|
|
83
90
|
if (knowledgeBaseContents.length > 0) {
|
|
84
91
|
return knowledgeBaseContents;
|
|
@@ -87,6 +94,21 @@ function getContents(request, contentID) {
|
|
|
87
94
|
return yield (0, fallback_1.getContentsByFallback)(context);
|
|
88
95
|
});
|
|
89
96
|
}
|
|
97
|
+
function filterContents(request, contents) {
|
|
98
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
100
|
+
const contentFilters = flowBuilderPlugin.contentFilters;
|
|
101
|
+
const contentFilterExecutor = new filters_1.ContentFilterExecutor({
|
|
102
|
+
filters: contentFilters,
|
|
103
|
+
});
|
|
104
|
+
const filteredContents = [];
|
|
105
|
+
for (const content of contents) {
|
|
106
|
+
const filteredContent = yield contentFilterExecutor.filter(request, content);
|
|
107
|
+
filteredContents.push(filteredContent);
|
|
108
|
+
}
|
|
109
|
+
return filteredContents;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
90
112
|
function getContext(request, contentID) {
|
|
91
113
|
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
92
114
|
const cmsApi = flowBuilderPlugin.cmsApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":";;;;;AAAA,wCAAmE;AACnE,0CAMuB;AACvB,0DAAyB;AAGzB,sDAA4D;AAC5D,uEAAiE;AACjE,wCAAkD;AAClD,wCAAiD;AAEjD,0CAA8C;AAC9C,oCAA2C;AAC3C,yCAAiD;AACjD,yCAAkD;AAClD,2DAAmE;AACnE,uDAA8D;AAC9D,uCAAgD;AAOhD,MAAa,iBAAkB,SAAQ,eAAK,CAAC,SAAiC;IAI5E,MAAM,CAAO,wBAAwB,CACnC,OAAsB;;YAEtB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;YACnC,MAAM,QAAQ,GAAG,MAAM,IAAA,iDAA6B,EAAC,OAAO,CAAC,CAAA;YAC7D,MAAM,gBAAgB,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YAChE,MAAM,IAAA,2BAAgB,EAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;YACjD,MAAM,iBAAiB,CAAC,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;YAEzE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE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private getFollowUpContentID;
|
|
30
30
|
getFlowName(flowId: string): string;
|
|
31
31
|
getStartNodeKnowledgeBaseFlow(): HtNodeWithContent | undefined;
|
|
32
|
+
getStartNodeAiAgentFlow(): HtNodeWithContent | undefined;
|
|
32
33
|
isKnowledgeBaseEnabled(): boolean;
|
|
33
34
|
getResolvedLocale(): string;
|
|
34
35
|
private resolveAsLocale;
|
package/lib/cjs/api.js
CHANGED
|
@@ -149,6 +149,13 @@ class FlowBuilderApi {
|
|
|
149
149
|
}
|
|
150
150
|
return this.getNodeById(knowledgeBaseFlow.start_node_id);
|
|
151
151
|
}
|
|
152
|
+
getStartNodeAiAgentFlow() {
|
|
153
|
+
const aiAgentFlow = this.flow.flows.find(flow => flow.name === constants_1.AI_AGENTS_FLOW_NAME);
|
|
154
|
+
if (!aiAgentFlow) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
return this.getNodeById(aiAgentFlow.start_node_id);
|
|
158
|
+
}
|
|
152
159
|
isKnowledgeBaseEnabled() {
|
|
153
160
|
return this.flow.is_knowledge_base_active || false;
|
|
154
161
|
}
|
package/lib/cjs/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":";;;;AACA,0DAAyB;AAEzB,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":";;;;AACA,0DAAyB;AAEzB,2CAKoB;AACpB,oEAYwC;AAExC,mCAAmE;AAEnE,MAAa,cAAc;IAMzB,gBAAuB,CAAC;IAExB,MAAM,CAAO,MAAM,CAAC,OAA8B;;;YAChD,MAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAA;YAEnC,MAAM,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;YACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;YAChC,+HAA+H;YAC/H,IAAI,OAAO,C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;IAEO,sBAAsB;QAC5B,OAAO,CAAC,GAAG,CACT,uCAAuC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CACvE,CAAA;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAA;IAC9C,CAAC;CACF;AAjPD,wCAiPC"}
|
package/lib/cjs/constants.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare const REG_EXP_PATTERN: RegExp;
|
|
|
7
7
|
export declare const UUID_REGEXP: RegExp;
|
|
8
8
|
export declare const MAIN_FLOW_NAME = "Main";
|
|
9
9
|
export declare const KNOWLEDGE_BASE_FLOW_NAME = "Knowledge base";
|
|
10
|
+
export declare const AI_AGENTS_FLOW_NAME = "AI agents";
|
|
10
11
|
export declare const FALLBACK_FLOW_NAME = "Fallback";
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FALLBACK_FLOW_NAME = exports.KNOWLEDGE_BASE_FLOW_NAME = exports.MAIN_FLOW_NAME = exports.UUID_REGEXP = exports.REG_EXP_PATTERN = exports.ACCESS_TOKEN_VARIABLE_KEY = exports.VARIABLE_PATTERN = exports.SOURCE_INFO_SEPARATOR = exports.SEPARATOR = exports.FLOW_BUILDER_API_URL_PROD = void 0;
|
|
3
|
+
exports.FALLBACK_FLOW_NAME = exports.AI_AGENTS_FLOW_NAME = exports.KNOWLEDGE_BASE_FLOW_NAME = exports.MAIN_FLOW_NAME = exports.UUID_REGEXP = exports.REG_EXP_PATTERN = exports.ACCESS_TOKEN_VARIABLE_KEY = exports.VARIABLE_PATTERN = exports.SOURCE_INFO_SEPARATOR = exports.SEPARATOR = exports.FLOW_BUILDER_API_URL_PROD = void 0;
|
|
4
4
|
exports.FLOW_BUILDER_API_URL_PROD = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
5
5
|
exports.SEPARATOR = '|';
|
|
6
6
|
exports.SOURCE_INFO_SEPARATOR = `${exports.SEPARATOR}source_`;
|
|
@@ -10,5 +10,6 @@ exports.REG_EXP_PATTERN = /^\/(.*)\/([gimyus]*)$/;
|
|
|
10
10
|
exports.UUID_REGEXP = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
11
11
|
exports.MAIN_FLOW_NAME = 'Main';
|
|
12
12
|
exports.KNOWLEDGE_BASE_FLOW_NAME = 'Knowledge base';
|
|
13
|
+
exports.AI_AGENTS_FLOW_NAME = 'AI agents';
|
|
13
14
|
exports.FALLBACK_FLOW_NAME = 'Fallback';
|
|
14
15
|
//# sourceMappingURL=constants.js.map
|
package/lib/cjs/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GACpC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAC7C,QAAA,SAAS,GAAG,GAAG,CAAA;AACf,QAAA,qBAAqB,GAAG,GAAG,iBAAS,SAAS,CAAA;AAC7C,QAAA,gBAAgB,GAAG,YAAY,CAAA;AAC/B,QAAA,yBAAyB,GAAG,eAAe,CAAA;AAC3C,QAAA,eAAe,GAAG,uBAAuB,CAAA;AACzC,QAAA,WAAW,GACtB,iEAAiE,CAAA;AAEtD,QAAA,cAAc,GAAG,MAAM,CAAA;AACvB,QAAA,wBAAwB,GAAG,gBAAgB,CAAA;AAC3C,QAAA,kBAAkB,GAAG,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GACpC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAC7C,QAAA,SAAS,GAAG,GAAG,CAAA;AACf,QAAA,qBAAqB,GAAG,GAAG,iBAAS,SAAS,CAAA;AAC7C,QAAA,gBAAgB,GAAG,YAAY,CAAA;AAC/B,QAAA,yBAAyB,GAAG,eAAe,CAAA;AAC3C,QAAA,eAAe,GAAG,uBAAuB,CAAA;AACzC,QAAA,WAAW,GACtB,iEAAiE,CAAA;AAEtD,QAAA,cAAc,GAAG,MAAM,CAAA;AACvB,QAAA,wBAAwB,GAAG,gBAAgB,CAAA;AAC3C,QAAA,mBAAmB,GAAG,WAAW,CAAA;AACjC,QAAA,kBAAkB,GAAG,UAAU,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ContentFieldsBase } from './content-fields-base';
|
|
3
|
+
import { HtAiAgentNode } from './hubtype-fields/ai-agent';
|
|
4
|
+
export declare class FlowAiAgent extends ContentFieldsBase {
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
text: string;
|
|
9
|
+
static fromHubtypeCMS(component: HtAiAgentNode): FlowAiAgent;
|
|
10
|
+
toBotonic(id: string): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowAiAgent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@botonic/react");
|
|
6
|
+
const content_fields_base_1 = require("./content-fields-base");
|
|
7
|
+
class FlowAiAgent extends content_fields_base_1.ContentFieldsBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.code = '';
|
|
11
|
+
this.name = '';
|
|
12
|
+
this.instructions = '';
|
|
13
|
+
this.text = '';
|
|
14
|
+
}
|
|
15
|
+
static fromHubtypeCMS(component) {
|
|
16
|
+
const newAiAgent = new FlowAiAgent(component.id);
|
|
17
|
+
newAiAgent.name = component.content.name;
|
|
18
|
+
newAiAgent.instructions = component.content.instructions;
|
|
19
|
+
return newAiAgent;
|
|
20
|
+
}
|
|
21
|
+
toBotonic(id) {
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(react_1.Text, { children: this.text }, id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.FlowAiAgent = FlowAiAgent;
|
|
26
|
+
//# sourceMappingURL=flow-ai-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-ai-agent.js","sourceRoot":"","sources":["../../../src/content-fields/flow-ai-agent.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqC;AAErC,+DAAyD;AAGzD,MAAa,WAAY,SAAQ,uCAAiB;IAAlD;;QACS,SAAI,GAAW,EAAE,CAAA;QACjB,SAAI,GAAW,EAAE,CAAA;QACjB,iBAAY,GAAW,EAAE,CAAA;QACzB,SAAI,GAAW,EAAE,CAAA;IAa1B,CAAC;IAXC,MAAM,CAAC,cAAc,CAAC,SAAwB;QAC5C,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAChD,UAAU,CAAC,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAA;QACxC,UAAU,CAAC,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,YAAY,CAAA;QAExD,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,uBAAC,YAAI,cAAW,IAAI,CAAC,IAAI,IAAd,EAAE,CAAoB,CAAA;IAC1C,CAAC;CACF;AAjBD,kCAiBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-agent.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/ai-agent.ts"],"names":[],"mappings":""}
|
|
@@ -11,7 +11,8 @@ export declare enum HtNodeWithContentType {
|
|
|
11
11
|
WHATSAPP_BUTTON_LIST = "whatsapp-button-list",
|
|
12
12
|
WHATSAPP_CTA_URL_BUTTON = "whatsapp-cta-url-button",
|
|
13
13
|
KNOWLEDGE_BASE = "knowledge-base",
|
|
14
|
-
BOT_ACTION = "bot-action"
|
|
14
|
+
BOT_ACTION = "bot-action",
|
|
15
|
+
AI_AGENT = "ai-agent"
|
|
15
16
|
}
|
|
16
17
|
export declare enum HtNodeWithoutContentType {
|
|
17
18
|
URL = "url",
|
|
@@ -16,6 +16,7 @@ var HtNodeWithContentType;
|
|
|
16
16
|
HtNodeWithContentType["WHATSAPP_CTA_URL_BUTTON"] = "whatsapp-cta-url-button";
|
|
17
17
|
HtNodeWithContentType["KNOWLEDGE_BASE"] = "knowledge-base";
|
|
18
18
|
HtNodeWithContentType["BOT_ACTION"] = "bot-action";
|
|
19
|
+
HtNodeWithContentType["AI_AGENT"] = "ai-agent";
|
|
19
20
|
})(HtNodeWithContentType = exports.HtNodeWithContentType || (exports.HtNodeWithContentType = {}));
|
|
20
21
|
var HtNodeWithoutContentType;
|
|
21
22
|
(function (HtNodeWithoutContentType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAeX;AAfD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,sDAA6B,CAAA;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,sEAA6C,CAAA;IAC7C,4EAAmD,CAAA;IACnD,0DAAiC,CAAA;IACjC,kDAAyB,CAAA;IACzB,8CAAqB,CAAA;AACvB,CAAC,EAfW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAehC;AAED,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,+CAAmB,CAAA;IACnB,qDAAyB,CAAA;AAC3B,CAAC,EAJW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAInC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;AAC7B,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HtAiAgentNode } from './ai-agent';
|
|
1
2
|
import { HtBotActionNode } from './bot-action';
|
|
2
3
|
import { HtCarouselNode } from './carousel';
|
|
3
4
|
import { HtFallbackNode } from './fallback';
|
|
@@ -14,6 +15,6 @@ import { HtUrlNode } from './url';
|
|
|
14
15
|
import { HtVideoNode } from './video';
|
|
15
16
|
import { HtWhatsappButtonListNode } from './whatsapp-button-list';
|
|
16
17
|
import { HtWhatsappCTAUrlButtonNode } from './whatsapp-cta-url-button';
|
|
17
|
-
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtWhatsappCTAUrlButtonNode | HtSmartIntentNode | HtKnowledgeBaseNode | HtBotActionNode;
|
|
18
|
+
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtWhatsappCTAUrlButtonNode | HtSmartIntentNode | HtKnowledgeBaseNode | HtBotActionNode | HtAiAgentNode;
|
|
18
19
|
export type HtNodeWithoutContent = HtUrlNode | HtPayloadNode | HtGoToFlow;
|
|
19
20
|
export type HtNodeComponent = HtNodeWithContent | HtNodeWithoutContent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlowAiAgent } from './flow-ai-agent';
|
|
1
2
|
import { FlowBotAction } from './flow-bot-action';
|
|
2
3
|
import { FlowCarousel } from './flow-carousel';
|
|
3
4
|
import { FlowHandoff } from './flow-handoff';
|
|
@@ -10,8 +11,6 @@ import { FlowWhatsappButtonList } from './whatsapp-button-list/flow-whatsapp-but
|
|
|
10
11
|
export { ContentFieldsBase } from './content-fields-base';
|
|
11
12
|
export { FlowButton } from './flow-button';
|
|
12
13
|
export { FlowElement } from './flow-element';
|
|
13
|
-
export { FlowBotAction, FlowCarousel, FlowImage, FlowKnowledgeBase, FlowText, FlowVideo, FlowWhatsappButtonList, };
|
|
14
|
-
export
|
|
15
|
-
export { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button';
|
|
16
|
-
export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowHandoff | FlowKnowledgeBase | FlowBotAction;
|
|
14
|
+
export { FlowAiAgent, FlowBotAction, FlowCarousel, FlowHandoff, FlowImage, FlowKnowledgeBase, FlowText, FlowVideo, FlowWhatsappButtonList, FlowWhatsappCtaUrlButtonNode, };
|
|
15
|
+
export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowHandoff | FlowKnowledgeBase | FlowBotAction | FlowAiAgent;
|
|
17
16
|
export { DISABLED_MEMORY_LENGTH };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DISABLED_MEMORY_LENGTH = exports.FlowWhatsappCtaUrlButtonNode = exports.
|
|
3
|
+
exports.DISABLED_MEMORY_LENGTH = exports.FlowWhatsappCtaUrlButtonNode = exports.FlowWhatsappButtonList = exports.FlowVideo = exports.FlowText = exports.FlowKnowledgeBase = exports.FlowImage = exports.FlowHandoff = exports.FlowCarousel = exports.FlowBotAction = exports.FlowAiAgent = exports.FlowElement = exports.FlowButton = exports.ContentFieldsBase = void 0;
|
|
4
|
+
const flow_ai_agent_1 = require("./flow-ai-agent");
|
|
5
|
+
Object.defineProperty(exports, "FlowAiAgent", { enumerable: true, get: function () { return flow_ai_agent_1.FlowAiAgent; } });
|
|
4
6
|
const flow_bot_action_1 = require("./flow-bot-action");
|
|
5
7
|
Object.defineProperty(exports, "FlowBotAction", { enumerable: true, get: function () { return flow_bot_action_1.FlowBotAction; } });
|
|
6
8
|
const flow_carousel_1 = require("./flow-carousel");
|
|
7
9
|
Object.defineProperty(exports, "FlowCarousel", { enumerable: true, get: function () { return flow_carousel_1.FlowCarousel; } });
|
|
10
|
+
const flow_handoff_1 = require("./flow-handoff");
|
|
11
|
+
Object.defineProperty(exports, "FlowHandoff", { enumerable: true, get: function () { return flow_handoff_1.FlowHandoff; } });
|
|
8
12
|
const flow_image_1 = require("./flow-image");
|
|
9
13
|
Object.defineProperty(exports, "FlowImage", { enumerable: true, get: function () { return flow_image_1.FlowImage; } });
|
|
10
14
|
const flow_knowledge_base_1 = require("./flow-knowledge-base");
|
|
@@ -14,6 +18,8 @@ const flow_text_1 = require("./flow-text");
|
|
|
14
18
|
Object.defineProperty(exports, "FlowText", { enumerable: true, get: function () { return flow_text_1.FlowText; } });
|
|
15
19
|
const flow_video_1 = require("./flow-video");
|
|
16
20
|
Object.defineProperty(exports, "FlowVideo", { enumerable: true, get: function () { return flow_video_1.FlowVideo; } });
|
|
21
|
+
const flow_whatsapp_cta_url_button_1 = require("./flow-whatsapp-cta-url-button");
|
|
22
|
+
Object.defineProperty(exports, "FlowWhatsappCtaUrlButtonNode", { enumerable: true, get: function () { return flow_whatsapp_cta_url_button_1.FlowWhatsappCtaUrlButtonNode; } });
|
|
17
23
|
const flow_whatsapp_button_list_1 = require("./whatsapp-button-list/flow-whatsapp-button-list");
|
|
18
24
|
Object.defineProperty(exports, "FlowWhatsappButtonList", { enumerable: true, get: function () { return flow_whatsapp_button_list_1.FlowWhatsappButtonList; } });
|
|
19
25
|
var content_fields_base_1 = require("./content-fields-base");
|
|
@@ -22,8 +28,4 @@ var flow_button_1 = require("./flow-button");
|
|
|
22
28
|
Object.defineProperty(exports, "FlowButton", { enumerable: true, get: function () { return flow_button_1.FlowButton; } });
|
|
23
29
|
var flow_element_1 = require("./flow-element");
|
|
24
30
|
Object.defineProperty(exports, "FlowElement", { enumerable: true, get: function () { return flow_element_1.FlowElement; } });
|
|
25
|
-
var flow_handoff_1 = require("./flow-handoff");
|
|
26
|
-
Object.defineProperty(exports, "FlowHandoff", { enumerable: true, get: function () { return flow_handoff_1.FlowHandoff; } });
|
|
27
|
-
var flow_whatsapp_cta_url_button_1 = require("./flow-whatsapp-cta-url-button");
|
|
28
|
-
Object.defineProperty(exports, "FlowWhatsappCtaUrlButtonNode", { enumerable: true, get: function () { return flow_whatsapp_cta_url_button_1.FlowWhatsappCtaUrlButtonNode; } });
|
|
29
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,uDAAiD;AAiB/C,8FAjBO,+BAAa,OAiBP;AAhBf,mDAA8C;AAiB5C,6FAjBO,4BAAY,OAiBP;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAiB3C,4FAjBO,2BAAW,OAiBP;AAhBb,uDAAiD;AAiB/C,8FAjBO,+BAAa,OAiBP;AAhBf,mDAA8C;AAiB5C,6FAjBO,4BAAY,OAiBP;AAhBd,iDAA4C;AAiB1C,4FAjBO,0BAAW,OAiBP;AAhBb,6CAAwC;AAiBtC,0FAjBO,sBAAS,OAiBP;AAhBX,+DAG8B;AAiCrB,uGAnCP,4CAAsB,OAmCO;AAnB7B,kGAfA,uCAAiB,OAeA;AAbnB,2CAAsC;AAcpC,yFAdO,oBAAQ,OAcP;AAbV,6CAAwC;AActC,0FAdO,sBAAS,OAcP;AAbX,iFAA6E;AAe3E,6GAfO,2DAA4B,OAeP;AAd9B,gGAAyF;AAavF,uGAbO,kDAAsB,OAaP;AAZxB,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AACnB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BotContext } from '@botonic/core';
|
|
2
|
+
import { FlowContent } from '../content-fields';
|
|
3
|
+
import { ContentFilter } from '../types';
|
|
4
|
+
interface ContentFilterExecutorOptions {
|
|
5
|
+
filters: ContentFilter[];
|
|
6
|
+
}
|
|
7
|
+
export declare class ContentFilterExecutor {
|
|
8
|
+
private filters;
|
|
9
|
+
constructor(options: ContentFilterExecutorOptions);
|
|
10
|
+
filter(request: BotContext, content: FlowContent): Promise<FlowContent>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentFilterExecutor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
class ContentFilterExecutor {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.filters = [];
|
|
8
|
+
this.filters = options.filters;
|
|
9
|
+
}
|
|
10
|
+
filter(request, content) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
for (const filter of this.filters) {
|
|
13
|
+
content = yield filter(request, content);
|
|
14
|
+
}
|
|
15
|
+
return content;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ContentFilterExecutor = ContentFilterExecutor;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/filters/index.ts"],"names":[],"mappings":";;;;AASA,MAAa,qBAAqB;IAGhC,YAAY,OAAqC;QAFzC,YAAO,GAAoB,EAAE,CAAA;QAGnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,CAAC;IAEK,MAAM,CACV,OAAmB,EACnB,OAAoB;;YAEpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;gBACjC,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;aACzC;YAED,OAAO,OAAO,CAAA;QAChB,CAAC;KAAA;CACF;AAjBD,sDAiBC"}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Plugin, PluginPreRequest, ResolvedPlugins, Session } from '@botonic/cor
|
|
|
2
2
|
import { FlowBuilderApi } from './api';
|
|
3
3
|
import { FlowContent } from './content-fields';
|
|
4
4
|
import { HtNodeWithContent } from './content-fields/hubtype-fields';
|
|
5
|
-
import { BotonicPluginFlowBuilderOptions, FlowBuilderJSONVersion, InShadowingConfig, KnowledgeBaseFunction, PayloadParamsBase, TrackEventFunction } from './types';
|
|
5
|
+
import { AiAgentFunction, BotonicPluginFlowBuilderOptions, ContentFilter, FlowBuilderJSONVersion, InShadowingConfig, KnowledgeBaseFunction, PayloadParamsBase, TrackEventFunction } from './types';
|
|
6
6
|
import { SmartIntentsInferenceConfig } from './user-input/smart-intent';
|
|
7
7
|
export default class BotonicPluginFlowBuilder implements Plugin {
|
|
8
8
|
cmsApi: FlowBuilderApi;
|
|
@@ -12,8 +12,10 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
12
12
|
getAccessToken: (session: Session) => string;
|
|
13
13
|
trackEvent?: TrackEventFunction;
|
|
14
14
|
getKnowledgeBaseResponse?: KnowledgeBaseFunction;
|
|
15
|
+
getAiAgentResponse?: AiAgentFunction;
|
|
15
16
|
smartIntentsConfig: SmartIntentsInferenceConfig;
|
|
16
17
|
inShadowing: InShadowingConfig;
|
|
18
|
+
contentFilters: ContentFilter[];
|
|
17
19
|
jsonVersion: FlowBuilderJSONVersion;
|
|
18
20
|
apiUrl: string;
|
|
19
21
|
constructor(options: BotonicPluginFlowBuilderOptions<ResolvedPlugins, any>);
|
|
@@ -37,5 +39,5 @@ export * from './action';
|
|
|
37
39
|
export * from './content-fields';
|
|
38
40
|
export { HtBotActionNode } from './content-fields/hubtype-fields';
|
|
39
41
|
export { trackFlowContent } from './tracking';
|
|
40
|
-
export { BotonicPluginFlowBuilderOptions, FlowBuilderJSONVersion, PayloadParamsBase, } from './types';
|
|
42
|
+
export { BotonicPluginFlowBuilderOptions, ContentFilter, FlowBuilderJSONVersion, PayloadParamsBase, } from './types';
|
|
41
43
|
export * from './webview';
|
package/lib/cjs/index.js
CHANGED
|
@@ -21,6 +21,8 @@ class BotonicPluginFlowBuilder {
|
|
|
21
21
|
this.getAccessToken = (0, utils_1.resolveGetAccessToken)(options.getAccessToken);
|
|
22
22
|
this.trackEvent = options.trackEvent;
|
|
23
23
|
this.getKnowledgeBaseResponse = options.getKnowledgeBaseResponse;
|
|
24
|
+
// TODO: Add getAiAgentResponse before publish 0.36.0
|
|
25
|
+
this.getAiAgentResponse = undefined; //options.getAiAgentResponse
|
|
24
26
|
this.smartIntentsConfig = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.smartIntentsConfig), { useLatest: this.jsonVersion === types_1.FlowBuilderJSONVersion.LATEST });
|
|
25
27
|
const customFunctions = options.customFunctions || {};
|
|
26
28
|
this.functions = Object.assign(Object.assign({}, functions_1.DEFAULT_FUNCTIONS), customFunctions);
|
|
@@ -29,6 +31,7 @@ class BotonicPluginFlowBuilder {
|
|
|
29
31
|
allowSmartIntents: ((_b = options.inShadowing) === null || _b === void 0 ? void 0 : _b.allowSmartIntents) || false,
|
|
30
32
|
allowKnowledgeBases: ((_c = options.inShadowing) === null || _c === void 0 ? void 0 : _c.allowKnowledgeBases) || false,
|
|
31
33
|
};
|
|
34
|
+
this.contentFilters = options.contentFilters || [];
|
|
32
35
|
}
|
|
33
36
|
resolveFlowUrl(request) {
|
|
34
37
|
if (request.session.is_test_integration) {
|
|
@@ -135,6 +138,8 @@ class BotonicPluginFlowBuilder {
|
|
|
135
138
|
return content_fields_1.FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
136
139
|
case hubtype_fields_1.HtNodeWithContentType.KNOWLEDGE_BASE:
|
|
137
140
|
return content_fields_1.FlowKnowledgeBase.fromHubtypeCMS(hubtypeContent);
|
|
141
|
+
case hubtype_fields_1.HtNodeWithContentType.AI_AGENT:
|
|
142
|
+
return content_fields_1.FlowAiAgent.fromHubtypeCMS(hubtypeContent);
|
|
138
143
|
case hubtype_fields_1.HtNodeWithContentType.BOT_ACTION:
|
|
139
144
|
return content_fields_1.FlowBotAction.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
140
145
|
default:
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAOA,+BAAmC;AAEnC,+BAAsC;AACtC,2CAIoB;AACpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAOA,+BAAmC;AAEnC,+BAAsC;AACtC,2CAIoB;AACpB,qDAYyB;AACzB,oEASwC;AACxC,2CAA+C;AAC/C,mCASgB;AAChB,6CAAiD;AAEjD,mCAAiE;AAEjE,2EAA2E;AAE3E,MAAqB,wBAAwB;IAiB3C,YAAY,OAA8D;;QACxE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,qCAAyB,CAAA;QACzD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,8BAAsB,CAAC,MAAM,CAAA;QACvE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,cAAc,GAAG,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AA;IACtB,CAAC;IAED,WAAW,CAAC,MAAc;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;CACF;AA/PD,2CA+PC;AAED,mDAAwB;AACxB,2DAAgC;AAEhC,uCAA6C;AAApC,4GAAA,gBAAgB,OAAA;AACzB,iCAKgB;AAFd,+GAAA,sBAAsB,OAAA;AAGxB,oDAAyB"}
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BotContext, PluginPreRequest, ResolvedPlugins } from '@botonic/core';
|
|
2
|
+
import { FlowContent } from './content-fields';
|
|
2
3
|
import { HtFlowBuilderData } from './content-fields/hubtype-fields';
|
|
3
4
|
export interface InShadowingConfig {
|
|
4
5
|
allowKeywords: boolean;
|
|
@@ -13,13 +14,21 @@ export interface BotonicPluginFlowBuilderOptions<TPlugins extends ResolvedPlugin
|
|
|
13
14
|
getAccessToken: () => string;
|
|
14
15
|
trackEvent?: TrackEventFunction<TPlugins, TExtraData>;
|
|
15
16
|
getKnowledgeBaseResponse?: KnowledgeBaseFunction<TPlugins, TExtraData>;
|
|
17
|
+
getAiAgentResponse?: AiAgentFunction<TPlugins, TExtraData>;
|
|
16
18
|
smartIntentsConfig?: {
|
|
17
19
|
numSmartIntentsToUse: number;
|
|
18
20
|
};
|
|
19
21
|
inShadowing?: Partial<InShadowingConfig>;
|
|
22
|
+
contentFilters?: ContentFilter<TPlugins, TExtraData>[];
|
|
20
23
|
}
|
|
21
24
|
export type TrackEventFunction<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, eventAction: string, args?: Record<string, any>) => Promise<void>;
|
|
22
25
|
export type KnowledgeBaseFunction<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, sources: string[], instructions: string, messageId: string, memoryLength: number) => Promise<KnowledgeBaseResponse>;
|
|
26
|
+
export type AiAgentFunction<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, aiAgentArgs: AiAgentArgs) => Promise<AiAgentResponse>;
|
|
27
|
+
export interface AiAgentArgs {
|
|
28
|
+
name: string;
|
|
29
|
+
instructions: string;
|
|
30
|
+
}
|
|
31
|
+
export type ContentFilter<TPlugins extends ResolvedPlugins = ResolvedPlugins, TExtraData = any> = (request: BotContext<TPlugins, TExtraData>, content: FlowContent) => Promise<FlowContent> | FlowContent;
|
|
23
32
|
export interface FlowBuilderApiOptions {
|
|
24
33
|
url: string;
|
|
25
34
|
flowUrl: string;
|
|
@@ -42,6 +51,12 @@ export interface KnowledgeBaseResponse {
|
|
|
42
51
|
chunkIds: string[];
|
|
43
52
|
answer: string;
|
|
44
53
|
}
|
|
54
|
+
export interface AiAgentResponse {
|
|
55
|
+
message: {
|
|
56
|
+
role: string;
|
|
57
|
+
content: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
45
60
|
export interface SmartIntentResponse {
|
|
46
61
|
data: {
|
|
47
62
|
smart_intent_title: string;
|
package/lib/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AA4EA,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+CAAyB,CAAA;IACzB,iDAA2B,CAAA;AAC7B,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;AACnB,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC"}
|