@digipair/skill-chatbot 0.113.1 → 0.114.2

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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # skill-test
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build skill-chatbot` to build the library.
@@ -1,22 +1,10 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var engine = require('@digipair/engine');
6
4
 
7
- function _extends() {
8
- _extends = Object.assign || function assign(target) {
9
- for(var i = 1; i < arguments.length; i++){
10
- var source = arguments[i];
11
- for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
12
- }
13
- return target;
14
- };
15
- return _extends.apply(this, arguments);
16
- }
17
-
18
5
  let ChatbotService = class ChatbotService {
19
6
  async answer(params, _pinsSettingsList, context) {
7
+ +console.log('ChatbotService.answer', params, context);
20
8
  const { command = [], boosts = [], sources = [], agent_history = [], files = [], assistant, logs, boost, parent_conversation, parent_history, session, uuid } = params;
21
9
  return {
22
10
  assistant,
@@ -26,9 +14,10 @@ let ChatbotService = class ChatbotService {
26
14
  agent_history,
27
15
  files,
28
16
  logs,
29
- boost: boost ? _extends({}, boost, {
17
+ boost: boost ? {
18
+ ...boost,
30
19
  inputs: await Promise.all((boost.inputs || []).map((settings)=>engine.preparePinsSettings(settings, context)))
31
- }) : boost,
20
+ } : boost,
32
21
  parent_conversation,
33
22
  parent_history,
34
23
  session,
@@ -44,7 +33,6 @@ let ChatbotService = class ChatbotService {
44
33
  }
45
34
  // SCENES
46
35
  async boost(params, _pinsSettingsList, context) {
47
- var _steps_step;
48
36
  if (context.request.method && context.request.method !== 'POST') {
49
37
  return {
50
38
  error: 'Method not allowed'
@@ -52,12 +40,13 @@ let ChatbotService = class ChatbotService {
52
40
  }
53
41
  const { steps } = params;
54
42
  const step = context.request.body.step ? steps.findIndex(({ name })=>name === context.request.body.step) : 0;
55
- const execute = ((_steps_step = steps[step]) == null ? void 0 : _steps_step.execute) || [];
56
- const result = await engine.executePinsList(execute, _extends({}, context, {
43
+ const execute = steps[step]?.execute || [];
44
+ const result = await engine.executePinsList(execute, {
45
+ ...context,
57
46
  boost: {
58
47
  steps
59
48
  }
60
- }), `${context.__PATH__}.steps[${step}].execute`);
49
+ }, `${context.__PATH__}.steps[${step}].execute`);
61
50
  return result;
62
51
  }
63
52
  };
@@ -1,18 +1,8 @@
1
1
  import { preparePinsSettings, executePinsList } from '@digipair/engine';
2
2
 
3
- function _extends() {
4
- _extends = Object.assign || function assign(target) {
5
- for(var i = 1; i < arguments.length; i++){
6
- var source = arguments[i];
7
- for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
8
- }
9
- return target;
10
- };
11
- return _extends.apply(this, arguments);
12
- }
13
-
14
3
  let ChatbotService = class ChatbotService {
15
4
  async answer(params, _pinsSettingsList, context) {
5
+ +console.log('ChatbotService.answer', params, context);
16
6
  const { command = [], boosts = [], sources = [], agent_history = [], files = [], assistant, logs, boost, parent_conversation, parent_history, session, uuid } = params;
17
7
  return {
18
8
  assistant,
@@ -22,9 +12,10 @@ let ChatbotService = class ChatbotService {
22
12
  agent_history,
23
13
  files,
24
14
  logs,
25
- boost: boost ? _extends({}, boost, {
15
+ boost: boost ? {
16
+ ...boost,
26
17
  inputs: await Promise.all((boost.inputs || []).map((settings)=>preparePinsSettings(settings, context)))
27
- }) : boost,
18
+ } : boost,
28
19
  parent_conversation,
29
20
  parent_history,
30
21
  session,
@@ -40,7 +31,6 @@ let ChatbotService = class ChatbotService {
40
31
  }
41
32
  // SCENES
42
33
  async boost(params, _pinsSettingsList, context) {
43
- var _steps_step;
44
34
  if (context.request.method && context.request.method !== 'POST') {
45
35
  return {
46
36
  error: 'Method not allowed'
@@ -48,12 +38,13 @@ let ChatbotService = class ChatbotService {
48
38
  }
49
39
  const { steps } = params;
50
40
  const step = context.request.body.step ? steps.findIndex(({ name })=>name === context.request.body.step) : 0;
51
- const execute = ((_steps_step = steps[step]) == null ? void 0 : _steps_step.execute) || [];
52
- const result = await executePinsList(execute, _extends({}, context, {
41
+ const execute = steps[step]?.execute || [];
42
+ const result = await executePinsList(execute, {
43
+ ...context,
53
44
  boost: {
54
45
  steps
55
46
  }
56
- }), `${context.__PATH__}.steps[${step}].execute`);
47
+ }, `${context.__PATH__}.steps[${step}].execute`);
57
48
  return result;
58
49
  }
59
50
  };
@@ -1 +1,2 @@
1
1
  export * from './lib/skill-chatbot';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -15,3 +15,4 @@ export declare const answer: (params: any, pinsSettingsList: PinsSettings[], con
15
15
  }>;
16
16
  export declare const execute: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
17
17
  export declare const boost: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
18
+ //# sourceMappingURL=skill-chatbot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-chatbot.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-chatbot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAwC,MAAM,kBAAkB,CAAC;AA8EtF,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG;;;;;;;;;;;;;EAClB,CAAC;AAEjE,eAAO,MAAM,OAAO,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC;AAIlE,eAAO,MAAM,KAAK,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAClB,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,33 @@
1
1
  {
2
2
  "name": "@digipair/skill-chatbot",
3
- "version": "0.113.1",
3
+ "version": "0.114.2",
4
+ "main": "./dist/index.cjs.js",
5
+ "module": "./dist/index.esm.js",
6
+ "types": "./dist/index.d.ts",
4
7
  "keywords": [
5
8
  "digipair",
6
9
  "service",
7
10
  "util"
8
11
  ],
9
- "dependencies": {},
10
- "typings": "./index.d.ts",
11
- "main": "./index.cjs.js",
12
- "module": "./index.esm.js"
13
- }
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.esm.js",
16
+ "default": "./dist/index.cjs.js"
17
+ },
18
+ "./index.esm.js": "./dist/index.esm.js",
19
+ "./index.cjs.js": "./dist/index.cjs.js",
20
+ "./package.json": "./package.json",
21
+ "./schema.json": "./dist/schema.json",
22
+ "./schema.fr.json": "./dist/schema.fr.json"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "package.json"
28
+ ],
29
+ "nx": {
30
+ "name": "skill-chatbot"
31
+ },
32
+ "dependencies": {}
33
+ }
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './libs/skill-chatbot/src/index';
File without changes
File without changes
File without changes