Skip to content

Commit 78ef154

Browse files
committed
new components
1 parent 61d0151 commit 78ef154

File tree

5 files changed

+198
-6
lines changed

5 files changed

+198
-6
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import mintlify from "../../mintlify.app.mjs";
2+
import { v4 as uuidv4 } from "uuid";
3+
4+
export default {
5+
key: "mintlify-chat-with-assistant",
6+
name: "Chat with Assistant",
7+
description: "Generates a response message from the assistant for the specified domain. [See the documentation](https://www.mintlify.com/docs/api-reference/assistant/create-assistant-message)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
mintlify,
12+
domain: {
13+
propDefinition: [
14+
mintlify,
15+
"domain",
16+
],
17+
},
18+
fp: {
19+
type: "string",
20+
label: "FP",
21+
description: "Browser fingerprint or arbitrary string identifier. There may be future functionality which allows you to get the messages for a given fingerprint",
22+
},
23+
message: {
24+
type: "string",
25+
label: "Message",
26+
description: "The content of the message",
27+
},
28+
},
29+
async run({ $ }) {
30+
const response = await this.mintlify.chatWithAssistant({
31+
$,
32+
domain: this.domain,
33+
data: {
34+
fp: this.fp,
35+
messages: [
36+
{
37+
id: uuidv4(),
38+
role: "user",
39+
content: this.message,
40+
parts: [
41+
{
42+
type: "text",
43+
text: this.message,
44+
},
45+
],
46+
},
47+
],
48+
},
49+
});
50+
51+
$.export("$summary", `Successfully sent message with ID ${response.id}`);
52+
return response;
53+
},
54+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import mintlify from "../../mintlify.app.mjs";
2+
3+
export default {
4+
key: "mintlify-search-documentation",
5+
name: "Search Documentation",
6+
description: "Perform semantic and keyword searches across your documentation. [See the documentation](https://www.mintlify.com/docs/api-reference/assistant/search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mintlify,
11+
domain: {
12+
propDefinition: [
13+
mintlify,
14+
"domain",
15+
],
16+
},
17+
query: {
18+
type: "string",
19+
label: "Search Query",
20+
description: "The search query to execute against your documentation content",
21+
},
22+
pageSize: {
23+
type: "integer",
24+
label: "Page Size",
25+
description: "Number of search results to return. Defaults to 10 if not specified",
26+
optional: true,
27+
},
28+
version: {
29+
type: "string",
30+
label: "Version",
31+
description: "Filter results by documentation version",
32+
optional: true,
33+
},
34+
language: {
35+
type: "string",
36+
label: "Language",
37+
description: "Filter results by content language",
38+
optional: true,
39+
},
40+
},
41+
async run({ $ }) {
42+
const response = await this.mintlify.searchDocumentation({
43+
$,
44+
domain: this.domain,
45+
data: {
46+
query: this.query,
47+
pageSize: this.pageSize,
48+
filter: this.version || this.language
49+
? {
50+
version: this.version,
51+
language: this.language,
52+
}
53+
: undefined,
54+
},
55+
});
56+
57+
$.export("$summary", `Found ${response.length} results`);
58+
return response;
59+
},
60+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import mintlify from "../../mintlify.app.mjs";
2+
3+
export default {
4+
key: "mintlify-trigger-update",
5+
name: "Trigger Update",
6+
description: "Trigger an update for a project. [See the documentation](https://www.mintlify.com/docs/api-reference/update/trigger)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mintlify,
11+
projectId: {
12+
type: "string",
13+
label: "Project ID",
14+
description: "The ID of the project to trigger an update on. Can be retrieved from your dashboard.",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.mintlify.triggerUpdate({
19+
projectId: this.projectId,
20+
$,
21+
});
22+
23+
$.export("$summary", `Successfully triggered an update for project ${this.projectId}`);
24+
25+
return response;
26+
},
27+
};
Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,59 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "mintlify",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
domain: {
8+
type: "string",
9+
label: "Domain",
10+
description: "The domain identifier from your domain.mintlify.app URL. Can be found in the top left of your dashboard.",
11+
},
12+
},
513
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
14+
_baseUrl() {
15+
return "https://api-dsc.mintlify.com/v1";
16+
},
17+
_makeRequest({
18+
$ = this, path, ...opts
19+
}) {
20+
return axios($, {
21+
url: `${this._baseUrl()}${path}`,
22+
headers: {
23+
Authorization: `Bearer ${this.$auth.assistant_api_key}`,
24+
},
25+
...opts,
26+
});
27+
},
28+
triggerUpdate({
29+
projectId, ...opts
30+
}) {
31+
return this._makeRequest({
32+
url: `https://api.mintlify.com/v1/project/update/${projectId}`,
33+
method: "POST",
34+
headers: {
35+
Authorization: `Bearer ${this.$auth.admin_api_key}`,
36+
},
37+
...opts,
38+
});
39+
},
40+
searchDocumentation({
41+
domain, ...opts
42+
}) {
43+
return this._makeRequest({
44+
path: `/search/${domain}`,
45+
method: "POST",
46+
...opts,
47+
});
48+
},
49+
chatWithAssistant({
50+
domain, ...opts
51+
}) {
52+
return this._makeRequest({
53+
path: `/assistant/${domain}/message`,
54+
method: "POST",
55+
...opts,
56+
});
957
},
1058
},
1159
};

components/mintlify/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/mintlify",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Mintlify Components",
55
"main": "mintlify.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
15-
}
18+
}

0 commit comments

Comments
 (0)