-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - burstyai #14224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - burstyai #14224
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23ebb94
init
michelle0927 56a2b2e
new component
michelle0927 baeb0c7
pnpm-lock.yaml
michelle0927 f5b9468
Merge remote-tracking branch 'origin/master' into issue-14212
michelle0927 d782540
Merge remote-tracking branch 'origin/master' into issue-14212
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import burstyai from "../../burstyai.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "burstyai-run-workflow", | ||
| name: "Run Workflow", | ||
| description: "Triggers an AI workflow on BurstyAI. [See the documentation](https://burstyai.readme.io/reference)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| burstyai, | ||
| workflow: { | ||
| type: "string", | ||
| label: "Workflow ID", | ||
| description: "The ID of the specific workflow to run. When viewing the workflow in BurstyAI, the ID is the last part of the URL. Example: `65e1cd00141fdc000195cb88`", | ||
| }, | ||
| params: { | ||
| type: "object", | ||
| label: "Parameters", | ||
| description: "Optional parameters for the workflow", | ||
| optional: true, | ||
| }, | ||
| waitForCompletion: { | ||
| type: "boolean", | ||
| label: "Wait For Completion", | ||
| description: "Set to `true` to poll the API in 3-second intervals until the workflow is completed", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| let response = await this.burstyai.triggerWorkflow({ | ||
| $, | ||
| workflow: this.workflow, | ||
| data: { | ||
| params: this.params || {}, | ||
| }, | ||
| }); | ||
|
|
||
| const jobId = response; | ||
|
|
||
| if (this.waitForCompletion) { | ||
| const timer = (ms) => new Promise((res) => setTimeout(res, ms)); | ||
| while (response?.jobStatus !== "END" && response?.jobStatus !== "ERROR") { | ||
| response = await this.burstyai.getWorkflowExecutionResult({ | ||
| $, | ||
| jobId, | ||
| }); | ||
| await timer(3000); | ||
| } | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (response?.status === "END") { | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $.export("$summary", `Successfully triggered workflow ${this.workflow}`); | ||
| } | ||
|
|
||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,42 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "burstyai", | ||
| propDefinitions: {}, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://app.burstyai.com/burstyai"; | ||
| }, | ||
| _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: `${this._baseUrl()}${path}`, | ||
| headers: { | ||
| Authorization: `Bearer ${this.$auth.api_key}`, | ||
| }, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| triggerWorkflow({ | ||
| workflow, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: `/aiflows/${workflow}/async_run`, | ||
| ...args, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| getWorkflowExecutionResult({ | ||
| jobId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/aiflowjobs/${jobId}/result`, | ||
| ...args, | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/burstyai", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream BurstyAI Components", | ||
| "main": "burstyai.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.