File size: 1,404 Bytes
678e6ea
 
 
 
 
 
 
 
 
 
 
 
0044218
678e6ea
 
 
 
 
 
 
 
 
 
becf4e3
678e6ea
 
 
 
 
 
0044218
 
 
678e6ea
 
 
10fcd1e
678e6ea
 
07cf142
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<div class="chat-container">
  <div class="chat-box" #chatBox>
    <div class="chat-message" *ngFor="let message of messages; trackBy: trackByIndex">
      <!-- User Message -->
      <div class="user-message" *ngIf="message.user">
        <div class="avatar">
          <img src="/user.png" alt="User" />
        </div>
        <div class="message-content">
          <p>{{ message.user }}</p>
        </div>
      </div>

      <!-- Bot Message -->
      <div class="bot-message" *ngIf="message.bot !== null">
        <div class="message-content">
          <!-- Show typing dots for the latest pair while waiting -->
          <ng-container *ngIf="message.bot === '' && isLast(message) && loading; else botText">
            <div class="typing">
              <span></span><span></span><span></span>
            </div>
          </ng-container>
          <ng-template #botText>
            <markdown [data]="message.bot"></markdown>
          </ng-template>
        </div>
        <div class="avatar">
          <img src="/chatbot.png" alt="Bot" />
        </div>
      </div>
    </div>
  </div>

  <div class="input-box">
    <input type="text"
           [(ngModel)]="question"
           placeholder="Thinking about a stock? Let’s talk."
           (keyup.enter)="askQuestion()" />
    <button (click)="askQuestion()" [disabled]="loading && question.trim() === ''">Send</button>
  </div>
</div>