@activepieces/piece-docsbot 0.0.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/README.md +7 -0
- package/package.json +32 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +40 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/ask-question.d.ts +17 -0
- package/src/lib/actions/ask-question.js +25 -0
- package/src/lib/actions/ask-question.js.map +1 -0
- package/src/lib/actions/create-bot.d.ts +10 -0
- package/src/lib/actions/create-bot.js +21 -0
- package/src/lib/actions/create-bot.js.map +1 -0
- package/src/lib/actions/create-source.d.ts +6 -0
- package/src/lib/actions/create-source.js +37 -0
- package/src/lib/actions/create-source.js.map +1 -0
- package/src/lib/actions/find-bot.d.ts +4 -0
- package/src/lib/actions/find-bot.js +32 -0
- package/src/lib/actions/find-bot.js.map +1 -0
- package/src/lib/actions/upload-source-file.d.ts +5 -0
- package/src/lib/actions/upload-source-file.js +33 -0
- package/src/lib/actions/upload-source-file.js.map +1 -0
- package/src/lib/common/index.d.ts +167 -0
- package/src/lib/common/index.js +122 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/common/properties.d.ts +42 -0
- package/src/lib/common/properties.js +286 -0
- package/src/lib/common/properties.js.map +1 -0
- package/src/lib/common/schemas.d.ts +106 -0
- package/src/lib/common/schemas.js +110 -0
- package/src/lib/common/schemas.js.map +1 -0
- package/src/lib/common/types.d.ts +107 -0
- package/src/lib/common/types.js +3 -0
- package/src/lib/common/types.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-docsbot",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"axios": "1.8.3",
|
|
10
|
+
"axios-retry": "4.4.1",
|
|
11
|
+
"deepmerge-ts": "7.1.0",
|
|
12
|
+
"mime-types": "2.1.35",
|
|
13
|
+
"nanoid": "3.3.8",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"tslib": "^2.3.0",
|
|
16
|
+
"zod": "3.25.76",
|
|
17
|
+
"@activepieces/pieces-common": "0.7.0",
|
|
18
|
+
"@activepieces/pieces-framework": "0.20.0",
|
|
19
|
+
"@activepieces/shared": "0.20.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"@tryfabric/martian": {
|
|
23
|
+
"@notionhq/client": "$@notionhq/client"
|
|
24
|
+
},
|
|
25
|
+
"vite": {
|
|
26
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"resolutions": {
|
|
30
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const docsbot: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.docsbot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const ask_question_1 = require("./lib/actions/ask-question");
|
|
7
|
+
const create_bot_1 = require("./lib/actions/create-bot");
|
|
8
|
+
const create_source_1 = require("./lib/actions/create-source");
|
|
9
|
+
const find_bot_1 = require("./lib/actions/find-bot");
|
|
10
|
+
const upload_source_file_1 = require("./lib/actions/upload-source-file");
|
|
11
|
+
const common_1 = require("./lib/common");
|
|
12
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
13
|
+
const shared_1 = require("@activepieces/shared");
|
|
14
|
+
exports.docsbot = (0, pieces_framework_1.createPiece)({
|
|
15
|
+
displayName: 'DocsBot',
|
|
16
|
+
description: 'DocsBot AI allows you to build AI-powered chatbots that pull answers from your existing documentation and content. This integration enables workflows to ask DocsBot questions and update its training sources dynamically.',
|
|
17
|
+
auth: common_1.docsbotAuth,
|
|
18
|
+
minimumSupportedRelease: '0.36.1',
|
|
19
|
+
categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE, shared_1.PieceCategory.PRODUCTIVITY],
|
|
20
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/docsbot.png',
|
|
21
|
+
authors: ['LuizDMM'],
|
|
22
|
+
actions: [
|
|
23
|
+
ask_question_1.askQuestion,
|
|
24
|
+
create_source_1.createSource,
|
|
25
|
+
upload_source_file_1.uploadSourceFile,
|
|
26
|
+
create_bot_1.createBot,
|
|
27
|
+
find_bot_1.findBot,
|
|
28
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
29
|
+
baseUrl: () => common_1.docsbotCommon.baseUrl,
|
|
30
|
+
auth: common_1.docsbotAuth,
|
|
31
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
return {
|
|
33
|
+
Authorization: `Bearer ${auth}`,
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
triggers: [],
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/docsbot/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,6DAAyD;AACzD,yDAAqD;AACrD,+DAA2D;AAC3D,qDAAiD;AACjD,yEAAoE;AACpE,yCAA0D;AAC1D,+DAAwE;AACxE,iDAAqD;AAExC,QAAA,OAAO,GAAG,IAAA,8BAAW,EAAC;IACjC,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,6NAA6N;IAC/N,IAAI,EAAE,oBAAW;IACjB,uBAAuB,EAAE,QAAQ;IACjC,UAAU,EAAC,CAAC,sBAAa,CAAC,uBAAuB,EAAC,sBAAa,CAAC,YAAY,CAAC;IAC7E,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,OAAO,EAAE;QACP,0BAAW;QACX,4BAAY;QACZ,qCAAgB;QAChB,sBAAS;QACT,kBAAO;QACP,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAa,CAAC,OAAO;YACpC,IAAI,EAAE,oBAAW;YACjB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const askQuestion: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
botId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
question: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
metadata: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
6
|
+
context_items: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
+
human_escalation: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
8
|
+
followup_rating: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
9
|
+
document_retriever: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
full_source: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
11
|
+
autocut: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
12
|
+
testing: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
13
|
+
image_urls: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
14
|
+
model: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
15
|
+
default_language: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
+
reasoning_effort: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askQuestion = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.askQuestion = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: common_1.docsbotAuth,
|
|
10
|
+
name: 'askQuestion',
|
|
11
|
+
displayName: 'Ask Question',
|
|
12
|
+
description: 'Ask a question to a specific bot in a specific team.',
|
|
13
|
+
props: common_1.docsbotCommon.askQuestionProperties(),
|
|
14
|
+
run(_a) {
|
|
15
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth: apiKey, propsValue }) {
|
|
16
|
+
yield pieces_common_1.propsValidation.validateZod(propsValue, common_1.docsbotCommon.askQuestionSchema);
|
|
17
|
+
const { image_urls } = propsValue, restProps = tslib_1.__rest(propsValue, ["image_urls"]);
|
|
18
|
+
const conversationId = crypto.randomUUID();
|
|
19
|
+
return yield common_1.docsbotCommon.askQuestion(Object.assign({ apiKey, image_urls: Array.isArray(image_urls)
|
|
20
|
+
? image_urls
|
|
21
|
+
: undefined, conversationId }, restProps));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=ask-question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask-question.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/docsbot/src/lib/actions/ask-question.ts"],"names":[],"mappings":";;;;AAAA,+DAA8D;AAC9D,qEAA8D;AAC9D,sCAAuD;AAE1C,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE,sBAAa,CAAC,qBAAqB,EAAE;IACtC,GAAG;qEAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE;YACpC,MAAM,+BAAe,CAAC,WAAW,CAAC,UAAU,EAAE,sBAAa,CAAC,iBAAiB,CAAC,CAAC;YAE/E,MAAM,EAAE,UAAU,KAAmB,UAAU,EAAxB,SAAS,kBAAK,UAAU,EAAzC,cAA4B,CAAa,CAAC;YAChD,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAE3C,OAAO,MAAM,sBAAa,CAAC,WAAW,iBACpC,MAAM,EACN,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;oBACrC,CAAC,CAAE,UAAmC;oBACtC,CAAC,CAAC,SAAS,EACX,cAAc,IACX,SAAS,EACZ,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const createBot: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
privacy: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
+
language: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
7
|
+
model: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
8
|
+
embeddingModel: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
copyFrom: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.createBot = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: common_1.docsbotAuth,
|
|
10
|
+
name: 'createBot',
|
|
11
|
+
displayName: 'Create Bot',
|
|
12
|
+
description: 'Creates a new bot.',
|
|
13
|
+
props: common_1.docsbotCommon.createBotProperties(),
|
|
14
|
+
run(_a) {
|
|
15
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth: apiKey, propsValue }) {
|
|
16
|
+
yield pieces_common_1.propsValidation.validateZod(propsValue, common_1.docsbotCommon.createBotSchema);
|
|
17
|
+
return yield common_1.docsbotCommon.createBot(Object.assign(Object.assign({ apiKey }, propsValue), { language: propsValue.language, privacy: propsValue.privacy, model: propsValue.model, embeddingModel: propsValue.embeddingModel }));
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=create-bot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-bot.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/docsbot/src/lib/actions/create-bot.ts"],"names":[],"mappings":";;;;AAAA,+DAA8D;AAC9D,qEAA8D;AAC9D,sCAAuD;AAE1C,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE,sBAAa,CAAC,mBAAmB,EAAE;IACpC,GAAG;qEAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE;YACpC,MAAM,+BAAe,CAAC,WAAW,CAAC,UAAU,EAAE,sBAAa,CAAC,eAAe,CAAC,CAAC;YAE7E,OAAO,MAAM,sBAAa,CAAC,SAAS,+BAClC,MAAM,IACH,UAAU,KACb,QAAQ,EAAE,UAAU,CAAC,QAAuB,EAC5C,OAAO,EAAE,UAAU,CAAC,OAA+B,EACnD,KAAK,EAAE,UAAU,CAAC,KAA6B,EAC/C,cAAc,EAAE,UAAU,CAAC,cAMd,IACb,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const createSource: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
botId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
|
+
sourceProperties: import("@activepieces/pieces-framework").DynamicProperties<true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSource = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const zod_1 = tslib_1.__importDefault(require("zod"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.createSource = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: common_1.docsbotAuth,
|
|
10
|
+
name: 'createSource',
|
|
11
|
+
displayName: 'Create Source',
|
|
12
|
+
description: 'Create a new source for a bot.',
|
|
13
|
+
props: common_1.docsbotCommon.createSourceProperties(),
|
|
14
|
+
run(_a) {
|
|
15
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth: apiKey, propsValue }) {
|
|
16
|
+
// Some fields are conditionally required, so we need to use Zod validation manually here
|
|
17
|
+
const { sourceProperties } = propsValue, props = tslib_1.__rest(propsValue, ["sourceProperties"]);
|
|
18
|
+
const parsedProps = Object.assign(Object.assign({}, props), sourceProperties);
|
|
19
|
+
try {
|
|
20
|
+
yield common_1.docsbotCommon.createSourceSchema.parseAsync(parsedProps);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error instanceof zod_1.default.ZodError) {
|
|
24
|
+
const errors = error.errors.reduce((acc, err) => {
|
|
25
|
+
const path = err.path.join('.');
|
|
26
|
+
return Object.assign(Object.assign({}, acc), { [path]: err.message });
|
|
27
|
+
}, {});
|
|
28
|
+
throw new Error(JSON.stringify({ errors }, null, 2));
|
|
29
|
+
}
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
const { faqs } = parsedProps, restProps = tslib_1.__rest(parsedProps, ["faqs"]);
|
|
33
|
+
return yield common_1.docsbotCommon.createSource(Object.assign(Object.assign({ apiKey }, restProps), { faqs: faqs }));
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=create-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-source.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/docsbot/src/lib/actions/create-source.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,sDAAoB;AACpB,sCAAuD;AAG1C,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE,sBAAa,CAAC,sBAAsB,EAAE;IACvC,GAAG;qEAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE;YACpC,yFAAyF;YACzF,MAAM,EAAE,gBAAgB,KAAe,UAAU,EAApB,KAAK,kBAAK,UAAU,EAA3C,oBAA8B,CAAa,CAAC;YAClD,MAAM,WAAW,mCACZ,KAAK,GACL,gBAAgB,CACpB,CAAC;YACF,IAAI,CAAC;gBACH,MAAM,sBAAa,CAAC,kBAAkB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YACjE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,aAAC,CAAC,QAAQ,EAAE,CAAC;oBAChC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;wBAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBAChC,uCACK,GAAG,KACN,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,IACnB;oBACJ,CAAC,EAAE,EAAE,CAAC,CAAC;oBACP,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACvD,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;YAED,MAAM,EAAE,IAAI,KAAmB,WAAW,EAAzB,SAAS,kBAAK,WAAW,EAApC,QAAsB,CAAc,CAAC;YAE3C,OAAO,MAAM,sBAAa,CAAC,YAAY,+BACrC,MAAM,IACH,SAAS,KACZ,IAAI,EAAE,IAA0D,IAChE,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const findBot: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findBot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.findBot = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: common_1.docsbotAuth,
|
|
10
|
+
name: 'findBot',
|
|
11
|
+
displayName: 'Find Bot',
|
|
12
|
+
description: 'Finds bot by name.',
|
|
13
|
+
props: common_1.docsbotCommon.findBotProperties(),
|
|
14
|
+
run(_a) {
|
|
15
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth: apiKey, propsValue }) {
|
|
16
|
+
yield pieces_common_1.propsValidation.validateZod(propsValue, common_1.docsbotCommon.findBotSchema);
|
|
17
|
+
const { teamId, name } = propsValue;
|
|
18
|
+
const teamBots = yield common_1.docsbotCommon.listBots({
|
|
19
|
+
apiKey,
|
|
20
|
+
teamId,
|
|
21
|
+
});
|
|
22
|
+
const needle = (name !== null && name !== void 0 ? name : '').trim().toLowerCase();
|
|
23
|
+
// Try to find case-insensitive and partial match
|
|
24
|
+
const bot = teamBots.filter((bot) => { var _a; return ((_a = bot.name) !== null && _a !== void 0 ? _a : '').toLowerCase().includes(needle); });
|
|
25
|
+
if (bot.length === 0) {
|
|
26
|
+
throw new Error(`No bot found with a name containing "${name}" in the selected team.`);
|
|
27
|
+
}
|
|
28
|
+
return bot;
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=find-bot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-bot.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/docsbot/src/lib/actions/find-bot.ts"],"names":[],"mappings":";;;;AAAA,+DAA8D;AAC9D,qEAA8D;AAC9D,sCAAuD;AAE1C,QAAA,OAAO,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE,sBAAa,CAAC,iBAAiB,EAAE;IAClC,GAAG;qEAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE;YACpC,MAAM,+BAAe,CAAC,WAAW,CAAC,UAAU,EAAE,sBAAa,CAAC,aAAa,CAAC,CAAC;YAE3E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;YACpC,MAAM,QAAQ,GAAG,MAAM,sBAAa,CAAC,QAAQ,CAAC;gBAC5C,MAAM;gBACN,MAAM;aACP,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACjD,iDAAiD;YACjD,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,WAClC,OAAA,CAAC,MAAA,GAAG,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA,EAAA,CAChD,CAAC;YAEF,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,yBAAyB,CACtE,CAAC;YACJ,CAAC;YAED,OAAO,GAAG,CAAC;QACb,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const uploadSourceFile: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
botId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
file: import("@activepieces/pieces-framework").FileProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadSourceFile = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.uploadSourceFile = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: common_1.docsbotAuth,
|
|
10
|
+
name: 'uploadSourceFile',
|
|
11
|
+
displayName: 'Upload Source File',
|
|
12
|
+
description: 'Upload a file to be used as a source.',
|
|
13
|
+
props: common_1.docsbotCommon.uploadSourceFileProperties(),
|
|
14
|
+
run(_a) {
|
|
15
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth: apiKey, propsValue }) {
|
|
16
|
+
console.log("file:", propsValue.file, typeof propsValue.file);
|
|
17
|
+
yield pieces_common_1.propsValidation.validateZod(propsValue, common_1.docsbotCommon.uploadSourceFileSchema);
|
|
18
|
+
const { botId, file, teamId } = propsValue;
|
|
19
|
+
const presignedUrl = yield common_1.docsbotCommon.createPresignedFileUploadURL({
|
|
20
|
+
apiKey,
|
|
21
|
+
teamId,
|
|
22
|
+
botId,
|
|
23
|
+
fileName: file.filename,
|
|
24
|
+
});
|
|
25
|
+
yield common_1.docsbotCommon.uploadFileToCloudStorage({
|
|
26
|
+
uploadUrl: presignedUrl.url,
|
|
27
|
+
file: file.data,
|
|
28
|
+
});
|
|
29
|
+
return presignedUrl;
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=upload-source-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-source-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/docsbot/src/lib/actions/upload-source-file.ts"],"names":[],"mappings":";;;;AAAA,+DAA8D;AAC9D,qEAA8D;AAC9D,sCAAuD;AAE1C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,oBAAW;IACjB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE,sBAAa,CAAC,0BAA0B,EAAE;IAC3C,GAAG;qEAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE;YACpC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;YAC9D,MAAM,+BAAe,CAAC,WAAW,CAC/B,UAAU,EACV,sBAAa,CAAC,sBAAsB,CACrC,CAAC;YAEF,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;YAC3C,MAAM,YAAY,GAAG,MAAM,sBAAa,CAAC,4BAA4B,CAAC;gBACpE,MAAM;gBACN,MAAM;gBACN,KAAK;gBACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC,CAAC;YACH,MAAM,sBAAa,CAAC,wBAAwB,CAAC;gBAC3C,SAAS,EAAE,YAAY,CAAC,GAAG;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;YACH,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { askQuestionRequestParams, Bot, createBotRequestParams, createSourceRequestParams, listBotsParams, PresignedUpdateUrlResponse, Team, createSourceUrlParams as teamAndBotUrlParams, uploadSourceFileRequestParams, uploadToCloudStorageParams } from './types';
|
|
2
|
+
export declare const docsbotAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
export declare const docsbotCommon: {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
endpoints: {
|
|
6
|
+
askQuestion: ({ teamId, botId }: teamAndBotUrlParams) => string;
|
|
7
|
+
createSource: ({ teamId, botId }: teamAndBotUrlParams) => string;
|
|
8
|
+
createBot: (teamId: string) => string;
|
|
9
|
+
createPresignedFileUploadURL: ({ teamId, botId }: teamAndBotUrlParams) => string;
|
|
10
|
+
listTeams: () => string;
|
|
11
|
+
listBots: (teamId: string) => string;
|
|
12
|
+
};
|
|
13
|
+
askQuestionProperties: () => {
|
|
14
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
15
|
+
botId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
question: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
17
|
+
metadata: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
18
|
+
context_items: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
19
|
+
human_escalation: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
20
|
+
followup_rating: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
21
|
+
document_retriever: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
22
|
+
full_source: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
23
|
+
autocut: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
24
|
+
testing: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
25
|
+
image_urls: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
26
|
+
model: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
27
|
+
default_language: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
reasoning_effort: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
29
|
+
};
|
|
30
|
+
createSourceProperties: () => {
|
|
31
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
32
|
+
botId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
33
|
+
type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
34
|
+
sourceProperties: import("@activepieces/pieces-framework").DynamicProperties<true>;
|
|
35
|
+
};
|
|
36
|
+
uploadSourceFileProperties: () => {
|
|
37
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
38
|
+
botId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
39
|
+
file: import("@activepieces/pieces-framework").FileProperty<true>;
|
|
40
|
+
};
|
|
41
|
+
createBotProperties: () => {
|
|
42
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
43
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
44
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
45
|
+
privacy: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
46
|
+
language: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
47
|
+
model: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
48
|
+
embeddingModel: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
49
|
+
copyFrom: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
50
|
+
};
|
|
51
|
+
findBotProperties: () => {
|
|
52
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
53
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
54
|
+
};
|
|
55
|
+
askQuestionSchema: {
|
|
56
|
+
teamId: import("zod").ZodString;
|
|
57
|
+
botId: import("zod").ZodString;
|
|
58
|
+
question: import("zod").ZodString;
|
|
59
|
+
metadata: import("zod").ZodOptional<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>>;
|
|
60
|
+
context_items: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
61
|
+
human_escalation: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
62
|
+
followup_rating: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
63
|
+
document_retriever: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
64
|
+
full_source: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
65
|
+
autocut: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
66
|
+
testing: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
67
|
+
image_urls: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
68
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
69
|
+
default_language: import("zod").ZodOptional<import("zod").ZodString>;
|
|
70
|
+
reasoning_effort: import("zod").ZodOptional<import("zod").ZodEnum<["minimal", "low", "medium", "high"]>>;
|
|
71
|
+
};
|
|
72
|
+
createSourceSchema: import("zod").ZodEffects<import("zod").ZodObject<{
|
|
73
|
+
type: import("zod").ZodEnum<["url", "document", "sitemap", "wp", "urls", "csv", "rss", "qa", "youtube"]>;
|
|
74
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
75
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
76
|
+
file: import("zod").ZodOptional<import("zod").ZodString>;
|
|
77
|
+
faqs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
78
|
+
question: import("zod").ZodString;
|
|
79
|
+
answer: import("zod").ZodString;
|
|
80
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
81
|
+
question: string;
|
|
82
|
+
answer: string;
|
|
83
|
+
}, {
|
|
84
|
+
question: string;
|
|
85
|
+
answer: string;
|
|
86
|
+
}>, "many">>;
|
|
87
|
+
scheduleInterval: import("zod").ZodOptional<import("zod").ZodEnum<["daily", "weekly", "monthly", "none"]>>;
|
|
88
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
89
|
+
type: "url" | "document" | "sitemap" | "wp" | "urls" | "csv" | "rss" | "qa" | "youtube";
|
|
90
|
+
url?: string | undefined;
|
|
91
|
+
title?: string | undefined;
|
|
92
|
+
file?: string | undefined;
|
|
93
|
+
faqs?: {
|
|
94
|
+
question: string;
|
|
95
|
+
answer: string;
|
|
96
|
+
}[] | undefined;
|
|
97
|
+
scheduleInterval?: "daily" | "weekly" | "monthly" | "none" | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
type: "url" | "document" | "sitemap" | "wp" | "urls" | "csv" | "rss" | "qa" | "youtube";
|
|
100
|
+
url?: string | undefined;
|
|
101
|
+
title?: string | undefined;
|
|
102
|
+
file?: string | undefined;
|
|
103
|
+
faqs?: {
|
|
104
|
+
question: string;
|
|
105
|
+
answer: string;
|
|
106
|
+
}[] | undefined;
|
|
107
|
+
scheduleInterval?: "daily" | "weekly" | "monthly" | "none" | undefined;
|
|
108
|
+
}>, {
|
|
109
|
+
type: "url" | "document" | "sitemap" | "wp" | "urls" | "csv" | "rss" | "qa" | "youtube";
|
|
110
|
+
url?: string | undefined;
|
|
111
|
+
title?: string | undefined;
|
|
112
|
+
file?: string | undefined;
|
|
113
|
+
faqs?: {
|
|
114
|
+
question: string;
|
|
115
|
+
answer: string;
|
|
116
|
+
}[] | undefined;
|
|
117
|
+
scheduleInterval?: "daily" | "weekly" | "monthly" | "none" | undefined;
|
|
118
|
+
}, {
|
|
119
|
+
type: "url" | "document" | "sitemap" | "wp" | "urls" | "csv" | "rss" | "qa" | "youtube";
|
|
120
|
+
url?: string | undefined;
|
|
121
|
+
title?: string | undefined;
|
|
122
|
+
file?: string | undefined;
|
|
123
|
+
faqs?: {
|
|
124
|
+
question: string;
|
|
125
|
+
answer: string;
|
|
126
|
+
}[] | undefined;
|
|
127
|
+
scheduleInterval?: "daily" | "weekly" | "monthly" | "none" | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
uploadSourceFileSchema: {
|
|
130
|
+
teamId: import("zod").ZodString;
|
|
131
|
+
botId: import("zod").ZodString;
|
|
132
|
+
file: import("zod").ZodObject<{
|
|
133
|
+
filename: import("zod").ZodString;
|
|
134
|
+
data: import("zod").ZodType<Buffer, import("zod").ZodTypeDef, Buffer>;
|
|
135
|
+
extension: import("zod").ZodOptional<import("zod").ZodString>;
|
|
136
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
137
|
+
filename: string;
|
|
138
|
+
data: Buffer;
|
|
139
|
+
extension?: string | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
filename: string;
|
|
142
|
+
data: Buffer;
|
|
143
|
+
extension?: string | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
};
|
|
146
|
+
createBotSchema: {
|
|
147
|
+
teamId: import("zod").ZodString;
|
|
148
|
+
name: import("zod").ZodString;
|
|
149
|
+
description: import("zod").ZodString;
|
|
150
|
+
privacy: import("zod").ZodEnum<["public", "private"]>;
|
|
151
|
+
language: import("zod").ZodEnum<["en", "jp"]>;
|
|
152
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
153
|
+
embeddingModel: import("zod").ZodOptional<import("zod").ZodEnum<["text-embedding-ada-002", "text-embedding-3-large", "text-embedding-3-small", "embed-multilingual-v3.0", "embed-v4.0"]>>;
|
|
154
|
+
copyFrom: import("zod").ZodOptional<import("zod").ZodString>;
|
|
155
|
+
};
|
|
156
|
+
findBotSchema: {
|
|
157
|
+
teamId: import("zod").ZodString;
|
|
158
|
+
name: import("zod").ZodString;
|
|
159
|
+
};
|
|
160
|
+
askQuestion: ({ apiKey, teamId, botId, ...chatParams }: askQuestionRequestParams) => Promise<any>;
|
|
161
|
+
createSource: ({ apiKey, teamId, botId, ...sourceParams }: createSourceRequestParams) => Promise<any>;
|
|
162
|
+
createBot: ({ apiKey, teamId, ...botParams }: createBotRequestParams) => Promise<any>;
|
|
163
|
+
createPresignedFileUploadURL: ({ apiKey, teamId, botId, fileName, }: uploadSourceFileRequestParams) => Promise<PresignedUpdateUrlResponse>;
|
|
164
|
+
uploadFileToCloudStorage: ({ uploadUrl, file, }: uploadToCloudStorageParams) => Promise<any>;
|
|
165
|
+
listBots: ({ apiKey, teamId }: listBotsParams) => Promise<Bot[]>;
|
|
166
|
+
listTeams: (apiKey: string) => Promise<Team[]>;
|
|
167
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.docsbotCommon = exports.docsbotAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const properties = tslib_1.__importStar(require("./properties"));
|
|
8
|
+
const schemas = tslib_1.__importStar(require("./schemas"));
|
|
9
|
+
exports.docsbotAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
10
|
+
displayName: 'API Key',
|
|
11
|
+
required: true,
|
|
12
|
+
description: 'The API key for authenticating with DocsBot.',
|
|
13
|
+
});
|
|
14
|
+
exports.docsbotCommon = {
|
|
15
|
+
// API Info
|
|
16
|
+
baseUrl: 'https://docsbot.ai/api',
|
|
17
|
+
endpoints: {
|
|
18
|
+
askQuestion: ({ teamId, botId }) => `https://api.docsbot.ai/teams/${teamId}/bots/${botId}/chat-agent`,
|
|
19
|
+
createSource: ({ teamId, botId }) => `${exports.docsbotCommon.baseUrl}/teams/${teamId}/bots/${botId}/sources`,
|
|
20
|
+
createBot: (teamId) => `${exports.docsbotCommon.baseUrl}/teams/${teamId}/bots`,
|
|
21
|
+
createPresignedFileUploadURL: ({ teamId, botId }) => `${exports.docsbotCommon.baseUrl}/teams/${teamId}/bots/${botId}/upload-url`,
|
|
22
|
+
listTeams: () => `${exports.docsbotCommon.baseUrl}/teams`,
|
|
23
|
+
listBots: (teamId) => `${exports.docsbotCommon.baseUrl}/teams/${teamId}/bots`,
|
|
24
|
+
},
|
|
25
|
+
// Properties
|
|
26
|
+
askQuestionProperties: properties.askQuestion,
|
|
27
|
+
createSourceProperties: properties.createSource,
|
|
28
|
+
uploadSourceFileProperties: properties.uploadSourceFile,
|
|
29
|
+
createBotProperties: properties.createBot,
|
|
30
|
+
findBotProperties: properties.findBot,
|
|
31
|
+
// Schemas
|
|
32
|
+
askQuestionSchema: schemas.askQuestion,
|
|
33
|
+
createSourceSchema: schemas.createSource,
|
|
34
|
+
uploadSourceFileSchema: schemas.uploadSourceFile,
|
|
35
|
+
createBotSchema: schemas.createBot,
|
|
36
|
+
findBotSchema: schemas.findBot,
|
|
37
|
+
// Methods
|
|
38
|
+
askQuestion: (_a) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
var { apiKey, teamId, botId } = _a, chatParams = tslib_1.__rest(_a, ["apiKey", "teamId", "botId"]);
|
|
40
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
41
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
42
|
+
url: exports.docsbotCommon.endpoints.askQuestion({ teamId, botId }),
|
|
43
|
+
headers: {
|
|
44
|
+
Authorization: `Bearer ${apiKey}`,
|
|
45
|
+
},
|
|
46
|
+
body: Object.assign({}, chatParams),
|
|
47
|
+
});
|
|
48
|
+
return response.body;
|
|
49
|
+
}),
|
|
50
|
+
createSource: (_a) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
var { apiKey, teamId, botId } = _a, sourceParams = tslib_1.__rest(_a, ["apiKey", "teamId", "botId"]);
|
|
52
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
53
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
54
|
+
url: exports.docsbotCommon.endpoints.createSource({
|
|
55
|
+
teamId: teamId,
|
|
56
|
+
botId: botId,
|
|
57
|
+
}),
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: `Bearer ${apiKey}`,
|
|
60
|
+
},
|
|
61
|
+
body: Object.assign({}, sourceParams),
|
|
62
|
+
});
|
|
63
|
+
return response.body;
|
|
64
|
+
}),
|
|
65
|
+
createBot: (_a) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
var { apiKey, teamId } = _a, botParams = tslib_1.__rest(_a, ["apiKey", "teamId"]);
|
|
67
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
68
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
69
|
+
url: exports.docsbotCommon.endpoints.createBot(teamId),
|
|
70
|
+
headers: {
|
|
71
|
+
Authorization: `Bearer ${apiKey}`,
|
|
72
|
+
},
|
|
73
|
+
body: Object.assign({}, botParams),
|
|
74
|
+
});
|
|
75
|
+
return response.body;
|
|
76
|
+
}),
|
|
77
|
+
createPresignedFileUploadURL: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, teamId, botId, fileName, }) {
|
|
78
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
79
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
80
|
+
url: exports.docsbotCommon.endpoints.createPresignedFileUploadURL({
|
|
81
|
+
teamId,
|
|
82
|
+
botId,
|
|
83
|
+
}) + `?fileName=${encodeURIComponent(fileName)}`,
|
|
84
|
+
headers: {
|
|
85
|
+
Authorization: `Bearer ${apiKey}`,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
return response.body;
|
|
89
|
+
}),
|
|
90
|
+
uploadFileToCloudStorage: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ uploadUrl, file, }) {
|
|
91
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
92
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
93
|
+
url: uploadUrl,
|
|
94
|
+
headers: {
|
|
95
|
+
'Content-Type': 'application/octet-stream',
|
|
96
|
+
},
|
|
97
|
+
body: file,
|
|
98
|
+
});
|
|
99
|
+
return response.body;
|
|
100
|
+
}),
|
|
101
|
+
listBots: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, teamId }) {
|
|
102
|
+
const resonse = yield pieces_common_1.httpClient.sendRequest({
|
|
103
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
104
|
+
url: exports.docsbotCommon.endpoints.listBots(teamId),
|
|
105
|
+
headers: {
|
|
106
|
+
Authorization: `Bearer ${apiKey}`,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
return resonse.body;
|
|
110
|
+
}),
|
|
111
|
+
listTeams: (apiKey) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
113
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
114
|
+
url: exports.docsbotCommon.endpoints.listTeams(),
|
|
115
|
+
headers: {
|
|
116
|
+
Authorization: `Bearer ${apiKey}`,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
return response.body;
|
|
120
|
+
}),
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/docsbot/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AACrE,qEAA2D;AAC3D,iEAA2C;AAC3C,2DAAqC;AAcxB,QAAA,WAAW,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC9C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,8CAA8C;CAC5D,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG;IAC3B,WAAW;IACX,OAAO,EAAE,wBAAwB;IACjC,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAuB,EAAE,EAAE,CACtD,gCAAgC,MAAM,SAAS,KAAK,aAAa;QACnE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAuB,EAAE,EAAE,CACvD,GAAG,qBAAa,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