Skip to content

Commit d62e552

Browse files
authored
Mintlify - new components (#18519)
* new components * update * pnpm-lock.yaml * add annotations * update
1 parent ffb9b81 commit d62e552

File tree

6 files changed

+220
-7
lines changed

6 files changed

+220
-7
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
props: {
16+
mintlify,
17+
domain: {
18+
propDefinition: [
19+
mintlify,
20+
"domain",
21+
],
22+
},
23+
fp: {
24+
type: "string",
25+
label: "FP",
26+
description: "Browser fingerprint or arbitrary string identifier. There may be future functionality which allows you to get the messages for a given fingerprint",
27+
},
28+
message: {
29+
type: "string",
30+
label: "Message",
31+
description: "The content of the message",
32+
},
33+
},
34+
async run({ $ }) {
35+
const response = await this.mintlify.chatWithAssistant({
36+
$,
37+
domain: this.domain,
38+
data: {
39+
fp: this.fp,
40+
messages: [
41+
{
42+
id: uuidv4(),
43+
role: "user",
44+
content: this.message,
45+
parts: [
46+
{
47+
type: "text",
48+
text: this.message,
49+
},
50+
],
51+
},
52+
],
53+
},
54+
});
55+
56+
$.export("$summary", `Successfully sent message with ID ${response.id}`);
57+
return response;
58+
},
59+
};
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
mintlify,
16+
domain: {
17+
propDefinition: [
18+
mintlify,
19+
"domain",
20+
],
21+
},
22+
query: {
23+
type: "string",
24+
label: "Search Query",
25+
description: "The search query to execute against your documentation content",
26+
},
27+
pageSize: {
28+
type: "integer",
29+
label: "Page Size",
30+
description: "Number of search results to return. Defaults to 10 if not specified",
31+
optional: true,
32+
},
33+
version: {
34+
type: "string",
35+
label: "Version",
36+
description: "Filter results by documentation version",
37+
optional: true,
38+
},
39+
language: {
40+
type: "string",
41+
label: "Language",
42+
description: "Filter results by content language",
43+
optional: true,
44+
},
45+
},
46+
async run({ $ }) {
47+
const response = await this.mintlify.searchDocumentation({
48+
$,
49+
domain: this.domain,
50+
data: {
51+
query: this.query,
52+
pageSize: this.pageSize,
53+
filter: this.version || this.language
54+
? {
55+
version: this.version,
56+
language: this.language,
57+
}
58+
: undefined,
59+
},
60+
});
61+
62+
$.export("$summary", `Found ${response.length} results`);
63+
return response;
64+
},
65+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
mintlify,
16+
},
17+
async run({ $ }) {
18+
const response = await this.mintlify.triggerUpdate({
19+
$,
20+
});
21+
22+
$.export("$summary", `Successfully triggered an update for project ${this.mintlify.$auth.project_id}`);
23+
24+
return response;
25+
},
26+
};
Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,57 @@
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(opts = {}) {
29+
return this._makeRequest({
30+
url: `https://api.mintlify.com/v1/project/update/${this.$auth.project_id}`,
31+
method: "POST",
32+
headers: {
33+
Authorization: `Bearer ${this.$auth.admin_api_key}`,
34+
},
35+
...opts,
36+
});
37+
},
38+
searchDocumentation({
39+
domain, ...opts
40+
}) {
41+
return this._makeRequest({
42+
path: `/search/${domain}`,
43+
method: "POST",
44+
...opts,
45+
});
46+
},
47+
chatWithAssistant({
48+
domain, ...opts
49+
}) {
50+
return this._makeRequest({
51+
path: `/assistant/${domain}/message`,
52+
method: "POST",
53+
...opts,
54+
});
955
},
1056
},
1157
};

components/mintlify/package.json

Lines changed: 6 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,9 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0",
17+
"uuid": "^13.0.0"
1418
}
15-
}
19+
}

pnpm-lock.yaml

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)