Spaces:
Building
Building
Update flare-ui/src/app/components/chat/realtime-chat.component.ts
Browse files
flare-ui/src/app/components/chat/realtime-chat.component.ts
CHANGED
@@ -9,7 +9,7 @@ import { MatChipsModule } from '@angular/material/chips';
|
|
9 |
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
10 |
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
11 |
import { Inject } from '@angular/core';
|
12 |
-
import { Subject, takeUntil } from 'rxjs';
|
13 |
|
14 |
import { ConversationManagerService, ConversationState, ConversationMessage } from '../../services/conversation-manager.service';
|
15 |
import { AudioStreamService } from '../../services/audio-stream.service';
|
@@ -329,6 +329,7 @@ export class RealtimeChatComponent implements OnInit, OnDestroy, AfterViewChecke
|
|
329 |
];
|
330 |
|
331 |
private destroyed$ = new Subject<void>();
|
|
|
332 |
private shouldScrollToBottom = false;
|
333 |
private animationId: number | null = null;
|
334 |
private currentAudio: HTMLAudioElement | null = null;
|
@@ -415,6 +416,7 @@ export class RealtimeChatComponent implements OnInit, OnDestroy, AfterViewChecke
|
|
415 |
ngOnDestroy(): void {
|
416 |
this.destroyed$.next();
|
417 |
this.destroyed$.complete();
|
|
|
418 |
this.stopVisualization();
|
419 |
this.cleanupAudio();
|
420 |
|
|
|
9 |
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
10 |
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
11 |
import { Inject } from '@angular/core';
|
12 |
+
import { Subject, Subscription, takeUntil } from 'rxjs';
|
13 |
|
14 |
import { ConversationManagerService, ConversationState, ConversationMessage } from '../../services/conversation-manager.service';
|
15 |
import { AudioStreamService } from '../../services/audio-stream.service';
|
|
|
329 |
];
|
330 |
|
331 |
private destroyed$ = new Subject<void>();
|
332 |
+
private subscriptions = new Subscription();
|
333 |
private shouldScrollToBottom = false;
|
334 |
private animationId: number | null = null;
|
335 |
private currentAudio: HTMLAudioElement | null = null;
|
|
|
416 |
ngOnDestroy(): void {
|
417 |
this.destroyed$.next();
|
418 |
this.destroyed$.complete();
|
419 |
+
this.subscriptions.unsubscribe();
|
420 |
this.stopVisualization();
|
421 |
this.cleanupAudio();
|
422 |
|