Skip to content

17338 components joggai #17503

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 4 commits into from
Jul 11, 2025
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,97 @@
import {
AGE_OPTIONS,
ASPECT_RATIO_OPTIONS,
AVATAR_STYLE_OPTIONS,
ETHNICITY_OPTIONS,
GENDER_OPTIONS,
MODEL_OPTIONS,
} from "../../common/constants.mjs";
import { checkResponse } from "../../common/utils.mjs";
import joggai from "../../joggai.app.mjs";

export default {
key: "joggai-create-ai-avatar-photo",
name: "Create AI Avatar Photo",
description: "Creates an AI avatar photo using JoggAI API. [See the documentation](https://docs.jogg.ai/api-reference/Avatar/GenerateAIAvatarPhoto)",
version: "0.0.1",
type: "action",
props: {
joggai,
age: {
type: "string",
label: "Age",
description: "Age of the avatar.",
options: AGE_OPTIONS,
},
aspectRatio: {
type: "string",
label: "Aspect Ratio",
description: "Aspect ratio of the avatar.",
options: ASPECT_RATIO_OPTIONS,
},
avatarStyle: {
type: "string",
label: "Avatar Style",
description: "Style of the avatar.",
options: AVATAR_STYLE_OPTIONS,
},
gender: {
type: "string",
label: "Gender",
description: "Gender of the avatar.",
options: GENDER_OPTIONS,
},
model: {
type: "string",
label: "Model",
description: "Model of the avatar.",
options: MODEL_OPTIONS,
},
appearance: {
type: "string",
label: "Appearance",
description: "Appearance of the avatar.",
optional: true,
},
background: {
type: "string",
label: "Background",
description: "Background of the avatar.",
optional: true,
},
ethnicity: {
type: "string",
label: "Ethnicity",
description: "Ethnicity of the avatar.",
options: ETHNICITY_OPTIONS,
optional: true,
},
imageUrl: {
type: "string",
label: "Image URL",
description: "URL of the image to use for the avatar.",
optional: true,
},
},
async run({ $ }) {
const response = await this.joggai.createAIAvatarPhoto({
$,
data: {
age: this.age,
aspect_ratio: this.aspectRatio && parseInt(this.aspectRatio),
avatar_style: this.avatarStyle,
gender: this.gender,
model: this.model,
appearance: this.appearance,
background: this.background,
image_url: this.imageUrl,
ethnicity: this.ethnicity,
},
});

checkResponse(response);

$.export("$summary", "AI avatar photo created successfully");
return response;
},
};
113 changes: 113 additions & 0 deletions components/joggai/actions/create-avatar-video/create-avatar-video.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import {
ASPECT_VIDEO_RATIO_OPTIONS,
AVATAR_TYPE_OPTIONS,
SCREEN_STYLE_OPTIONS,
VOICE_TYPE_OPTIONS,
} from "../../common/constants.mjs";
import { checkResponse } from "../../common/utils.mjs";
import joggai from "../../joggai.app.mjs";

export default {
key: "joggai-create-avatar-video",
name: "Create Avatar Video",
description: "Creates an avatar video using JoggAI API. [See the documentation](https://docs.jogg.ai/api-reference/Create-Avatar-Videos/CreateAvatarVideo)",
version: "0.0.1",
type: "action",
props: {
joggai,
screenStyle: {
type: "integer",
label: "Screen Style",
description: "Style of the screen.",
options: SCREEN_STYLE_OPTIONS,
},
avatarType: {
type: "string",
label: "Avatar Type",
description: "Source type of the avatar.",
options: AVATAR_TYPE_OPTIONS,
},
avatarId: {
propDefinition: [
joggai,
"avatarId",
({ avatarType }) => ({
avatarType,
}),
],
},
voiceType: {
type: "string",
label: "Voice Type",
description: "Source type of the voice.",
options: VOICE_TYPE_OPTIONS,
},
voiceId: {
propDefinition: [
joggai,
"voiceId",
({ voiceType }) => ({
voiceType,
}),
],
},
script: {
type: "string",
label: "Script",
description: "Script content for the avatar to speak. Must provide either script or `Audio URL`.",
optional: true,
},
audioUrl: {
type: "string",
label: "Audio URL",
description: "Url for Audio, either script or audio_url must be provided, but not both.",
optional: true,
},
aspectRatio: {
type: "string",
label: "Aspect Ratio",
description: "Aspect ratio of the output video.",
options: ASPECT_VIDEO_RATIO_OPTIONS,
},
caption: {
type: "boolean",
label: "Caption",
description: "Whether to add caption to the video.",
optional: true,
},
videoName: {
type: "string",
label: "Video Name",
description: "If you want to specify the name of the generated video, please use this parameter.",
optional: true,
},
},
async run({ $ }) {
if (!this.script && !this.audioUrl) {
throw new Error("You must provide at least one of `Script` or `Audio URL`.");
}
if (this.script && this.audioUrl) {
throw new Error("You must provide either `Script` or `Audio URL`, but not both.");
}

const response = await this.joggai.createAvatarVideo({
$,
data: {
screen_style: this.screenStyle,
avatar_type: this.avatarType && parseInt(this.avatarType),
avatar_id: this.avatarId,
voice_id: this.voiceId,
script: this.script,
audio_url: this.audioUrl,
aspect_ratio: this.aspectRatio && parseInt(this.aspectRatio),
caption: this.caption,
video_name: this.videoName,
},
});

checkResponse(response);

$.export("$summary", "Avatar video created successfully");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {
checkResponse,
prepareAdditionalProps,
prepareMediaData,
} from "../../common/utils.mjs";
import joggai from "../../joggai.app.mjs";

export default {
key: "joggai-create-product-from-product-info",
name: "Create Product from Product Info",
description: "Creates a product from product info using JoggAI API. [See the documentation](https://docs.jogg.ai/api-reference/URL-to-Video/CreateVideo)",
version: "0.0.1",
type: "action",
props: {
joggai,
name: {
propDefinition: [
joggai,
"name",
],
},
description: {
propDefinition: [
joggai,
"description",
],
},
targetAudience: {
propDefinition: [
joggai,
"targetAudience",
],
},
mediaQuantity: {
propDefinition: [
joggai,
"mediaQuantity",
],
},
},
async additionalProps() {
return prepareAdditionalProps(this);
},
async run({ $ }) {
const mediaData = await prepareMediaData(this);

const response = await this.joggai.createProduct({
$,
data: mediaData,
});

checkResponse(response);

$.export("$summary", "Product created from product info successfully");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { checkResponse } from "../../common/utils.mjs";
import joggai from "../../joggai.app.mjs";

export default {
key: "joggai-create-product-from-url",
name: "Create Product from URL",
description: "Creates a product from a URL using JoggAI API. [See the documentation](https://docs.jogg.ai/api-reference/URL-to-Video/UploadURL)",
version: "0.0.1",
type: "action",
props: {
joggai,
url: {
type: "string",
label: "Product URL",
description: "URL of the product to crawl.",
},
},
async run({ $ }) {
const response = await this.joggai.createProduct({
$,
data: {
url: this.url,
},
});

checkResponse(response);

$.export("$summary", `Product created from URL successfully with ID: ${response.data.product_id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {
checkResponse,
prepareMediaData,
} from "../../common/utils.mjs";
import joggai from "../../joggai.app.mjs";

export default {
key: "joggai-update-product-info",
name: "Update Product Info",
description: "Updates product info using JoggAI API. [See the documentation](https://docs.jogg.ai/api-reference/URL-to-Video/UpdateProduct)",
version: "0.0.1",
type: "action",
props: {
joggai,
productId: {
type: "string",
label: "Product ID",
description: "Product ID obtained from **Create Product Action** response.",
},
name: {
propDefinition: [
joggai,
"name",
],
optional: true,
},
description: {
propDefinition: [
joggai,
"description",
],
},
targetAudience: {
propDefinition: [
joggai,
"targetAudience",
],
},
},
async run({ $ }) {
const mediaData = await prepareMediaData(this, {
product_id: this.productId,
});

const response = await this.joggai.updateProduct({
$,
data: mediaData,
});

checkResponse(response);

$.export("$summary", "Product info updated successfully");
return response;
},
};
Loading
Loading