generateSocialMediaPosts()

in genai-for-marketing/frontend/src/app/social-media-post/social-media-post.component.ts [211:238]


  generateSocialMediaPosts() {
    this.showProgress = true
    let obj = {
      "type": "SocialMedia",
      "theme": this.selectedCampaignFromDropdown[0].data.theme,
      "context": this.promptVal,
      "no_of_char": 500,
      "audience_age_range": this.selectedCampaignFromDropdown[0].data.brief.age_select_theme,
      "audience_gender": this.selectedCampaignFromDropdown[0].data.brief.gender_select_theme,
      "image_generate": false,
      "prompt": "theme:" + this.selectedCampaignFromDropdown[0].data.theme
        + ",aspect_ration: " + this.socialMediaForm.controls.aspectRation.value
        + ",color_tone:" + this.socialMediaForm.controls.colorTone.value
        + ", lighting:" + this.socialMediaForm.controls.lighting.value
        + ",compostion:" + this.socialMediaForm.controls.compostion.value
        + ",content_type:" + this.socialMediaForm.controls.contentType.value
    }
    this.emailService.generateEmailText(obj).subscribe((res: any) => {

      let hashtags = res.generated_content.text.match(/#[a-z]+/gi);
      this.textContent = res.generated_content.text;
      this.hashtagValue = hashtags
      this.showEmailContents = true;
      this.showProgress = false;
      this.showImageSection = true;
      this.showPostSection = true;
    });
  }