async generateConversationsInsights()

in frontend/src/app/contact-center-analyst/home/home.component.ts [193:220]


  async generateConversationsInsights(conversations: MatListOption[], isCustomer: boolean = true) {
    this.clearInsights(isCustomer);
    if (isCustomer) {
      this.insightsLoading = true;
    } else {
      this.searchInsightsLoading = true;
    }
    if (conversations.length == 1) {
      if (isCustomer) {
        this.selectedConversationHTML = String(marked.parse(conversations[0].value.conversation));
      } else {
        this.selectedConversationSearchHTML = String(marked.parse(conversations[0].value.conversation));
      }
    }
    else {
      if (isCustomer) {
        this.selectedConversationHTML = null;
      } else {
        this.selectedConversationSearchHTML = null;
      }
    }
    const generatedInsights: GeneratedInsights = await firstValueFrom(
      this.contactCenterAnalystService.generateConversationsInsights(
        conversations.map((conversation: MatListOption) => conversation.value)
      ) as Observable<GeneratedInsights>
    );
    this.updateInsights(generatedInsights, isCustomer);
  }