-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[Components] Robopost #17638 #19218
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
[Components] Robopost #17638 #19218
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import app from "../../robopost.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "robopost-create-video-configuration", | ||
| name: "Create Video Configuration", | ||
| description: "Create a new faceless video series configuration for generating multiple videos with consistent settings. [See the documentation](https://robopost.app/docs/robopost-api/#videogenerationendpoints)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| name: { | ||
| propDefinition: [ | ||
| app, | ||
| "name", | ||
| ], | ||
| }, | ||
| contentType: { | ||
| propDefinition: [ | ||
| app, | ||
| "contentType", | ||
| ], | ||
| }, | ||
| style: { | ||
| propDefinition: [ | ||
| app, | ||
| "style", | ||
| ], | ||
| }, | ||
| voice: { | ||
| propDefinition: [ | ||
| app, | ||
| "voice", | ||
| ], | ||
| }, | ||
| lang: { | ||
| propDefinition: [ | ||
| app, | ||
| "lang", | ||
| ], | ||
| }, | ||
| maxDuration: { | ||
| propDefinition: [ | ||
| app, | ||
| "maxDuration", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.createVideoConfiguration({ | ||
| $, | ||
| data: { | ||
| name: this.name, | ||
| content_type: this.contentType, | ||
| style: this.style, | ||
| voice: this.voice, | ||
| lang: this.lang, | ||
| max_duration: this.maxDuration, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created video series configuration with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import app from "../../robopost.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "robopost-generate-video", | ||
| name: "Generate Video", | ||
| description: "Create a new video generation task from a video series. [See the documentation](https://robopost.app/docs/robopost-api/#videogenerationtasks)", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| configurationId: { | ||
| propDefinition: [ | ||
| app, | ||
| "configurationId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.generateVideo({ | ||
| $, | ||
| configurationId: this.configurationId, | ||
| }); | ||
| $.export("$summary", `Successfully started the task to generate the video. Task ID: ${response.task_id}`); | ||
| return response; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import app from "../../robopost.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "robopost-get-video-status", | ||
| name: "Get Video Status", | ||
| description: "Check the status of a video generation task. [See the documentation](https://robopost.app/docs/robopost-api/#videogenerationtasks)", | ||
| version: "0.0.2", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| taskId: { | ||
| propDefinition: [ | ||
| app, | ||
| "taskId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getVideoStatus({ | ||
| $, | ||
| taskId: this.taskId, | ||
| }); | ||
| $.export("$summary", `The task status is: ${response.status}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| export default { | ||
| CONTENT_TYPES: [ | ||
| "RANDOM_AI_STORY", | ||
| "SCARY_STORIES", | ||
| "BEDTIME_STORIES", | ||
| "INTERESTING_HISTORY", | ||
| "URBAN_LEGENDS", | ||
| "MOTIVATIONAL", | ||
| "FUN_FACTS", | ||
| "LONG_FORM_JOKES", | ||
| "LIFE_PRO_TIPS", | ||
| "ELI5", | ||
| "DID_YOU_KNOW", | ||
| "PHILOSOPHY", | ||
| "RECIPES", | ||
| "FITNESS", | ||
| "BEAUTY", | ||
| "GROWTH_ADVICE", | ||
| "PRODUCT_MARKETING", | ||
| "CUSTOM", | ||
| "BLOG_ARTICLE", | ||
| ], | ||
| STYLE_OPTIONS: [ | ||
| "DEFAULT", | ||
| "REALISM", | ||
| "IMPRESSIONISM", | ||
| "SURREALISM", | ||
| "ABSTRACT", | ||
| "ART_NOUVEAU", | ||
| "CUBISM", | ||
| "POP_ART", | ||
| "FUTURISM", | ||
| "FANTASY_CONCEPT_ART", | ||
| "MINIMALISM", | ||
| "WATERCOLOR", | ||
| "GOTHIC_MEDIEVAL_ART", | ||
| "ANIME", | ||
| "COMIC", | ||
| ], | ||
| VOICE_OPTIONS: [ | ||
| "ALICE", | ||
| "BILL", | ||
| "SARAH", | ||
| "BRIAN", | ||
| "LAURA", | ||
| "ARIA", | ||
| "CALLUM", | ||
| "CHARLIE", | ||
| ], | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,132 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| import { axios } from "@pipedream/platform"; | ||||||||||||||||||||||||||||||||||||||||||||
| import constants from "./common/constants.mjs"; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| export default { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "app", | ||||||||||||||||||||||||||||||||||||||||||||
| app: "robopost", | ||||||||||||||||||||||||||||||||||||||||||||
| propDefinitions: {}, | ||||||||||||||||||||||||||||||||||||||||||||
| propDefinitions: { | ||||||||||||||||||||||||||||||||||||||||||||
| name: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Name", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "Name of the video series configuration", | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| contentType: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Content Type", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "The type of the content of the video", | ||||||||||||||||||||||||||||||||||||||||||||
| options: constants.CONTENT_TYPES, | ||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| style: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Style", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "The style of the video", | ||||||||||||||||||||||||||||||||||||||||||||
| options: constants.STYLE_OPTIONS, | ||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| voice: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Voice", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "The voice used for the video", | ||||||||||||||||||||||||||||||||||||||||||||
| options: constants.VOICE_OPTIONS, | ||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| lang: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Language Code", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "Language of the video, i.e.: `en`", | ||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| maxDuration: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "integer", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Max Duration", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "Maximum video duration in seconds (5-600)", | ||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
GTFalcao marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||
| configurationId: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Configuration ID", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "ID of the configuration for the video generation", | ||||||||||||||||||||||||||||||||||||||||||||
| async options() { | ||||||||||||||||||||||||||||||||||||||||||||
| const response = await this.getVideoSeries(); | ||||||||||||||||||||||||||||||||||||||||||||
| return response.map(({ | ||||||||||||||||||||||||||||||||||||||||||||
| name, id, | ||||||||||||||||||||||||||||||||||||||||||||
| }) => ({ | ||||||||||||||||||||||||||||||||||||||||||||
| label: name, | ||||||||||||||||||||||||||||||||||||||||||||
| value: id, | ||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+52
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Add defensive handling for API responses in options(). If async options() {
- const response = await this.getVideoSeries();
- return response.map(({
- name, id,
- }) => ({
- label: name,
- value: id,
- }));
+ const response = await this.getVideoSeries();
+ return (response ?? []).map(({
+ name, id,
+ }) => ({
+ label: name,
+ value: id,
+ }));
},🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| taskId: { | ||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||
| label: "Task ID", | ||||||||||||||||||||||||||||||||||||||||||||
| description: "ID of the task to be checked", | ||||||||||||||||||||||||||||||||||||||||||||
| async options() { | ||||||||||||||||||||||||||||||||||||||||||||
| const response = await this.getTaskStatus(); | ||||||||||||||||||||||||||||||||||||||||||||
| return response.map(({ | ||||||||||||||||||||||||||||||||||||||||||||
| created_at, task_id, | ||||||||||||||||||||||||||||||||||||||||||||
| }) => ({ | ||||||||||||||||||||||||||||||||||||||||||||
| label: created_at, | ||||||||||||||||||||||||||||||||||||||||||||
| value: task_id, | ||||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Same defensive handling needed for taskId options(). Apply similar null-coalescing to prevent runtime errors if async options() {
- const response = await this.getTaskStatus();
- return response.map(({
+ const response = await this.getTaskStatus();
+ return (response ?? []).map(({
created_at, task_id,
}) => ({
label: created_at,
value: task_id,
}));
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| methods: { | ||||||||||||||||||||||||||||||||||||||||||||
| // this.$auth contains connected account data | ||||||||||||||||||||||||||||||||||||||||||||
| authKeys() { | ||||||||||||||||||||||||||||||||||||||||||||
| console.log(Object.keys(this.$auth)); | ||||||||||||||||||||||||||||||||||||||||||||
| _baseUrl() { | ||||||||||||||||||||||||||||||||||||||||||||
| return "https://public-api.robopost.app/v1"; | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| async _makeRequest(opts = {}) { | ||||||||||||||||||||||||||||||||||||||||||||
| const { | ||||||||||||||||||||||||||||||||||||||||||||
| $ = this, | ||||||||||||||||||||||||||||||||||||||||||||
| path, | ||||||||||||||||||||||||||||||||||||||||||||
| params, | ||||||||||||||||||||||||||||||||||||||||||||
| ...otherOpts | ||||||||||||||||||||||||||||||||||||||||||||
| } = opts; | ||||||||||||||||||||||||||||||||||||||||||||
| return axios($, { | ||||||||||||||||||||||||||||||||||||||||||||
| ...otherOpts, | ||||||||||||||||||||||||||||||||||||||||||||
| url: this._baseUrl() + path, | ||||||||||||||||||||||||||||||||||||||||||||
| params: { | ||||||||||||||||||||||||||||||||||||||||||||
| apikey: `${this.$auth.api_key}`, | ||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Remove unnecessary string interpolation. The template literal is redundant since Apply this diff: params: {
- apikey: `${this.$auth.api_key}`,
+ apikey: this.$auth.api_key,
...params,
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| ...params, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| async createVideoConfiguration(args = {}) { | ||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||
| path: "/video-series", | ||||||||||||||||||||||||||||||||||||||||||||
| method: "post", | ||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| async generateVideo({ | ||||||||||||||||||||||||||||||||||||||||||||
| configurationId, ...args | ||||||||||||||||||||||||||||||||||||||||||||
| }) { | ||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||
| path: `/video-tasks/${configurationId}/generate`, | ||||||||||||||||||||||||||||||||||||||||||||
| method: "post", | ||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+104
to
+112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider validating required parameters. The method destructures Adding validation would improve error messages: async generateVideo({
configurationId, ...args
}) {
+ if (!configurationId) {
+ throw new Error("configurationId is required");
+ }
return this._makeRequest({
path: `/video-tasks/${configurationId}/generate`,
method: "post",
...args,
});
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| async getVideoStatus({ | ||||||||||||||||||||||||||||||||||||||||||||
| taskId, ...args | ||||||||||||||||||||||||||||||||||||||||||||
| }) { | ||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||
| path: `/video-tasks/${taskId}`, | ||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+113
to
+120
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider validating required parameters. The method destructures Adding validation would improve error messages: async getVideoStatus({
taskId, ...args
}) {
+ if (!taskId) {
+ throw new Error("taskId is required");
+ }
return this._makeRequest({
path: `/video-tasks/${taskId}`,
...args,
});
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| async getVideoSeries(args = {}) { | ||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||
| path: "/video-series", | ||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| async getTaskStatus(args = {}) { | ||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||
| path: "/video-tasks", | ||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider guarding against undefined status in the summary.
If the API response doesn't include a
statusfield, the summary will display "undefined". Consider adding a fallback.📝 Committable suggestion
🤖 Prompt for AI Agents