generateEmailTextWebsitePost()

in genai-for-marketing/frontend/src/app/website-post/website-post.component.ts [246:292]


  generateEmailTextWebsitePost() {

    if (this.showGenarateImageEmaildata) {
      this.showProgress = true
      let obj = {
        "type": "Webpost",
        "theme": this.selectedCampaignFromDropdown[0].data.theme,
        "context": this.val,
        "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.name
      }
      this.websitePostService.generateEmailTextWebsitePost(obj).subscribe((res: any) => {
        this.textContent = res.generated_content.text;
        this.showEmailContents = true;
        this.showProgress = false;
      });
    }
    else {
      if (this.val === "") {
        alert('please enter context value')

      }
      else {
        this.showProgress = true
        let obj = {
          "type": "Webpost",
          "theme": this.selectedCampaignFromDropdown[0].data?.theme,
          "context": this.val,
          "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.val + ",aspect_ration: " + this.aspectsRatio + ",color_tone:" + this.colorTone
            + ", lighting:" + this.lighting + ",compostion:" + this.compostion + ",content_type:" + this.ContentType
        }
        this.websitePostService.generateEmailTextWebsitePost(obj).subscribe((res: any) => {
          this.textContent = res.generated_content.text;
          this.showEmailContents = true;
          this.generateImageWebsitePost()
        });
      }
    }
    // this.showProgress = false
  }