-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - hamsa #16226
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 - hamsa #16226
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4bfd583
hamsa init
luancazarine 698e80b
[Components] hamsa #16189
luancazarine 8a83712
pnpm update
luancazarine 9499cf8
fix action key
luancazarine 0fd8ddd
some adjsuts and added List Jobs action
luancazarine 8bdf615
Update components/hamsa/actions/list-jobs/list-jobs.mjs
luancazarine c80d53e
fix synthesize spelling
michelle0927 e77efdb
Merge branch 'master' into issue-16189
luancazarine 3b88011
some adjusts
luancazarine 1748a53
pnpm update
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
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)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
40 changes: 40 additions & 0 deletions
40
components/hamsa/actions/create-content/create-content.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,40 @@ | ||
| import { AI_PARTS_OPTIONS } from "../../common/constants.mjs"; | ||
| import hamsa from "../../hamsa.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hamsa-create-content", | ||
| name: "Create AI Content", | ||
| description: "Transform transcribed content into various formats for content marketing. [See the documentation](https://docs.tryhamsa.com/api-reference/endpoint/post-ai-content)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hamsa, | ||
| jobId: { | ||
| propDefinition: [ | ||
| hamsa, | ||
| "jobId", | ||
| ], | ||
| }, | ||
| aiParts: { | ||
| type: "string[]", | ||
| label: "AI Parts", | ||
| description: "Parts for AI content in marketing.", | ||
| options: AI_PARTS_OPTIONS, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hamsa.createAIContent({ | ||
| $, | ||
| params: { | ||
| jobId: this.jobId, | ||
| }, | ||
| data: { | ||
| aiParts: this.aiParts, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `AI content creation job created with ID: ${response.data.id}`); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
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,21 @@ | ||
| import hamsa from "../../hamsa.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hamsa-list-jobs", | ||
| name: "List Jobs", | ||
| description: "Fetch the list of jobs from Hamsa. [See the documentation](https://docs.tryhamsa.com/api-reference/endpoint/get-jobs-list)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hamsa, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hamsa.listJobs({ | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully fetched ${response?.data?.jobs?.length} jobs.`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
66 changes: 66 additions & 0 deletions
66
components/hamsa/actions/synthesize-voice/synthesize-voice.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,66 @@ | ||
| import hamsa from "../../hamsa.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hamsa-synthesize-voice", | ||
| name: "Synthesize Voice", | ||
| description: "Converts text input into artificial speech using Hamsa. [See the documentation](https://docs.tryhamsa.com/api-reference/endpoint/generate-tts)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hamsa, | ||
| voiceId: { | ||
| propDefinition: [ | ||
| hamsa, | ||
| "voiceId", | ||
| ], | ||
| }, | ||
| text: { | ||
| type: "string", | ||
| label: "Text for TTS", | ||
| description: "The text you want to convert to speech. Minimum 5 words required.", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| webhookUrl: { | ||
| propDefinition: [ | ||
| hamsa, | ||
| "webhookUrl", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| webhookAuthKey: { | ||
| type: "string", | ||
| label: "Webhook Auth Key", | ||
| description: "Authorization key for the webhook notifications.", | ||
| optional: true, | ||
| }, | ||
| webhookAuthSecret: { | ||
| type: "string", | ||
| label: "Webhook Auth Secret", | ||
| description: "Authorization secret for the webhook notifications.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const webhookAuth = {}; | ||
| if (this.webhookAuthKey) { | ||
| webhookAuth.authKey = this.webhookAuthKey; | ||
| } | ||
| if (this.webhookAuthSecret) { | ||
| webhookAuth.authSecret = this.webhookAuthSecret; | ||
| } | ||
| const data = { | ||
| voiceId: this.voiceId, | ||
| text: this.text, | ||
| webhookUrl: this.webhookUrl, | ||
| }; | ||
| if (Object.keys(webhookAuth).length) { | ||
| data.webhookAuth = webhookAuth; | ||
| } | ||
| const response = await this.hamsa.generateTTS({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $.export("$summary", `Text to speech job successfully created with ID ${response.data.id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
88 changes: 88 additions & 0 deletions
88
components/hamsa/actions/transcribe-video/transcribe-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,88 @@ | ||
| import { | ||
| LANGUAGE_OPTIONS, | ||
| MODEL_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import hamsa from "../../hamsa.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hamsa-transcribe-video", | ||
| name: "Transcribe Video", | ||
| description: "Automatically transcribe Arabic videos from YouTube URLs or direct links. [See the documentation](https://docs.tryhamsa.com/api-reference/endpoint/transcribe)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hamsa, | ||
| mediaUrl: { | ||
| type: "string", | ||
| label: "Media URL", | ||
| description: "The URL of the video to be transcribed.", | ||
| }, | ||
| model: { | ||
| type: "string", | ||
| label: "Model", | ||
| description: "The model you want to use to transcribe.", | ||
| options: MODEL_OPTIONS, | ||
| }, | ||
| webhookUrl: { | ||
| propDefinition: [ | ||
| hamsa, | ||
| "webhookUrl", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| webhookAuthKey: { | ||
| type: "string", | ||
| label: "Webhook Auth Key", | ||
| description: "The key to use for authenticating the webhook.", | ||
| optional: true, | ||
| }, | ||
| webhookAuthSecret: { | ||
| type: "string", | ||
| label: "Webhook Auth Secret", | ||
| description: "The secret to use for authenticating the webhook.", | ||
| secret: true, | ||
| optional: true, | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "The title of the transcription.", | ||
| optional: true, | ||
| }, | ||
| language: { | ||
| type: "string", | ||
| label: "Language", | ||
| description: "The language of the transcription.", | ||
| options: LANGUAGE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const webhookAuth = {}; | ||
| if (this.webhookAuthKey) { | ||
| webhookAuth.authKey = this.webhookAuthKey; | ||
| } | ||
| if (this.webhookAuthSecret) { | ||
| webhookAuth.authSecret = this.webhookAuthSecret; | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const data = { | ||
| mediaUrl: this.mediaUrl, | ||
| model: this.model, | ||
| processingType: "async", | ||
| webhookUrl: this.webhookUrl, | ||
| title: this.title, | ||
| language: this.language, | ||
| }; | ||
| if (Object.keys(webhookAuth).length) { | ||
| data.webhookAuth = webhookAuth; | ||
| } | ||
|
|
||
| const response = await this.hamsa.transcribeVideo({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
| $.export("$summary", "Transcription job started successfully."); | ||
| 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 |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| export const LIMIT = 100; | ||
|
|
||
| export const MODEL_OPTIONS = [ | ||
| { | ||
| label: "Hamsa-General-V2.0 - Our most advanced ASR model, optimized for high accuracy across podcasts, videos, and general audio.", | ||
| value: "Hamsa-General-V2.0", | ||
| }, | ||
| { | ||
| label: "Hamsa-Conversational-V1.0 - Best suited for conversational use cases, optimized for accurately transcribing phone calls and meetings.", | ||
| value: "Hamsa-Conversational-V1.0", | ||
| }, | ||
| ]; | ||
|
|
||
| export const LANGUAGE_OPTIONS = [ | ||
| "ar", | ||
| "en", | ||
| ]; | ||
|
|
||
| export const AI_PARTS_OPTIONS = [ | ||
| { | ||
| label: "Introduction", | ||
| value: "introduction", | ||
| }, | ||
| { | ||
| label: "Titles", | ||
| value: "titles", | ||
| }, | ||
| { | ||
| label: "Summary", | ||
| value: "summary", | ||
| }, | ||
| { | ||
| label: "Web Article SEO Friendly", | ||
| value: "webArticleSEOFriendly", | ||
| }, | ||
| { | ||
| label: "Key Topics With Bullets", | ||
| value: "keyTopicsWithBullets", | ||
| }, | ||
| { | ||
| label: "Keywords", | ||
| value: "keywords", | ||
| }, | ||
| { | ||
| label: "Threads By Instagram", | ||
| value: "threadsByInstagram", | ||
| }, | ||
| { | ||
| label: "FAQ", | ||
| value: "faq", | ||
| }, | ||
| { | ||
| label: "Facebook Post", | ||
| value: "facebookPost", | ||
| }, | ||
| { | ||
| label: "YouTube Description", | ||
| value: "youtubeDescription", | ||
| }, | ||
| { | ||
| label: "Twitter Thread", | ||
| value: "twitterThread", | ||
| }, | ||
| { | ||
| label: "LinkedIn Post", | ||
| value: "linkedInPost", | ||
| }, | ||
| ]; |
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.