@botonic/plugin-knowledge-bases 0.23.0-alpha.0 → 0.23.0-alpha.1
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/index.d.ts +1 -1
- package/lib/cjs/index.js +3 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +1 -1
- package/package.json +3 -2
- package/src/index.ts +2 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HubtypeSession, Plugin, PluginPreRequest } from '@botonic/core';
|
|
2
2
|
import { KnowledgebaseResppnse, PluginKnowledgeBaseOptions } from './types';
|
|
3
|
-
export default class
|
|
3
|
+
export default class BotonicPluginKnowledgeBases implements Plugin {
|
|
4
4
|
private readonly apiService;
|
|
5
5
|
private readonly authToken;
|
|
6
6
|
constructor(options: PluginKnowledgeBaseOptions);
|
package/lib/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const hubtype_knowledge_api_service_1 = require("./hubtype-knowledge-api-service");
|
|
4
4
|
const isProd = process.env.NODE_ENV === 'production';
|
|
5
|
-
class
|
|
5
|
+
class BotonicPluginKnowledgeBases {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
this.apiService = new hubtype_knowledge_api_service_1.HubtypeApiService(options.knowledgeBaseId, options.host, options.timeout);
|
|
8
8
|
this.authToken = options.authToken || '';
|
|
@@ -12,6 +12,7 @@ class BotonicPluginKnowledgeBase {
|
|
|
12
12
|
}
|
|
13
13
|
async getIaResponse(session) {
|
|
14
14
|
try {
|
|
15
|
+
console.log({ isProd });
|
|
15
16
|
const authToken = isProd ? session._access_token : this.authToken;
|
|
16
17
|
const response = await this.apiService.inference(authToken, session.user.id);
|
|
17
18
|
console.log(response);
|
|
@@ -27,5 +28,5 @@ class BotonicPluginKnowledgeBase {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
exports.default =
|
|
31
|
+
exports.default = BotonicPluginKnowledgeBases;
|
|
31
32
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAEA,mFAAmE;AAGnE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AAEpD,MAAqB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAEA,mFAAmE;AAGnE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AAEpD,MAAqB,2BAA2B;IAI9C,YAAY,OAAmC;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,iDAAiB,CACrC,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,OAAO,CAChB,CAAA;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAA0B;QAClC,OAAM;IACR,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAuB;QACzC,IAAI;YACF,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;YACvB,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;YACjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAC9C,SAAS,EACT,OAAO,CAAC,IAAI,CAAC,EAAE,CAChB,CAAA;YACD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACrB,OAAO,QAAQ,CAAC,IAAI,CAAA;SACrB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACd,OAAO;gBACL,EAAE,EAAE,EAAE;gBACN,YAAY,EAAE,KAAK;gBACnB,OAAO,EAAE,EAAE;aACZ,CAAA;SACF;IACH,CAAC;CACF;AApCD,8CAoCC"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HubtypeSession, Plugin, PluginPreRequest } from '@botonic/core';
|
|
2
2
|
import { KnowledgebaseResppnse, PluginKnowledgeBaseOptions } from './types';
|
|
3
|
-
export default class
|
|
3
|
+
export default class BotonicPluginKnowledgeBases implements Plugin {
|
|
4
4
|
private readonly apiService;
|
|
5
5
|
private readonly authToken;
|
|
6
6
|
constructor(options: PluginKnowledgeBaseOptions);
|
package/lib/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HubtypeApiService } from './hubtype-knowledge-api-service';
|
|
2
2
|
const isProd = process.env.NODE_ENV === 'production';
|
|
3
|
-
export default class
|
|
3
|
+
export default class BotonicPluginKnowledgeBases {
|
|
4
4
|
constructor(options) {
|
|
5
5
|
this.apiService = new HubtypeApiService(options.knowledgeBaseId, options.host, options.timeout);
|
|
6
6
|
this.authToken = options.authToken || '';
|
|
@@ -10,6 +10,7 @@ export default class BotonicPluginKnowledgeBase {
|
|
|
10
10
|
}
|
|
11
11
|
async getIaResponse(session) {
|
|
12
12
|
try {
|
|
13
|
+
console.log({ isProd });
|
|
13
14
|
const authToken = isProd ? session._access_token : this.authToken;
|
|
14
15
|
const response = await this.apiService.inference(authToken, session.user.id);
|
|
15
16
|
console.log(response);
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAA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EAAE;aACZ,CAAA;SACF;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-knowledge-bases",
|
|
3
|
-
"version": "0.23.0-alpha.
|
|
3
|
+
"version": "0.23.0-alpha.1",
|
|
4
4
|
"description": "Use a Hubtype to make the bot respond through a knowledge base.",
|
|
5
|
-
"main": "index.
|
|
5
|
+
"main": "./lib/cjs/index.js",
|
|
6
|
+
"module": "./lib/esm/index.js",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "rm -rf lib && ../../node_modules/.bin/tsc -p tsconfig.json && ../../node_modules/.bin/tsc -p tsconfig.esm.json",
|
|
8
9
|
"build:watch": "npm run build -- --watch",
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { KnowledgebaseResppnse, PluginKnowledgeBaseOptions } from './types'
|
|
|
5
5
|
|
|
6
6
|
const isProd = process.env.NODE_ENV === 'production'
|
|
7
7
|
|
|
8
|
-
export default class
|
|
8
|
+
export default class BotonicPluginKnowledgeBases implements Plugin {
|
|
9
9
|
private readonly apiService: HubtypeApiService
|
|
10
10
|
private readonly authToken: string
|
|
11
11
|
|
|
@@ -24,6 +24,7 @@ export default class BotonicPluginKnowledgeBase implements Plugin {
|
|
|
24
24
|
|
|
25
25
|
async getIaResponse(session: HubtypeSession): Promise<KnowledgebaseResppnse> {
|
|
26
26
|
try {
|
|
27
|
+
console.log({ isProd })
|
|
27
28
|
const authToken = isProd ? session._access_token : this.authToken
|
|
28
29
|
const response = await this.apiService.inference(
|
|
29
30
|
authToken,
|