onSummarizeNewsSubmit()

in frontend/src/app/trendspotting/trendspotting.component.ts [120:153]


  onSummarizeNewsSubmit() {
    this.showProgress = true;
    this.summarizeError = null
    this.showData = false;
    this.getCampaign();
    let keywords = []
    keywords.push(this.summarizeNewsForm.controls.keyword1?.value)

    let keyword2Value = this.summarizeNewsForm.controls.keyword2?.value;
    if (keyword2Value) {
      keywords.push(keyword2Value)
    }

    let keyword3Value = this.summarizeNewsForm.controls.keyword3?.value;
    if (keyword3Value) {
      keywords.push(keyword3Value)
    }
    let obj = {
      "keywords": keywords,
      "max_records": this.summarizeNewsForm.controls.maxRecords?.value,
      "max_days": 30
    }
    this.trendService.postSummarizeNews(obj).subscribe({
      next: (res: any) => {
        this.summarizeNewsResults = res?.summaries;
        this.showData = true;
        this.showProgress = false;
      },
      error: (error: any) => {
        this.summarizeError = error
        throw error
      }
    })
  }