Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import mintlify from "../../mintlify.app.mjs";
import { v4 as uuidv4 } from "uuid";

export default {
key: "mintlify-chat-with-assistant",
name: "Chat with Assistant",
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)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
mintlify,
domain: {
propDefinition: [
mintlify,
"domain",
],
},
fp: {
type: "string",
label: "FP",
description: "Browser fingerprint or arbitrary string identifier. There may be future functionality which allows you to get the messages for a given fingerprint",
},
message: {
type: "string",
label: "Message",
description: "The content of the message",
},
},
async run({ $ }) {
const response = await this.mintlify.chatWithAssistant({
$,
domain: this.domain,
data: {
fp: this.fp,
messages: [
{
id: uuidv4(),
role: "user",
content: this.message,
parts: [
{
type: "text",
text: this.message,
},
],
},
],
},
});

$.export("$summary", `Successfully sent message with ID ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import mintlify from "../../mintlify.app.mjs";

export default {
key: "mintlify-search-documentation",
name: "Search Documentation",
description: "Perform semantic and keyword searches across your documentation. [See the documentation](https://www.mintlify.com/docs/api-reference/assistant/search)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
props: {
mintlify,
domain: {
propDefinition: [
mintlify,
"domain",
],
},
query: {
type: "string",
label: "Search Query",
description: "The search query to execute against your documentation content",
},
pageSize: {
type: "integer",
label: "Page Size",
description: "Number of search results to return. Defaults to 10 if not specified",
optional: true,
},
version: {
type: "string",
label: "Version",
description: "Filter results by documentation version",
optional: true,
},
language: {
type: "string",
label: "Language",
description: "Filter results by content language",
optional: true,
},
},
async run({ $ }) {
const response = await this.mintlify.searchDocumentation({
$,
domain: this.domain,
data: {
query: this.query,
pageSize: this.pageSize,
filter: this.version || this.language
? {
version: this.version,
language: this.language,
}
: undefined,
},
});

$.export("$summary", `Found ${response.length} results`);
return response;
},
};
26 changes: 26 additions & 0 deletions components/mintlify/actions/trigger-update/trigger-update.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import mintlify from "../../mintlify.app.mjs";

export default {
key: "mintlify-trigger-update",
name: "Trigger Update",
description: "Trigger an update for a project. [See the documentation](https://www.mintlify.com/docs/api-reference/update/trigger)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
mintlify,
},
async run({ $ }) {
const response = await this.mintlify.triggerUpdate({
$,
});

$.export("$summary", `Successfully triggered an update for project ${this.mintlify.$auth.project_id}`);

return response;
},
};
54 changes: 50 additions & 4 deletions components/mintlify/mintlify.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "mintlify",
propDefinitions: {},
propDefinitions: {
domain: {
type: "string",
label: "Domain",
description: "The domain identifier from your domain.mintlify.app URL. Can be found in the top left of your dashboard.",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api-dsc.mintlify.com/v1";
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
headers: {
Authorization: `Bearer ${this.$auth.assistant_api_key}`,
},
...opts,
});
},
triggerUpdate(opts = {}) {
return this._makeRequest({
url: `https://api.mintlify.com/v1/project/update/${this.$auth.project_id}`,
method: "POST",
headers: {
Authorization: `Bearer ${this.$auth.admin_api_key}`,
},
...opts,
});
},
searchDocumentation({
domain, ...opts
}) {
return this._makeRequest({
path: `/search/${domain}`,
method: "POST",
...opts,
});
},
chatWithAssistant({
domain, ...opts
}) {
return this._makeRequest({
path: `/assistant/${domain}/message`,
method: "POST",
...opts,
});
},
},
};
8 changes: 6 additions & 2 deletions components/mintlify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/mintlify",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Mintlify Components",
"main": "mintlify.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,9 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0",
"uuid": "^13.0.0"
}
}
}
21 changes: 16 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading