-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
17338 components joggai #17503
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
dfb2d1c
[Components] joggai #17338
luancazarine 82a4bd1
pnpm update
luancazarine 61d4e5a
Update product creation action description to point to the correct do…
luancazarine 213015b
Refactor update-product-info action by removing unused prepareAdditio…
luancazarine 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
97 changes: 97 additions & 0 deletions
97
components/joggai/actions/create-ai-avatar-photo/create-ai-avatar-photo.mjs
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,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
113
components/joggai/actions/create-avatar-video/create-avatar-video.mjs
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,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), | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
caption: this.caption, | ||
video_name: this.videoName, | ||
}, | ||
}); | ||
|
||
checkResponse(response); | ||
|
||
$.export("$summary", "Avatar video created successfully"); | ||
return response; | ||
}, | ||
}; |
57 changes: 57 additions & 0 deletions
57
...ents/joggai/actions/create-product-from-product-info/create-product-from-product-info.mjs
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 { | ||
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; | ||
}, | ||
}; |
31 changes: 31 additions & 0 deletions
31
components/joggai/actions/create-product-from-url/create-product-from-url.mjs
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,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; | ||
}, | ||
}; |
55 changes: 55 additions & 0 deletions
55
components/joggai/actions/update-product-info/update-product-info.mjs
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,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; | ||
}, | ||
}; |
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.