checkIfMessege()

in ChatbotUI/src/app/components/main/chat/chatbar/chatbar.component.ts [165:189]


  checkIfMessege() {
    if (this.conversation.length == 1 && this.conversation[0].type == 'user') {
      this.showLoader = true;
      this.setTimeoutForLoaderText();
      this.setCyclicBackgroundImages();
      this.startTimer = true;
      this.botStartTime = new Date().getTime()
      this.initialQuestion = this.conversation[0].body;
      this.pushQuestion(this.initialQuestion);
      this.chatService.postChat([...this.conversation]).subscribe({
        next: (event: HttpEvent<string>) => {
          if (event.type === HttpEventType.DownloadProgress) {
            this.handleBotResponse(
              (event as HttpDownloadProgressEvent).partialText + "…",
            );
          } else if (event.type === HttpEventType.Response) {
            this.handleBotResponse(event.body!);
          }
        },
        error: () => {
          console.log("Error getting stream events");
        },
      });
    }
  }